From WikiChip
Difference between revisions of "Module:microarchitecture"

(added PE configs)
 
(32 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
    local origArgs
 
 
     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 string.len(origArgs.name or '') == 0 then return 'ERROR: "name" is missing!' end
+
     if not has_arg('name') then return tostring(infobox) .. '[[Category:Articles with invalid parameter in template]]<strong>* ERROR: "name" is missing!</strong>' end
add_header_main(infobox, '[[codename::' .. origArgs.name .. '| ]][[name::' .. origArgs.name .. ']] µarch')
+
   
 +
    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
    if string.len(origArgs.atype or '') == 0 then return 'ERROR: "atype" is missing!' end
+
add_entry(infobox, 'Arch Type', arg('atype') ..
add_entry(infobox, 'Arch Type', origArgs.atype ..
+
'[[Category:' .. string.lower(arg('atype')) .. ' microarchitectures by ' .. string.lower(arg('designer')) .. ']]')
'[[microarchitecture type::' .. origArgs.atype .. '| ]]' ..
+
    uarch.set_val('microarchitecture type',  arg('atype'))
'[[Category:' .. string.lower(origArgs.atype) .. ' microarchitectures by ' .. string.lower(origArgs.designer) .. ']]')
 
  
 
-- designer
 
-- designer
    if string.len(origArgs.designer or '') == 0 then return 'ERROR: "designer" is missing!' end
 
 
     local devs
 
     local devs
 
      
 
      
     devs = '[[designer::' .. string.lower(origArgs.designer) .. '| ]]' .. origArgs.designer
+
     uarch.set_val('designer',  arg('designer'))
     devs = devs .. '[[Category:microarchitectures by ' .. string.lower(origArgs.designer) .. ']]'
+
     devs = arg('designer') .. '[[Category:microarchitectures by ' .. string.lower(arg('designer')) .. ']]'
 
      
 
      
 
     for i = 2, 10 do
 
     for i = 2, 10 do
     if string.len(origArgs['designer ' .. i] or '') == 0 then break end
+
     if not has_arg('designer ' .. i) then break end
     devs = devs .. ', [[designer::' .. string.lower(origArgs['designer ' .. i]) .. '| ]]' ..
+
    uarch.set_val('designer',  arg('designer ' .. i))
    origArgs['designer ' .. i] ..
+
     devs = devs .. ', ' .. arg('designer ' .. i) ..
    '[[Category:microarchitectures by ' .. string.lower(origArgs['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 string.len(origArgs.manufacturer or '') == 0 then return 'ERROR: "manufacturer" is missing!' end
+
     if not has_arg('manufacturer') then return '[[Category:Articles with invalid parameter in template]]ERROR: "manufacturer" is missing!' end
     local devs
+
uarch.set_val('manufacturer',  arg('manufacturer'))
   
+
     local devs = '[[manufacturer::' .. arg('manufacturer') .. ']]'
    devs = '[[manufacturer::' .. string.lower(origArgs.manufacturer) .. '| ]]'
 
    .. origArgs.manufacturer
 
   
 
 
     for i = 2, 10 do
 
     for i = 2, 10 do
     if string.len(origArgs['manufacturer ' .. i] or '') == 0 then break end
+
     if not has_arg('manufacturer ' .. i) then break end
     devs = devs .. ', [[manufacturer::' .. string.lower(origArgs['manufacturer ' .. i]) .. '| ]]'
+
    uarch.set_val('manufacturer',  arg('manufacturer ' .. i))
    .. origArgs['manufacturer ' .. i]
+
     devs = devs .. ', [[manufacturer::' .. arg('manufacturer ' .. i) .. ']]'
 
end
 
end
 
add_entry(infobox, 'Manufacturer', devs)
 
add_entry(infobox, 'Manufacturer', devs)
 
 
 
     -- intro
 
     -- intro
     if string.len(origArgs.introduction or '') > 0 then
+
     if has_arg('introduction') then
add_entry(infobox, 'Introduction', '[[first launched::' .. origArgs.introduction .. ']]')
+
    uarch.set_val('first launched',  arg('introduction'))
 +
add_entry(infobox, 'Introduction', arg('introduction'))
 
end
 
end
 
 
 
     -- phase-out
 
     -- phase-out
     if string.len(origArgs['phase-out'] or '') > 0 then
+
     if has_arg('phase-out') then
add_entry(infobox, 'Phase-out', '[[phase-out::' .. origArgs['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 string.len(origArgs.process or '') > 0 then
+
     if has_arg('process') then
 
    local proc
 
    local proc
 
     
 
     
    proc = '[[process::' .. origArgs.process .. '| ]]' ..
+
    uarch.set_val('process',  arg('process'))
    '[[' ..  origArgs.process .. ' process|' ..  origArgs.process .. ']]'
+
    proc = '[[' ..  arg('process') .. ' process|' ..  arg('process') .. ']]'
 
     
 
     
 
    for i = 2, 10 do
 
    for i = 2, 10 do
 
    if string.len(origArgs['process ' .. i] or '') == 0 then break end
 
    if string.len(origArgs['process ' .. i] or '') == 0 then break end
    proc = proc .. ', [[process::' ..origArgs['process ' .. i] .. '| ]]'
+
    uarch.set_val('process',  arg('process ' .. i))
    .. '[['..  origArgs['process ' .. i] .. ' process|' .. origArgs['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, 10 do
+
    for i = 2, 20 do
 
    if string.len(origArgs['cores ' .. i] or '') == 0 then break end
 
    if string.len(origArgs['cores ' .. i] or '') == 0 then break end
 
    core = core .. ', [[core count::' ..origArgs['cores ' .. i] .. '| ]]'
 
    core = core .. ', [[core count::' ..origArgs['cores ' .. i] .. '| ]]'
Line 129: Line 153:
 
end
 
end
 
 
if string.len(origArgs.pipeline or '') > 0 then
+
 +
-- 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')
 
add_header(infobox, 'Pipeline')
 
end
 
end
Line 178: Line 220:
 
 
 
 
     if string.len(origArgs.isa or '') > 0 then
+
     if has_arg('isa') or has_arg('features') or has_arg('extension') then
 
add_header(infobox, 'Instructions')
 
add_header(infobox, 'Instructions')
 
end
 
end
Line 218: Line 260:
 
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
Line 242: Line 291:
 
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 280: Line 341:
 
end
 
end
 
 
     -- Size $
+
     -- Side $
     if string.len(origArgs.sizecache or '') > 0 then
+
     if has_arg('side cache') then
     local sizecache = origArgs.sizecache
+
     local sidecache = arg('side cache')
     if string.len(origArgs['sizecache per'] or '') > 0 then
+
     if has_arg('side cache per') then
     sizecache = sizecache .. '/' .. origArgs['sizecache per']
+
     sidecache = sidecache .. '/' .. arg('side cache per')
 
end
 
end
     if string.len(origArgs['sizecache desc'] or '') > 0 then
+
     if has_arg('side cache desc') then
     sizecache = sizecache .. '<br>' .. origArgs['sizecache desc']
+
     sidecache = sidecache .. '<br>' .. arg('side cache desc')
 
end
 
end
add_entry(infobox, 'Size Cache',  sizecache)
+
add_entry(infobox, 'Side Cache',  sidecache)
 
end
 
end
 
 
add_header(infobox, 'Cores')
 
 
 
 
 
 
-- cores
 
-- cores
     if string.len(origArgs['core name'] or '') > 0 then
+
     if has_arg('core name') then
    local cores
+
add_header(infobox, 'Cores')
   
+
    cores = origArgs['core name']
+
    local cores = arg('core name')
 
    for i = 2, 10 do
 
    for i = 2, 10 do
    if string.len(origArgs['core name ' .. i] or '') == 0 then break end
+
    if not has_arg('core name ' .. i) then break end
    cores = cores .. ', ' .. origArgs['core name ' .. i]
+
    cores = cores .. ',<br>' .. arg('core name ' .. i)
 
end
 
end
 
add_entry(infobox, 'Core Names', cores)
 
add_entry(infobox, 'Core Names', cores)
 
end
 
end
 
 
if string.len(origArgs.successor or '') > 0
+
if has_arg('successor') or has_arg('predecessor') then
or string.len(origArgs.predecessor or '') > 0 then
 
 
add_header(infobox, 'Succession')
 
add_header(infobox, 'Succession')
 
 
 
local s = infobox:tag('tr')
 
local s = infobox:tag('tr')
local d1 = s:tag('td'):tag('div'):attr('style', 'display: inline-flex;')
+
local td = s:tag('td'):attr('colspan', '2')
local d2 = s:tag('td'):tag('div'):attr('style', 'display: inline-flex; float: right;')
+
local d1 = td:tag('div'):attr('style', 'display: inline-flex;')
if string.len(origArgs.predecessor or '') > 0 then
+
local d2 = td:tag('div'):attr('style', 'display: inline-flex; float: right;')
 +
if has_arg('predecessor') then
 
 
 
    local list
 
    local list
    if string.len(origArgs.predecessor_link or '') > 0 then
+
    if has_arg('predecessor link') then
list = '[[' .. origArgs.predecessor_link .. '|' .. origArgs.predecessor .. ']]'
+
list = '[[' .. arg('predecessor link') .. '|' .. arg('predecessor') .. ']]'
 
else
 
else
list = '[[' .. origArgs.predecessor .. ']]'
+
list = '[[' .. arg('predecessor') .. ']]'
 
end
 
end
 
    for i = 2, 10 do
 
    for i = 2, 10 do
    if string.len(origArgs['predecessor ' .. i] or '') == 0 then break end
+
    if not has_arg('predecessor ' .. i) then break end
    if string.len(origArgs['predecessor link ' .. i] or '') > 0 then
+
    if has_arg('predecessor ' .. i .. ' link') then
    list = list .. '<br>[[' .. origArgs['predecessor link ' .. i] .. '|' ..
+
    list = list .. '<br>[[' .. arg('predecessor ' .. i .. ' link') .. '|' .. arg('predecessor ' .. i) .. ']]'
    origArgs['predecessor ' .. i] .. ']]'
 
 
    else
 
    else
    list = list .. '<br>[[' .. origArgs['predecessor ' .. i] .. ']]'
+
    list = list .. '<br>[[' .. arg('predecessor ' .. i) .. ']]'
 
     end
 
     end
 
end
 
end
Line 340: Line 397:
 
:wikitext(list)
 
:wikitext(list)
 
end
 
end
if string.len(origArgs.successor or '') > 0 then
+
if has_arg('successor') then
 
local list
 
local list
    if string.len(origArgs.successor_link or '') > 0 then
+
    if has_arg('successor link') then
list = '[[' .. origArgs.successor_link .. '|' .. origArgs.successor .. ']]'
+
list = '[[' .. arg('successor link') .. '|' .. arg('successor') .. ']]'
 
else
 
else
list = '[[' .. origArgs.successor .. ']]'
+
list = '[[' .. arg('successor') .. ']]'
 
end
 
end
 
    for i = 2, 10 do
 
    for i = 2, 10 do
    if string.len(origArgs['successor ' .. i] or '') == 0 then break end
+
    if not has_arg('successor ' .. i) then break end
    if string.len(origArgs['successor link ' .. i] or '') > 0 then
+
    if has_arg('successor ' .. i .. ' link') then
    list = list .. '<br>[[' .. origArgs['successor link ' .. i] .. '|' ..
+
    list = list .. '<br>[[' .. arg('successor ' .. i .. ' link') .. '|' ..
    origArgs['successor ' .. i] .. ']]'
+
    arg('successor ' .. i) .. ']]'
 
    else
 
    else
    list = list .. '<br>[[' .. origArgs['successor ' .. i] .. ']]'
+
    list = list .. '<br>[[' .. arg('successor ' .. i) .. ']]'
 
     end
 
     end
 
end
 
end
Line 364: 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