From WikiChip
Difference between revisions of "Module:microarchitecture"
(added PE configs) |
|||
(40 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
local uarch = {} | local uarch = {} | ||
+ | local origArgs | ||
function add_header_main(box, str) | function add_header_main(box, str) | ||
Line 27: | Line 28: | ||
:attr('class', 'value') | :attr('class', 'value') | ||
:wikitext(value) | :wikitext(value) | ||
+ | end | ||
+ | |||
+ | function has_arg(name) | ||
+ | -- The argument can exist and be empty or not exist at all | ||
+ | return string.len(origArgs[name] or '') > 0 | ||
+ | end | ||
+ | |||
+ | function arg(name) | ||
+ | return origArgs[name] | ||
+ | end | ||
+ | |||
+ | function uarch.set_val(prop, val) | ||
+ | uarch.frame:preprocess('{{#set: ' .. prop .. '=' .. val .. '}}') | ||
end | end | ||
function uarch.uarch(frame) | function uarch.uarch(frame) | ||
− | + | uarch.frame = frame | |
− | |||
if frame == mw.getCurrentFrame() then | if frame == mw.getCurrentFrame() then | ||
origArgs = frame:getParent().args | origArgs = frame:getParent().args | ||
Line 43: | Line 56: | ||
infobox | infobox | ||
:attr('class', 'infobox') | :attr('class', 'infobox') | ||
+ | |||
+ | infobox | ||
+ | :tag('tr') | ||
+ | :tag('td'):attr('colspan', '2') | ||
+ | :tag('small'):attr('style', 'float: right; font-weight: bold;') | ||
+ | :wikitext('[[Special:FormEdit/microarchitecture/' .. frame:preprocess('{{FULLPAGENAME}}') .. '|<i class="fa fa-edit"></i>Edit Values]]') | ||
-- header | -- header | ||
− | if | + | if not has_arg('name') then return tostring(infobox) .. '[[Category:Articles with invalid parameter in template]]<strong>* ERROR: "name" is missing!</strong>' end |
− | + | ||
+ | uarch.set_val('name', arg('name')) | ||
+ | uarch.set_val('codename', arg('name')) | ||
+ | add_header_main(infobox, arg('name') .. ' µarch') | ||
add_header(infobox, 'General Info') | add_header(infobox, 'General Info') | ||
+ | |||
+ | if not has_arg('atype') then return tostring(infobox) .. '[[Category:Articles with invalid parameter in template]]<strong>ERROR: "atype" is missing!</strong>' end | ||
+ | if not has_arg('designer') then return tostring(infobox) .. '[[Category:Articles with invalid parameter in template]]<strong>ERROR: "designer" is missing!</strong>' end | ||
-- arch type | -- arch type | ||
− | + | add_entry(infobox, 'Arch Type', arg('atype') .. | |
− | add_entry(infobox, 'Arch Type', | + | '[[Category:' .. string.lower(arg('atype')) .. ' microarchitectures by ' .. string.lower(arg('designer')) .. ']]') |
− | + | uarch.set_val('microarchitecture type', arg('atype')) | |
− | '[[Category:' .. string.lower( | ||
-- designer | -- designer | ||
− | |||
local devs | local devs | ||
− | + | uarch.set_val('designer', arg('designer')) | |
− | devs = | + | devs = arg('designer') .. '[[Category:microarchitectures by ' .. string.lower(arg('designer')) .. ']]' |
for i = 2, 10 do | for i = 2, 10 do | ||
− | if | + | if not has_arg('designer ' .. i) then break end |
− | devs = devs .. ', [[ | + | uarch.set_val('designer', arg('designer ' .. i)) |
− | + | devs = devs .. ', ' .. arg('designer ' .. i) .. | |
− | + | '[[Category:microarchitectures by ' .. string.lower(arg('designer ' .. i)) .. ']]' | |
+ | devs = devs .. | ||
+ | '[[Category:' .. string.lower(arg('atype')) .. ' microarchitectures by ' .. string.lower(arg('designer ' .. i)) .. ']]' | ||
end | end | ||
add_entry(infobox, 'Designer', devs) | add_entry(infobox, 'Designer', devs) | ||
Line 73: | Line 98: | ||
-- manufacturer | -- manufacturer | ||
− | if | + | if not has_arg('manufacturer') then return '[[Category:Articles with invalid parameter in template]]ERROR: "manufacturer" is missing!' end |
− | local | + | uarch.set_val('manufacturer', arg('manufacturer')) |
− | + | local devs = '[[manufacturer::' .. arg('manufacturer') .. ']]' | |
− | |||
− | |||
− | |||
for i = 2, 10 do | for i = 2, 10 do | ||
− | if | + | if not has_arg('manufacturer ' .. i) then break end |
− | devs = devs .. ', [[manufacturer::' .. | + | uarch.set_val('manufacturer', arg('manufacturer ' .. i)) |
− | + | devs = devs .. ', [[manufacturer::' .. arg('manufacturer ' .. i) .. ']]' | |
end | end | ||
add_entry(infobox, 'Manufacturer', devs) | add_entry(infobox, 'Manufacturer', devs) | ||
-- intro | -- intro | ||
− | if | + | if has_arg('introduction') then |
− | add_entry(infobox, 'Introduction', ' | + | uarch.set_val('first launched', arg('introduction')) |
+ | add_entry(infobox, 'Introduction', arg('introduction')) | ||
end | end | ||
-- phase-out | -- phase-out | ||
− | if | + | if has_arg('phase-out') then |
− | add_entry(infobox, 'Phase-out', ' | + | uarch.set_val('phase-out', arg('phase-out')) |
+ | add_entry(infobox, 'Phase-out', arg('phase-out')) | ||
end | end | ||
Line 99: | Line 123: | ||
-- process | -- process | ||
− | if | + | if has_arg('process') then |
local proc | local proc | ||
− | + | uarch.set_val('process', arg('process')) | |
− | + | proc = '[[' .. arg('process') .. ' process|' .. arg('process') .. ']]' | |
for i = 2, 10 do | for i = 2, 10 do | ||
− | if string.len(origArgs[' | + | if string.len(origArgs['process ' .. i] or '') == 0 then break end |
− | + | uarch.set_val('process', arg('process ' .. i)) | |
− | + | proc = proc .. ', [['.. arg('process ' .. i) .. ' process|' .. arg('process ' .. i) .. ']]' | |
end | end | ||
add_entry(infobox, 'Process', proc) | add_entry(infobox, 'Process', proc) | ||
Line 121: | Line 145: | ||
.. '[[' .. origArgs.cores .. ' cores|' .. origArgs.cores .. ']]' | .. '[[' .. origArgs.cores .. ' cores|' .. origArgs.cores .. ']]' | ||
− | for i = 2, | + | for i = 2, 20 do |
− | if string.len(origArgs[' | + | if string.len(origArgs['cores ' .. i] or '') == 0 then break end |
− | core = core .. ', [[core count::' ..origArgs[' | + | core = core .. ', [[core count::' ..origArgs['cores ' .. i] .. '| ]]' |
− | .. '[[' .. origArgs[' | + | .. '[[' .. origArgs['cores ' .. i] .. ' cores|' .. origArgs['cores ' .. i] .. ']]' |
end | end | ||
add_entry(infobox, 'Core Configs', core) | add_entry(infobox, 'Core Configs', core) | ||
Line 130: | Line 154: | ||
− | add_header(infobox, 'Pipeline') | + | -- processing elements |
+ | if has_arg('processing elements') then | ||
+ | local pe | ||
+ | |||
+ | pe = '[[processing element count::' .. arg('processing elements') .. '| ]]' | ||
+ | .. arg('processing elements') | ||
+ | |||
+ | for i = 2, 20 do | ||
+ | if not has_arg('processing elements ' .. i) then break end | ||
+ | pe = pe .. ', [[processing element count::' .. arg('processing elements ' .. i) .. '| ]]' | ||
+ | .. arg('processing elements ' .. i) | ||
+ | end | ||
+ | add_entry(infobox, 'PE Configs', pe) | ||
+ | end | ||
+ | |||
+ | if has_arg('type') or has_arg('oooe') or has_arg('speculative') | ||
+ | or has_arg('renaming') or has_arg('stages') or has_arg('stages min') | ||
+ | or has_arg('decode') then | ||
+ | add_header(infobox, 'Pipeline') | ||
+ | end | ||
-- type | -- type | ||
− | if string.len(origArgs | + | if string.len(origArgs['type'] or '') > 0 then |
local ptype | local ptype | ||
− | ptype = origArgs | + | ptype = origArgs['type'] |
for i = 2, 10 do | for i = 2, 10 do | ||
− | if string.len(origArgs[' | + | if string.len(origArgs['type ' .. i] or '') == 0 then break end |
− | ptype = ptype .. ', ' .. origArgs[' | + | ptype = ptype .. ', ' .. origArgs['type ' .. i] |
end | end | ||
add_entry(infobox, 'Type', ptype) | add_entry(infobox, 'Type', ptype) | ||
Line 154: | Line 197: | ||
end | end | ||
− | -- | + | -- renaming |
− | if string.len(origArgs. | + | if string.len(origArgs.renaming or '') > 0 then |
− | add_entry(infobox, 'Reg Renaming', origArgs. | + | add_entry(infobox, 'Reg Renaming', origArgs.renaming) |
end | end | ||
− | -- | + | -- stages |
− | if string.len(origArgs. | + | if string.len(origArgs.stages or '') > 0 then |
− | add_entry(infobox, 'Stages', '[[pipeline stages::' .. origArgs. | + | add_entry(infobox, 'Stages', '[[pipeline stages::' .. origArgs.stages .. ']]') |
end | end | ||
− | -- | + | -- stages min/max |
− | if string.len(origArgs | + | if string.len(origArgs['stages min'] or '') > 0 then |
add_entry(infobox, 'Stages', | add_entry(infobox, 'Stages', | ||
− | '[[pipeline stages (min)::' .. origArgs | + | '[[pipeline stages (min)::' .. origArgs['stages min'] .. ']]' |
− | .. '-[[pipeline stages (max)::' .. origArgs | + | .. '-[[pipeline stages (max)::' .. origArgs['stages max'] .. ']]') |
end | end | ||
Line 177: | Line 220: | ||
− | + | if has_arg('isa') or has_arg('features') or has_arg('extension') then | |
+ | add_header(infobox, 'Instructions') | ||
+ | end | ||
-- ISA | -- ISA | ||
Line 185: | Line 230: | ||
isa = '[[instruction set architecture::' .. origArgs.isa .. ']]' | isa = '[[instruction set architecture::' .. origArgs.isa .. ']]' | ||
for i = 2, 10 do | for i = 2, 10 do | ||
− | if string.len(origArgs[' | + | if string.len(origArgs['isa ' .. i] or '') == 0 then break end |
− | isa = isa .. ', ' .. '[[instruction set architecture::' .. origArgs[' | + | isa = isa .. ', ' .. '[[instruction set architecture::' .. origArgs['isa ' .. i] .. ']]' |
end | end | ||
add_entry(infobox, 'ISA', isa) | add_entry(infobox, 'ISA', isa) | ||
Line 197: | Line 242: | ||
features = origArgs.features | features = origArgs.features | ||
for i = 2, 10 do | for i = 2, 10 do | ||
− | if string.len(origArgs[' | + | if string.len(origArgs['features ' .. i] or '') == 0 then break end |
− | features = features .. ', ' .. origArgs[' | + | features = features .. ', ' .. origArgs['features ' .. i] |
end | end | ||
add_entry(infobox, 'Features', features) | add_entry(infobox, 'Features', features) | ||
Line 204: | Line 249: | ||
-- extensions | -- extensions | ||
− | if string.len(origArgs. | + | if string.len(origArgs.extension or '') > 0 then |
− | local | + | local extension |
− | + | extension = origArgs.extension | |
for i = 2, 40 do | for i = 2, 40 do | ||
− | if string.len(origArgs[' | + | if string.len(origArgs['extension ' .. i] or '') == 0 then break end |
− | + | extension = extension .. ', ' .. origArgs['extension ' .. i] | |
end | end | ||
− | add_entry(infobox, 'Extensions', | + | add_entry(infobox, 'Extensions', extension) |
end | end | ||
− | add_header(infobox, 'Cache') | + | |
+ | |||
+ | |||
+ | if has_arg('l1') or has_arg('l1i') or has_arg('l1d') or | ||
+ | has_arg('l2') or has_arg('l3') or has_arg('l3') or | ||
+ | has_arg('side cache') then | ||
+ | add_header(infobox, 'Cache') | ||
+ | end | ||
-- L1i | -- L1i | ||
if string.len(origArgs.l1i or '') > 0 then | if string.len(origArgs.l1i or '') > 0 then | ||
local li = origArgs.l1i | local li = origArgs.l1i | ||
− | if string.len(origArgs | + | if string.len(origArgs['l1i per'] or '') > 0 then |
− | li = li .. '/' .. origArgs | + | li = li .. '/' .. origArgs['l1i per'] |
end | end | ||
− | if string.len(origArgs | + | if string.len(origArgs['l1i desc'] or '') > 0 then |
− | li = li .. '<br>' .. origArgs | + | li = li .. '<br>' .. origArgs['l1i desc'] |
end | end | ||
add_entry(infobox, 'L1I Cache', li) | add_entry(infobox, 'L1I Cache', li) | ||
Line 232: | Line 284: | ||
if string.len(origArgs.l1d or '') > 0 then | if string.len(origArgs.l1d or '') > 0 then | ||
local li = origArgs.l1d | local li = origArgs.l1d | ||
− | if string.len(origArgs | + | if string.len(origArgs['l1d per'] or '') > 0 then |
− | li = li .. '/' .. origArgs | + | li = li .. '/' .. origArgs['l1d per'] |
end | end | ||
− | if string.len(origArgs | + | if string.len(origArgs['l1d desc'] or '') > 0 then |
− | li = li .. '<br>' .. origArgs | + | li = li .. '<br>' .. origArgs['l1d desc'] |
end | end | ||
add_entry(infobox, 'L1D Cache', li) | add_entry(infobox, 'L1D Cache', li) | ||
+ | end | ||
+ | |||
+ | -- L1, Unified | ||
+ | if string.len(origArgs.l1 or '') > 0 then | ||
+ | local li = origArgs.l1 | ||
+ | if string.len(origArgs['l1 per'] or '') > 0 then | ||
+ | li = li .. '/' .. origArgs['l1 per'] | ||
+ | end | ||
+ | if string.len(origArgs['l1 desc'] or '') > 0 then | ||
+ | li = li .. '<br>' .. origArgs['l1 desc'] | ||
+ | end | ||
+ | add_entry(infobox, 'L1 Cache', li) | ||
end | end | ||
Line 244: | Line 308: | ||
if string.len(origArgs.l2 or '') > 0 then | if string.len(origArgs.l2 or '') > 0 then | ||
local l2 = origArgs.l2 | local l2 = origArgs.l2 | ||
− | if string.len(origArgs | + | if string.len(origArgs['l2 per'] or '') > 0 then |
− | l2 = l2 .. '/' .. origArgs | + | l2 = l2 .. '/' .. origArgs['l2 per'] |
end | end | ||
− | if string.len(origArgs | + | if string.len(origArgs['l2 desc'] or '') > 0 then |
− | l2 = l2 .. '<br>' .. origArgs | + | l2 = l2 .. '<br>' .. origArgs['l2 desc'] |
end | end | ||
add_entry(infobox, 'L2 Cache', l2) | add_entry(infobox, 'L2 Cache', l2) | ||
Line 256: | Line 320: | ||
if string.len(origArgs.l3 or '') > 0 then | if string.len(origArgs.l3 or '') > 0 then | ||
local l3 = origArgs.l3 | local l3 = origArgs.l3 | ||
− | if string.len(origArgs | + | if string.len(origArgs['l3 per'] or '') > 0 then |
− | l3 = l3 .. '/' .. origArgs | + | l3 = l3 .. '/' .. origArgs['l3 per'] |
end | end | ||
− | if string.len(origArgs | + | if string.len(origArgs['l3 desc'] or '') > 0 then |
− | l3 = l3 .. '<br>' .. origArgs | + | l3 = l3 .. '<br>' .. origArgs['l3 desc'] |
end | end | ||
add_entry(infobox, 'L3 Cache', l3) | add_entry(infobox, 'L3 Cache', l3) | ||
Line 268: | Line 332: | ||
if string.len(origArgs.l4 or '') > 0 then | if string.len(origArgs.l4 or '') > 0 then | ||
local l4 = origArgs.l4 | local l4 = origArgs.l4 | ||
− | if string.len(origArgs | + | if string.len(origArgs['l4 per'] or '') > 0 then |
− | l4 = l4 .. '/' .. origArgs | + | l4 = l4 .. '/' .. origArgs['l4 per'] |
end | end | ||
− | if string.len(origArgs | + | if string.len(origArgs['l4 desc'] or '') > 0 then |
− | l4 = l4 .. '<br>' .. origArgs | + | l4 = l4 .. '<br>' .. origArgs['l4 desc'] |
end | end | ||
add_entry(infobox, 'L4 Cache', l4) | add_entry(infobox, 'L4 Cache', l4) | ||
end | end | ||
− | -- | + | -- Side $ |
− | if | + | if has_arg('side cache') then |
− | local | + | local sidecache = arg('side cache') |
− | if | + | if has_arg('side cache per') then |
− | + | sidecache = sidecache .. '/' .. arg('side cache per') | |
end | end | ||
− | if | + | if has_arg('side cache desc') then |
− | + | sidecache = sidecache .. '<br>' .. arg('side cache desc') | |
end | end | ||
− | add_entry(infobox, ' | + | add_entry(infobox, 'Side Cache', sidecache) |
end | end | ||
− | |||
− | |||
− | |||
-- cores | -- cores | ||
− | if | + | if has_arg('core name') then |
− | + | add_header(infobox, 'Cores') | |
− | + | ||
− | cores = | + | local cores = arg('core name') |
for i = 2, 10 do | for i = 2, 10 do | ||
− | if | + | if not has_arg('core name ' .. i) then break end |
− | cores = cores .. ', ' .. | + | cores = cores .. ',<br>' .. arg('core name ' .. i) |
end | end | ||
− | add_entry(infobox, 'Core Names', | + | add_entry(infobox, 'Core Names', cores) |
end | end | ||
− | if | + | if has_arg('successor') or has_arg('predecessor') then |
− | |||
add_header(infobox, 'Succession') | add_header(infobox, 'Succession') | ||
local s = infobox:tag('tr') | local s = infobox:tag('tr') | ||
− | local | + | local td = s:tag('td'):attr('colspan', '2') |
− | local d2 = | + | local d1 = td:tag('div'):attr('style', 'display: inline-flex;') |
− | if | + | local d2 = td:tag('div'):attr('style', 'display: inline-flex; float: right;') |
+ | if has_arg('predecessor') then | ||
local list | local list | ||
− | if | + | if has_arg('predecessor link') then |
− | list = '[[' .. | + | list = '[[' .. arg('predecessor link') .. '|' .. arg('predecessor') .. ']]' |
else | else | ||
− | list = '[[' .. | + | list = '[[' .. arg('predecessor') .. ']]' |
end | end | ||
for i = 2, 10 do | for i = 2, 10 do | ||
− | if | + | if not has_arg('predecessor ' .. i) then break end |
− | if | + | if has_arg('predecessor ' .. i .. ' link') then |
− | list = list .. '<br>[[' .. | + | list = list .. '<br>[[' .. arg('predecessor ' .. i .. ' link') .. '|' .. arg('predecessor ' .. i) .. ']]' |
− | |||
else | else | ||
− | list = list .. '<br>[[' .. | + | list = list .. '<br>[[' .. arg('predecessor ' .. i) .. ']]' |
end | end | ||
end | end | ||
Line 337: | Line 397: | ||
:wikitext(list) | :wikitext(list) | ||
end | end | ||
− | if | + | if has_arg('successor') then |
local list | local list | ||
− | if | + | if has_arg('successor link') then |
− | list = '[[' .. | + | list = '[[' .. arg('successor link') .. '|' .. arg('successor') .. ']]' |
else | else | ||
− | list = '[[' .. | + | list = '[[' .. arg('successor') .. ']]' |
end | end | ||
for i = 2, 10 do | for i = 2, 10 do | ||
− | if | + | if not has_arg('successor ' .. i) then break end |
− | if | + | if has_arg('successor ' .. i .. ' link') then |
− | list = list .. '<br>[[' .. | + | list = list .. '<br>[[' .. arg('successor ' .. i .. ' link') .. '|' .. |
− | + | arg('successor ' .. i) .. ']]' | |
else | else | ||
− | list = list .. '<br>[[' .. | + | list = list .. '<br>[[' .. arg('successor ' .. i) .. ']]' |
end | end | ||
end | end | ||
Line 361: | Line 421: | ||
:wikitext('<i class="fa fa-chevron-right"></i>') | :wikitext('<i class="fa fa-chevron-right"></i>') | ||
end | end | ||
+ | end | ||
+ | -- Contemporary | ||
+ | if has_arg('contemporary') then | ||
+ | add_header(infobox, 'Contemporary') | ||
+ | |||
+ | local s = infobox:tag('tr') | ||
+ | local td = s:tag('td'):attr('colspan', '2') | ||
+ | |||
+ | td:attr('style', 'text-align: center;') | ||
+ | |||
+ | local list | ||
+ | if has_arg('contemporary link') then | ||
+ | list = '[[' .. arg('contemporary link') .. '|' .. arg('contemporary') .. ']]' | ||
+ | else | ||
+ | list = '[[' .. arg('contemporary') .. ']]' | ||
+ | end | ||
+ | for i = 2, 10 do | ||
+ | if not has_arg('contemporary ' .. i) then break end | ||
+ | if has_arg('contemporary ' .. i .. ' link') then | ||
+ | list = list .. '<br>[[' .. arg('contemporary ' .. i .. ' link') .. '|' .. arg('contemporary ' .. i) .. ']]' | ||
+ | else | ||
+ | list = list .. '<br>[[' .. arg('contemporary ' .. i) .. ']]' | ||
+ | end | ||
+ | end | ||
+ | |||
+ | td:wikitext(list) | ||
end | end | ||
infobox:wikitext('[[Category:all microarchitectures]]') | infobox:wikitext('[[Category:all microarchitectures]]') | ||
− | infobox:wikitext('[[full page name::{{FULLPAGENAME}}| ]]') | + | infobox:wikitext('[[full page name::' .. frame:preprocess('{{FULLPAGENAME}}') .. '| ]]') |
infobox:wikitext('[[instance of::microarchitecture| ]]') | infobox:wikitext('[[instance of::microarchitecture| ]]') | ||
Latest revision as of 20:47, 15 April 2019
Documentation for this module may be created at Module:microarchitecture/doc
local uarch = {}
local origArgs
function add_header_main(box, str)
box
:tag('tr')
:tag('td')
:attr('class', 'header-main')
:attr('colspan', '2')
:wikitext(str)
end
function add_header(box, str)
box
:tag('tr')
:tag('td')
:attr('class', 'header')
:attr('colspan', '2')
:wikitext(str)
end
function add_entry(box, label, value)
local tag = box:tag('tr')
tag:tag('td')
:attr('class', 'label')
:wikitext(label)
tag:tag('td')
:attr('class', 'value')
:wikitext(value)
end
function has_arg(name)
-- The argument can exist and be empty or not exist at all
return string.len(origArgs[name] or '') > 0
end
function arg(name)
return origArgs[name]
end
function uarch.set_val(prop, val)
uarch.frame:preprocess('{{#set: ' .. prop .. '=' .. val .. '}}')
end
function uarch.uarch(frame)
uarch.frame = frame
if frame == mw.getCurrentFrame() then
origArgs = frame:getParent().args
else
origArgs = frame
end
local infobox = mw.html.create('table')
infobox
:attr('class', 'infobox')
infobox
:tag('tr')
:tag('td'):attr('colspan', '2')
:tag('small'):attr('style', 'float: right; font-weight: bold;')
:wikitext('[[Special:FormEdit/microarchitecture/' .. frame:preprocess('{{FULLPAGENAME}}') .. '|<i class="fa fa-edit"></i>Edit Values]]')
-- header
if not has_arg('name') then return tostring(infobox) .. '[[Category:Articles with invalid parameter in template]]<strong>* ERROR: "name" is missing!</strong>' end
uarch.set_val('name', arg('name'))
uarch.set_val('codename', arg('name'))
add_header_main(infobox, arg('name') .. ' µarch')
add_header(infobox, 'General Info')
if not has_arg('atype') then return tostring(infobox) .. '[[Category:Articles with invalid parameter in template]]<strong>ERROR: "atype" is missing!</strong>' end
if not has_arg('designer') then return tostring(infobox) .. '[[Category:Articles with invalid parameter in template]]<strong>ERROR: "designer" is missing!</strong>' end
-- arch type
add_entry(infobox, 'Arch Type', arg('atype') ..
'[[Category:' .. string.lower(arg('atype')) .. ' microarchitectures by ' .. string.lower(arg('designer')) .. ']]')
uarch.set_val('microarchitecture type', arg('atype'))
-- designer
local devs
uarch.set_val('designer', arg('designer'))
devs = arg('designer') .. '[[Category:microarchitectures by ' .. string.lower(arg('designer')) .. ']]'
for i = 2, 10 do
if not has_arg('designer ' .. i) then break end
uarch.set_val('designer', arg('designer ' .. i))
devs = devs .. ', ' .. arg('designer ' .. i) ..
'[[Category:microarchitectures by ' .. string.lower(arg('designer ' .. i)) .. ']]'
devs = devs ..
'[[Category:' .. string.lower(arg('atype')) .. ' microarchitectures by ' .. string.lower(arg('designer ' .. i)) .. ']]'
end
add_entry(infobox, 'Designer', devs)
-- manufacturer
if not has_arg('manufacturer') then return '[[Category:Articles with invalid parameter in template]]ERROR: "manufacturer" is missing!' end
uarch.set_val('manufacturer', arg('manufacturer'))
local devs = '[[manufacturer::' .. arg('manufacturer') .. ']]'
for i = 2, 10 do
if not has_arg('manufacturer ' .. i) then break end
uarch.set_val('manufacturer', arg('manufacturer ' .. i))
devs = devs .. ', [[manufacturer::' .. arg('manufacturer ' .. i) .. ']]'
end
add_entry(infobox, 'Manufacturer', devs)
-- intro
if has_arg('introduction') then
uarch.set_val('first launched', arg('introduction'))
add_entry(infobox, 'Introduction', arg('introduction'))
end
-- phase-out
if has_arg('phase-out') then
uarch.set_val('phase-out', arg('phase-out'))
add_entry(infobox, 'Phase-out', arg('phase-out'))
end
-- process
if has_arg('process') then
local proc
uarch.set_val('process', arg('process'))
proc = '[[' .. arg('process') .. ' process|' .. arg('process') .. ']]'
for i = 2, 10 do
if string.len(origArgs['process ' .. i] or '') == 0 then break end
uarch.set_val('process', arg('process ' .. i))
proc = proc .. ', [['.. arg('process ' .. i) .. ' process|' .. arg('process ' .. i) .. ']]'
end
add_entry(infobox, 'Process', proc)
end
-- cores
if string.len(origArgs.cores or '') > 0 then
local core
core = '[[core count::' .. origArgs.cores .. '| ]]'
.. '[[' .. origArgs.cores .. ' cores|' .. origArgs.cores .. ']]'
for i = 2, 20 do
if string.len(origArgs['cores ' .. i] or '') == 0 then break end
core = core .. ', [[core count::' ..origArgs['cores ' .. i] .. '| ]]'
.. '[[' .. origArgs['cores ' .. i] .. ' cores|' .. origArgs['cores ' .. i] .. ']]'
end
add_entry(infobox, 'Core Configs', core)
end
-- processing elements
if has_arg('processing elements') then
local pe
pe = '[[processing element count::' .. arg('processing elements') .. '| ]]'
.. arg('processing elements')
for i = 2, 20 do
if not has_arg('processing elements ' .. i) then break end
pe = pe .. ', [[processing element count::' .. arg('processing elements ' .. i) .. '| ]]'
.. arg('processing elements ' .. i)
end
add_entry(infobox, 'PE Configs', pe)
end
if has_arg('type') or has_arg('oooe') or has_arg('speculative')
or has_arg('renaming') or has_arg('stages') or has_arg('stages min')
or has_arg('decode') then
add_header(infobox, 'Pipeline')
end
-- type
if string.len(origArgs['type'] or '') > 0 then
local ptype
ptype = origArgs['type']
for i = 2, 10 do
if string.len(origArgs['type ' .. i] or '') == 0 then break end
ptype = ptype .. ', ' .. origArgs['type ' .. i]
end
add_entry(infobox, 'Type', ptype)
end
-- oooe
if string.len(origArgs.oooe or '') > 0 then
add_entry(infobox, 'OoOE', origArgs.oooe)
end
-- speculative
if string.len(origArgs.speculative or '') > 0 then
add_entry(infobox, 'Speculative', origArgs.speculative)
end
-- renaming
if string.len(origArgs.renaming or '') > 0 then
add_entry(infobox, 'Reg Renaming', origArgs.renaming)
end
-- stages
if string.len(origArgs.stages or '') > 0 then
add_entry(infobox, 'Stages', '[[pipeline stages::' .. origArgs.stages .. ']]')
end
-- stages min/max
if string.len(origArgs['stages min'] or '') > 0 then
add_entry(infobox, 'Stages',
'[[pipeline stages (min)::' .. origArgs['stages min'] .. ']]'
.. '-[[pipeline stages (max)::' .. origArgs['stages max'] .. ']]')
end
-- decode
if string.len(origArgs.decode or '') > 0 then
add_entry(infobox, 'Decode', origArgs.decode)
end
if has_arg('isa') or has_arg('features') or has_arg('extension') then
add_header(infobox, 'Instructions')
end
-- ISA
if string.len(origArgs.isa or '') > 0 then
local isa
isa = '[[instruction set architecture::' .. origArgs.isa .. ']]'
for i = 2, 10 do
if string.len(origArgs['isa ' .. i] or '') == 0 then break end
isa = isa .. ', ' .. '[[instruction set architecture::' .. origArgs['isa ' .. i] .. ']]'
end
add_entry(infobox, 'ISA', isa)
end
-- features
if string.len(origArgs.features or '') > 0 then
local features
features = origArgs.features
for i = 2, 10 do
if string.len(origArgs['features ' .. i] or '') == 0 then break end
features = features .. ', ' .. origArgs['features ' .. i]
end
add_entry(infobox, 'Features', features)
end
-- extensions
if string.len(origArgs.extension or '') > 0 then
local extension
extension = origArgs.extension
for i = 2, 40 do
if string.len(origArgs['extension ' .. i] or '') == 0 then break end
extension = extension .. ', ' .. origArgs['extension ' .. i]
end
add_entry(infobox, 'Extensions', extension)
end
if has_arg('l1') or has_arg('l1i') or has_arg('l1d') or
has_arg('l2') or has_arg('l3') or has_arg('l3') or
has_arg('side cache') then
add_header(infobox, 'Cache')
end
-- L1i
if string.len(origArgs.l1i or '') > 0 then
local li = origArgs.l1i
if string.len(origArgs['l1i per'] or '') > 0 then
li = li .. '/' .. origArgs['l1i per']
end
if string.len(origArgs['l1i desc'] or '') > 0 then
li = li .. '<br>' .. origArgs['l1i desc']
end
add_entry(infobox, 'L1I Cache', li)
end
-- L1d
if string.len(origArgs.l1d or '') > 0 then
local li = origArgs.l1d
if string.len(origArgs['l1d per'] or '') > 0 then
li = li .. '/' .. origArgs['l1d per']
end
if string.len(origArgs['l1d desc'] or '') > 0 then
li = li .. '<br>' .. origArgs['l1d desc']
end
add_entry(infobox, 'L1D Cache', li)
end
-- L1, Unified
if string.len(origArgs.l1 or '') > 0 then
local li = origArgs.l1
if string.len(origArgs['l1 per'] or '') > 0 then
li = li .. '/' .. origArgs['l1 per']
end
if string.len(origArgs['l1 desc'] or '') > 0 then
li = li .. '<br>' .. origArgs['l1 desc']
end
add_entry(infobox, 'L1 Cache', li)
end
-- L2
if string.len(origArgs.l2 or '') > 0 then
local l2 = origArgs.l2
if string.len(origArgs['l2 per'] or '') > 0 then
l2 = l2 .. '/' .. origArgs['l2 per']
end
if string.len(origArgs['l2 desc'] or '') > 0 then
l2 = l2 .. '<br>' .. origArgs['l2 desc']
end
add_entry(infobox, 'L2 Cache', l2)
end
-- L3
if string.len(origArgs.l3 or '') > 0 then
local l3 = origArgs.l3
if string.len(origArgs['l3 per'] or '') > 0 then
l3 = l3 .. '/' .. origArgs['l3 per']
end
if string.len(origArgs['l3 desc'] or '') > 0 then
l3 = l3 .. '<br>' .. origArgs['l3 desc']
end
add_entry(infobox, 'L3 Cache', l3)
end
-- L4
if string.len(origArgs.l4 or '') > 0 then
local l4 = origArgs.l4
if string.len(origArgs['l4 per'] or '') > 0 then
l4 = l4 .. '/' .. origArgs['l4 per']
end
if string.len(origArgs['l4 desc'] or '') > 0 then
l4 = l4 .. '<br>' .. origArgs['l4 desc']
end
add_entry(infobox, 'L4 Cache', l4)
end
-- Side $
if has_arg('side cache') then
local sidecache = arg('side cache')
if has_arg('side cache per') then
sidecache = sidecache .. '/' .. arg('side cache per')
end
if has_arg('side cache desc') then
sidecache = sidecache .. '<br>' .. arg('side cache desc')
end
add_entry(infobox, 'Side Cache', sidecache)
end
-- cores
if has_arg('core name') then
add_header(infobox, 'Cores')
local cores = arg('core name')
for i = 2, 10 do
if not has_arg('core name ' .. i) then break end
cores = cores .. ',<br>' .. arg('core name ' .. i)
end
add_entry(infobox, 'Core Names', cores)
end
if has_arg('successor') or has_arg('predecessor') then
add_header(infobox, 'Succession')
local s = infobox:tag('tr')
local td = s:tag('td'):attr('colspan', '2')
local d1 = td:tag('div'):attr('style', 'display: inline-flex;')
local d2 = td:tag('div'):attr('style', 'display: inline-flex; float: right;')
if has_arg('predecessor') then
local list
if has_arg('predecessor link') then
list = '[[' .. arg('predecessor link') .. '|' .. arg('predecessor') .. ']]'
else
list = '[[' .. arg('predecessor') .. ']]'
end
for i = 2, 10 do
if not has_arg('predecessor ' .. i) then break end
if has_arg('predecessor ' .. i .. ' link') then
list = list .. '<br>[[' .. arg('predecessor ' .. i .. ' link') .. '|' .. arg('predecessor ' .. i) .. ']]'
else
list = list .. '<br>[[' .. arg('predecessor ' .. i) .. ']]'
end
end
d1:tag('div')
:attr('style', 'float: left; padding-right: 10px; margin: auto 5px;')
:wikitext('<i class="fa fa-chevron-left"></i>')
d1:tag('div')
:attr('style', 'float: left;')
:wikitext(list)
end
if has_arg('successor') then
local list
if has_arg('successor link') then
list = '[[' .. arg('successor link') .. '|' .. arg('successor') .. ']]'
else
list = '[[' .. arg('successor') .. ']]'
end
for i = 2, 10 do
if not has_arg('successor ' .. i) then break end
if has_arg('successor ' .. i .. ' link') then
list = list .. '<br>[[' .. arg('successor ' .. i .. ' link') .. '|' ..
arg('successor ' .. i) .. ']]'
else
list = list .. '<br>[[' .. arg('successor ' .. i) .. ']]'
end
end
d2:tag('div')
:attr('style', 'float: left;')
:wikitext(list)
d2:tag('div')
:attr('style', 'float: right; padding-left: 10px; margin: auto 5px;')
:wikitext('<i class="fa fa-chevron-right"></i>')
end
end
-- Contemporary
if has_arg('contemporary') then
add_header(infobox, 'Contemporary')
local s = infobox:tag('tr')
local td = s:tag('td'):attr('colspan', '2')
td:attr('style', 'text-align: center;')
local list
if has_arg('contemporary link') then
list = '[[' .. arg('contemporary link') .. '|' .. arg('contemporary') .. ']]'
else
list = '[[' .. arg('contemporary') .. ']]'
end
for i = 2, 10 do
if not has_arg('contemporary ' .. i) then break end
if has_arg('contemporary ' .. i .. ' link') then
list = list .. '<br>[[' .. arg('contemporary ' .. i .. ' link') .. '|' .. arg('contemporary ' .. i) .. ']]'
else
list = list .. '<br>[[' .. arg('contemporary ' .. i) .. ']]'
end
end
td:wikitext(list)
end
infobox:wikitext('[[Category:all microarchitectures]]')
infobox:wikitext('[[full page name::' .. frame:preprocess('{{FULLPAGENAME}}') .. '| ]]')
infobox:wikitext('[[instance of::microarchitecture| ]]')
return infobox
end
return uarch