From WikiChip
Difference between revisions of "Module:chip"

Line 348: Line 348:
 
-- ISA
 
-- ISA
 
     if has_arg('isa') or has_arg('isa family') then
 
     if has_arg('isa') or has_arg('isa family') then
      local isa = mw.html.create('td'):wikitext('[[isa::' .. arg('isa') .. ']]')
+
  p.set_val('isa', arg('isa'))
      for i = 2, 10 do
+
      local isa = mw.html.create('td'):wikitext(arg('isa'))
      if not has_arg('isa ' .. i) then break end
+
      for i = 2, 10 do
      isa:wikitext(', [[isa::' .. arg('isa ' .. i) .. ']]')
+
      if not has_arg('isa ' .. i) then break end
      end
+
      p.set_val('isa', arg('isa ' .. i))
      if has_arg('isa family') then
+
      isa:wikitext(', ' .. arg('isa ' .. i))
        isa:wikitext(' ([[isa family::' .. arg('isa family') .. ']])')
+
      end
    end
+
if has_arg('isa family') then
 +
p.set_val('isa family', arg('isa family'))
 +
isa:wikitext(' (' .. arg('isa family') .. ')')
 +
end
 
     infobox:node(p.add_entry('ISA', isa))
 
     infobox:node(p.add_entry('ISA', isa))
 
end
 
end
Line 362: Line 365:
 
     if has_arg('microarch') then
 
     if has_arg('microarch') then
 
       local microarchs = mw.html.create('td')
 
       local microarchs = mw.html.create('td')
       microarchs:wikitext('[[microarchitecture::' .. arg('microarch') .. '| ]]')
+
       p.set_val('microarchitecture', arg('microarch'))
 
       microarchs:wikitext('[[' .. mw.ustring.lower(arg('designer')) .. '/microarchitectures/' ..
 
       microarchs:wikitext('[[' .. mw.ustring.lower(arg('designer')) .. '/microarchitectures/' ..
 
       mw.ustring.lower(arg('microarch')) .. '|' .. arg('microarch') .. ']]')
 
       mw.ustring.lower(arg('microarch')) .. '|' .. arg('microarch') .. ']]')
 
       for i = 2, 10 do
 
       for i = 2, 10 do
 
       if not has_arg('microarch ' .. i) then break end
 
       if not has_arg('microarch ' .. i) then break end
       microarchs:wikitext(', [[microarchitecture::' .. arg('microarch ' .. i) .. '| ]]')
+
       p.set_val('microarchitecture', arg('microarch ' .. i))
 
         microarchs:wikitext('[[' .. mw.ustring.lower(arg('designer')) .. '/microarchitectures/' ..
 
         microarchs:wikitext('[[' .. mw.ustring.lower(arg('designer')) .. '/microarchitectures/' ..
 
       mw.ustring.lower(arg('microarch ' .. i)) .. '|' .. arg('microarch ' .. i) .. ']]')
 
       mw.ustring.lower(arg('microarch ' .. i)) .. '|' .. arg('microarch ' .. i) .. ']]')
Line 376: Line 379:
 
-- platform
 
-- platform
 
if has_arg('platform') then
 
if has_arg('platform') then
  infobox:node(p.add_entry('Platform', mw.html.create('td'):wikitext('[[platform::' .. arg('platform') .. ']]')))
+
p.set_val('platform', arg('platform'))
 +
infobox:node(p.add_entry('Platform', mw.html.create('td'):wikitext(arg('platform'))))
 
end
 
end
 
 
 
-- chipset
 
-- chipset
 
     if has_arg('chipset') then
 
     if has_arg('chipset') then
      local chipset = mw.html.create('td'):wikitext('[[chipset::' .. arg('chipset') .. ']]')
+
p.set_val('chipset', arg('chipset'))
      for i = 2, 10 do
+
local chipset = mw.html.create('td'):wikitext(arg('chipset'))
      if not has_arg('chipset ' .. i) then break end
+
for i = 2, 10 do
      chipset:wikitext(', [[chipset::' .. arg('chipset ' .. i) .. ']]')
+
if not has_arg('chipset ' .. i) then break end
      end
+
p.set_val('chipset', arg('chipset ' .. i))
    infobox:node(p.add_entry('Chipset', chipset))
+
chipset:wikitext(', ' .. arg('chipset ' .. i))
 +
      end
 +
infobox:node(p.add_entry('Chipset', chipset))
 
end
 
end
 
 
 
-- core name
 
-- core name
 
     if has_arg('core name') then
 
     if has_arg('core name') then
      local core_name = mw.html.create('td'):wikitext('[[core name::' .. arg('core name') .. '| ]]' ..
+
p.set_val('core name', arg('core name'))
 +
      local core_name = mw.html.create('td'):wikitext(arg('core name') ..
 
       '[[' .. mw.ustring.lower(arg('designer')) .. '/cores/' .. mw.ustring.lower(arg('core name')) .. '|' ..
 
       '[[' .. mw.ustring.lower(arg('designer')) .. '/cores/' .. mw.ustring.lower(arg('core name')) .. '|' ..
 
       arg('core name') .. ']]')
 
       arg('core name') .. ']]')
 
       for i = 2, 10 do
 
       for i = 2, 10 do
 
       if not has_arg('core name ' .. i) then break end
 
       if not has_arg('core name ' .. i) then break end
       core_name:wikitext(', [[core name::' .. arg('core name ' .. i) .. '| ]]' ..
+
      p.set_val('core name', arg('core name ' .. i))
 +
       core_name:wikitext(', ' .. arg('core name ' .. i) ..
 
       '[[' .. mw.ustring.lower(arg('designer')) .. '/cores/' .. mw.ustring.lower(arg('core name ' .. i)) .. '|' ..
 
       '[[' .. mw.ustring.lower(arg('designer')) .. '/cores/' .. mw.ustring.lower(arg('core name ' .. i)) .. '|' ..
 
       arg('core name ' .. i) .. ']]')
 
       arg('core name ' .. i) .. ']]')
Line 405: Line 413:
 
-- core family
 
-- core family
 
     if has_arg('core family') then
 
     if has_arg('core family') then
      local corefam = mw.html.create('td'):wikitext('[[core family::' .. arg('core family') .. ']]')
+
    p.set_val('core family', arg('core family'))
 +
      local corefam = mw.html.create('td'):wikitext(arg('core family'))
 
       for i = 2, 10 do
 
       for i = 2, 10 do
 
       if not has_arg('core family ' .. i) then break end
 
       if not has_arg('core family ' .. i) then break end
       corefam:wikitext(', [[core family::' .. arg('core family ' .. i) .. ']]')
+
      p.set_val('core family', arg('core family ' .. i))
 +
       corefam:wikitext(', ' .. arg('core family ' .. i))
 
       end
 
       end
 
     infobox:node(p.add_entry('Core Family', corefam))
 
     infobox:node(p.add_entry('Core Family', corefam))
Line 415: Line 425:
 
-- core model
 
-- core model
 
     if has_arg('core model') then
 
     if has_arg('core model') then
      local coremodel = mw.html.create('td'):wikitext('[[core model::' .. arg('core model') .. ']]')
+
    p.set_val('core model', arg('core model'))
      for i = 2, 10 do
+
local coremodel = mw.html.create('td'):wikitext(arg('core model'))
      if not has_arg('core model ' .. i) then break end
+
for i = 2, 10 do
      coremodel:wikitext(', [[core model::' .. arg('core model ' .. i) .. ']]')
+
if not has_arg('core model ' .. i) then break end
      end
+
    p.set_val('core model', arg('core model ' .. i))
    infobox:node(p.add_entry('Core Model', coremodel))
+
coremodel:wikitext(', ' .. arg('core model ' .. i))
 +
end
 +
infobox:node(p.add_entry('Core Model', coremodel))
 
end
 
end
 
 
 
-- core stepping
 
-- core stepping
 
     if has_arg('core stepping') then
 
     if has_arg('core stepping') then
      local corestep = mw.html.create('td'):wikitext('[[core stepping::' .. arg('core stepping') .. ']]')
+
    p.set_val('core stepping', arg('core stepping'))
      for i = 2, 10 do
+
local corestep = mw.html.create('td'):wikitext(arg('core stepping'))
      if not has_arg('core stepping ' .. i) then break end
+
for i = 2, 10 do
      corestep:wikitext(', [[core stepping::' .. arg('core stepping ' .. i) .. ']]')
+
if not has_arg('core stepping ' .. i) then break end
      end
+
    p.set_val('core stepping', arg('core stepping ' .. i))
    infobox:node(p.add_entry('Core Stepping', corestep))
+
corestep:wikitext(', ' .. arg('core stepping ' .. i))
 +
end
 +
infobox:node(p.add_entry('Core Stepping', corestep))
 
end
 
end
 
 
 
-- process
 
-- process
 
     if has_arg('process') then
 
     if has_arg('process') then
      local process = mw.html.create('td'):wikitext('[[process::' .. arg('process') .. ']]')
+
p.set_val('process', arg('process'))
      for i = 2, 10 do
+
      local process = mw.html.create('td'):wikitext(arg('process'))
      if not has_arg('process ' .. i) then break end
+
      for i = 2, 10 do
      process:wikitext(', [[process::' .. arg('process ' .. i) .. ']]')
+
      if not has_arg('process ' .. i) then break end
      end
+
p.set_val('process', arg('process ' .. i))
    infobox:node(p.add_entry('Process', process))
+
      process:wikitext(', ' .. arg('process ' .. i))
 +
      end
 +
    infobox:node(p.add_entry('Process', process))
 
end
 
end
 
 
 
-- Transistors
 
-- Transistors
 
if has_arg('transistors') then
 
if has_arg('transistors') then
  infobox:node(p.add_entry('Transistors', mw.html.create('td'):wikitext('[[transistor count::' .. arg('transistors') .. ']]')))
+
p.set_val('transistor count', arg('transistors'))
 +
  infobox:node(p.add_entry('Transistors', mw.html.create('td'):wikitext(arg('transistors'))))
 
end
 
end
 
 
 
-- Technology
 
-- Technology
 
if has_arg('technology') then
 
if has_arg('technology') then
  infobox:node(p.add_entry('Technology', mw.html.create('td'):wikitext('[[technology::' .. arg('technology') .. ']]')))
+
p.set_val('technology', arg('technology'))
 +
  infobox:node(p.add_entry('Technology', mw.html.create('td'):wikitext(arg('technology'))))
 
end
 
end
 
 
Line 457: Line 475:
 
local die
 
local die
 
if has_arg('die size') then
 
if has_arg('die size') then
       die = mw.html.create('td'):wikitext('[[die area::' .. arg('die size') .. ']]')
+
p.set_val('die area', arg('die size'))
 +
       die = mw.html.create('td'):wikitext(arg('die size'))
 
else
 
else
die = mw.html.create('td'):wikitext('[[die area::' .. arg('die area') .. ']]')
+
p.set_val('die area', arg('die area'))
 +
die = mw.html.create('td'):wikitext(arg('die area'))
 
end
 
end
 
if has_arg('die length') and has_arg('die width') then
 
if has_arg('die length') and has_arg('die width') then
die:wikitext('<br>' .. '[[die length::' .. arg('die length') .. '| ]]' ..
+
p.set_val('die length', arg('die length'))
arg('die length') .. ' × [[die width::' .. arg('die width') .. '| ]]' ..
+
p.set_val('die width', arg('die width'))
arg('die width'))
+
die:wikitext('<br>' .. arg('die length') .. ' × ' .. arg('die width'))
 
end
 
end
 
  infobox:node(p.add_entry('Die', die))
 
  infobox:node(p.add_entry('Die', die))
Line 470: Line 490:
 
 
 
if has_arg('mcp') then
 
if has_arg('mcp') then
   mcp = mw.html.create('td'):wikitext('[[is multi-chip package::' .. arg('mcp') .. ']]')
+
p.set_val('is multi-chip package', arg('mcp'))
 +
   mcp = mw.html.create('td'):wikitext(arg('mcp'))
 
if has_arg('die count') then
 
if has_arg('die count') then
       mcp:wikitext(' ([[die count::' .. arg('die count') .. ']] dies)')
+
p.set_val('die count', arg('die count'))
 +
       mcp:wikitext(' (' .. arg('die count') .. ' dies)')
 
end
 
end
 
  infobox:node(p.add_entry('MCP', mcp))
 
  infobox:node(p.add_entry('MCP', mcp))
Line 479: Line 501:
 
-- word size
 
-- word size
 
if has_arg('word size') then
 
if has_arg('word size') then
  infobox:node(p.add_entry('Word Size', mw.html.create('td'):wikitext('[[word size::' .. arg('word size') .. '| ]]' .. arg('word size'))))
+
p.set_val('word size', arg('word size'))
 +
infobox:node(p.add_entry('Word Size', mw.html.create('td'):wikitext(arg('word size'))))
 
end
 
end
 
 
 
-- core count
 
-- core count
 
if has_arg('core count') then
 
if has_arg('core count') then
  infobox:node(p.add_entry('Cores', mw.html.create('td'):wikitext('[[core count::' .. arg('core count') .. ']]')))
+
p.set_val('core count', arg('core count'))
 +
  infobox:node(p.add_entry('Cores', mw.html.create('td'):wikitext(arg('core count'))))
 
end
 
end
 
 
 
-- thread count
 
-- thread count
 
if has_arg('thread count') then
 
if has_arg('thread count') then
  infobox:node(p.add_entry('Threads', mw.html.create('td'):wikitext('[[thread count::' .. arg('thread count') .. ']]')))
+
p.set_val('thread count', arg('thread count'))
 +
  infobox:node(p.add_entry('Threads', mw.html.create('td'):wikitext(arg('thread count'))))
 
end
 
end
 
 
 
-- max cpus
 
-- max cpus
 
if has_arg('max cpus') then
 
if has_arg('max cpus') then
local type = tonumber(arg('max cpus')) == 1 and '(Uniprocessor)' or '(Multiprocessor)'
+
local type = tonumber(arg('max cpus')) == 1 and ' (Uniprocessor)' or ' (Multiprocessor)'
infobox:node(p.add_entry('Max CPUs', mw.html.create('td'):wikitext('[[max cpu count::' .. arg('max cpus') .. ']] ' .. type)))
+
p.set_val('max cpu count', arg('max cpus'))
 +
infobox:node(p.add_entry('Max CPUs', mw.html.create('td'):wikitext(arg('max cpus') .. type)))
 
end
 
end
 
 
 
-- max memory
 
-- max memory
 
if has_arg('max memory') then
 
if has_arg('max memory') then
  infobox:node(p.add_entry('Max Memory', mw.html.create('td'):wikitext('[[max memory::' .. arg('max memory') .. '| ]]' .. arg('max memory'))))
+
p.set_val('max memory', arg('max memory'))
 +
infobox:node(p.add_entry('Max Memory', mw.html.create('td'):wikitext(arg('max memory'))))
 
end
 
end
 
 
 
-- max memory addr
 
-- max memory addr
 
if has_arg('max memory addr') then
 
if has_arg('max memory addr') then
  infobox:node(p.add_entry('Max Address Mem', mw.html.create('td'):wikitext('[[max memory address::' .. arg('max memory addr') .. ']]')))
+
p.set_val('max memory address', arg('max memory addr'))
 +
  infobox:node(p.add_entry('Max Address Mem', mw.html.create('td'):wikitext(arg('max memory addr'))))
 
end
 
end
  
Line 521: Line 549:
 
-- power
 
-- power
 
if has_arg('power') then
 
if has_arg('power') then
  infobox:node(p.add_entry('Power dissipation', mw.html.create('td'):wikitext('[[power dissipation::' .. arg('power') .. '| ]]' .. arg('power'))))
+
p.set_val('power dissipation', arg('power'))
 +
  infobox:node(p.add_entry('Power dissipation', mw.html.create('td'):wikitext(arg('power'))))
 
end
 
end
 
 
 
-- average power
 
-- average power
 
if has_arg('average power') then
 
if has_arg('average power') then
  infobox:node(p.add_entry('power dissipation (average)', mw.html.create('td'):wikitext('[[power dissipation (average)::' .. arg('average power') .. ']]')))
+
p.set_val('power dissipation (average)', arg('average power'))
 +
  infobox:node(p.add_entry('power dissipation (average)', mw.html.create('td'):wikitext(arg('average power'))))
 
end
 
end
 
 
 
-- power
 
-- power
 
if has_arg('idle power') then
 
if has_arg('idle power') then
  infobox:node(p.add_entry('Power dissipation (idle)', mw.html.create('td'):wikitext('[[power dissipation (idle)::' .. arg('idle power') .. ']]')))
+
p.set_val('power dissipation (idle)', arg('idle power'))
 +
  infobox:node(p.add_entry('Power dissipation (idle)', mw.html.create('td'):wikitext(arg('idle power'))))
 
end
 
end
 
 
 
-- vcore
 
-- vcore
 
if has_arg('v core') then
 
if has_arg('v core') then
local vcore =  mw.html.create('td'):wikitext('[[core voltage::' .. arg('v core') .. ']]')
+
p.set_val('core voltage', arg('v core'))
 +
local vcore =  mw.html.create('td'):wikitext(arg('v core'))
 
if has_arg('v core tolerance') then
 
if has_arg('v core tolerance') then
vcore:wikitext(' ± [[core voltage tolerance::' .. arg('v core tolerance') .. ']]')
+
p.set_val('core voltage tolerance', arg('v core tolerance'))
 +
vcore:wikitext(' ± ' .. arg('v core tolerance'))
 
end
 
end
 
infobox:node(p.add_entry('V<sub>core</sub>', vcore))
 
infobox:node(p.add_entry('V<sub>core</sub>', vcore))
 
end
 
end
 
if has_arg('v core min') then
 
if has_arg('v core min') then
infobox:node(p.add_entry('V<sub>core</sub>', mw.html.create('td'):wikitext('[[core voltage (min)::' .. arg('v core min') .. ']]-' ..
+
p.set_val('core voltage (min)', arg('v core min'))
'[[core voltage (max)::' .. arg('v core max') .. ']]')))
+
p.set_val('core voltage (max)', arg('v core max'))
 +
infobox:node(p.add_entry('V<sub>core</sub>', mw.html.create('td'):wikitext(arg('v core min') .. '-' .. arg('v core max'))))
 
end
 
end
  
 
-- io
 
-- io
 
if has_arg('v io') then
 
if has_arg('v io') then
local vcore =  mw.html.create('td'):wikitext('[[io voltage::' .. arg('v io') .. ']]')
+
p.set_val('io voltage', arg('v io'))
 +
local vcore =  mw.html.create('td'):wikitext(arg('v io'))
 
if has_arg('v io tolerance') then
 
if has_arg('v io tolerance') then
vcore:wikitext(' ± [[io voltage tolerance::' .. arg('v io tolerance') .. ']]')
+
p.set_val('io voltage tolerance', arg('v io tolerance'))
 +
vcore:wikitext(' ± ' .. arg('v io tolerance'))
 
end
 
end
 
for i = 2, 10 do
 
for i = 2, 10 do
 
  if not has_arg('v io ' .. i) then break end
 
  if not has_arg('v io ' .. i) then break end
  vcore:wikitext(', [[io voltage::' .. arg('v io ' .. i) .. ']]')
+
p.set_val('io voltage', arg('v io ' .. i))
 +
  vcore:wikitext(', ' .. arg('v io ' .. i))
 
end
 
end
 
infobox:node(p.add_entry('V<sub>I/O</sub>', vcore))
 
infobox:node(p.add_entry('V<sub>I/O</sub>', vcore))
Line 562: Line 599:
 
-- sdp
 
-- sdp
 
if has_arg('sdp') then
 
if has_arg('sdp') then
  infobox:node(p.add_entry('<abbr title="Scenario Design Power">SDP</abbr>', mw.html.create('td'):wikitext('[[sdp::' .. arg('sdp') .. ']]')))
+
p.set_val('sdp', arg('sdp'))
 +
  infobox:node(p.add_entry('<abbr title="Scenario Design Power">SDP</abbr>', mw.html.create('td'):wikitext(arg('sdp'))))
 
end
 
end
 
 
 
-- tdp
 
-- tdp
 
if has_arg('tdp') then
 
if has_arg('tdp') then
local tdp =  mw.html.create('td'):wikitext('[[tdp::' .. arg('tdp') .. '| ]]' .. arg('tdp'))
+
p.set_val('tdp', arg('tdp'))
 +
local tdp =  mw.html.create('td'):wikitext(arg('tdp'))
 
for i = 2, 10 do
 
for i = 2, 10 do
 
  if not has_arg('tdp ' .. i) then break end
 
  if not has_arg('tdp ' .. i) then break end
  tdp:wikitext(', [[tdp::' .. arg('tdp ' .. i) .. '| ]]' .. arg('tdp ' .. i))
+
p.set_val('tdp', arg('tdp ' .. i))
 +
  tdp:wikitext(', ' .. arg('tdp ' .. i))
 
end
 
end
 
  infobox:node(p.add_entry('<abbr title="Thermal Design Power">TDP</abbr>', tdp))
 
  infobox:node(p.add_entry('<abbr title="Thermal Design Power">TDP</abbr>', tdp))
Line 577: Line 617:
 
-- tdp typical
 
-- tdp typical
 
if has_arg('tdp typical') then
 
if has_arg('tdp typical') then
  infobox:node(p.add_entry('<abbr title="Thermal Design Power">TDP</abbr> (Typical)', mw.html.create('td'):wikitext('[[tdp (typical)::' .. arg('tdp typical') .. ']]')))
+
p.set_val('tdp (typical)', arg('tdp typical'))
 +
infobox:node(p.add_entry('<abbr title="Thermal Design Power">TDP</abbr> (Typical)', mw.html.create('td'):wikitext(arg('tdp typical'))))
 
end
 
end
 
 
 
-- ctdp down
 
-- ctdp down
 
if has_arg('ctdp down') then
 
if has_arg('ctdp down') then
  infobox:node(p.add_entry('cTDP down', mw.html.create('td'):wikitext('[[tdp down::' .. arg('ctdp down') .. ']]')))
+
p.set_val('tdp down', arg('ctdp down'))
 +
  infobox:node(p.add_entry('cTDP down', mw.html.create('td'):wikitext(arg('ctdp down'))))
 
end
 
end
 
 
 
-- ctdp down
 
-- ctdp down
 
if has_arg('ctdp down frequency') then
 
if has_arg('ctdp down frequency') then
  infobox:node(p.add_entry('cTDP down frequency', mw.html.create('td'):wikitext('[[tdp down frequency::' .. arg('ctdp down frequency') .. ']]')))
+
p.set_val('tdp down frequency', arg('ctdp down frequency'))
 +
infobox:node(p.add_entry('cTDP down frequency', mw.html.create('td'):wikitext(arg('ctdp down frequency'))))
 
end
 
end
 
 
 
-- ctdp up
 
-- ctdp up
 
if has_arg('ctdp up') then
 
if has_arg('ctdp up') then
  infobox:node(p.add_entry('cTDP up', mw.html.create('td'):wikitext('[[tdp up::' .. arg('ctdp up') .. ']]')))
+
p.set_val('tdp up', arg('ctdp up'))
 +
  infobox:node(p.add_entry('cTDP up', mw.html.create('td'):wikitext(arg('ctdp up'))))
 
end
 
end
 
 
 
-- ctdp up
 
-- ctdp up
 
if has_arg('ctdp up frequency') then
 
if has_arg('ctdp up frequency') then
  infobox:node(p.add_entry('cTDP up frequency', mw.html.create('td'):wikitext('[[tdp up frequency::' .. arg('ctdp up frequency') .. ']]')))
+
p.set_val('tdp up frequency', arg('ctdp up frequency'))
 +
  infobox:node(p.add_entry('cTDP up frequency', mw.html.create('td'):wikitext(arg('ctdp up frequency'))))
 
end
 
end
 
 
 
-- temp min
 
-- temp min
 
if has_arg('temp min') then
 
if has_arg('temp min') then
  infobox:node(p.add_entry('OP Temperature', mw.html.create('td'):wikitext('[[min operating temperature::' .. arg('temp min') .. ']]&nbsp;–&nbsp;' ..
+
p.set_val('min operating temperature', arg('temp min'))
  '[[max operating temperature::' .. arg('temp max') .. ']]')))
+
p.set_val('max operating temperature', arg('temp max'))
 +
  infobox:node(p.add_entry('OP Temperature', mw.html.create('td'):wikitext(arg('temp min') .. '&nbsp;–&nbsp;' .. arg('temp max'))))
 
end
 
end
 
 
 
-- tjunc min
 
-- tjunc min
 
if has_arg('tjunc min') then
 
if has_arg('tjunc min') then
  infobox:node(p.add_entry('T<sub>junction</sub>', mw.html.create('td'):wikitext('[[min junction temperature::' .. arg('tjunc min') .. ']]&nbsp;–&nbsp;' ..
+
p.set_val('min junction temperature', arg('tjunc min'))
  '[[max junction temperature::' .. arg('tjunc max') .. ']]')))
+
p.set_val('max junction temperature', arg('tjunc max'))
 +
  infobox:node(p.add_entry('T<sub>junction</sub>', mw.html.create('td'):wikitext(arg('tjunc min') .. '&nbsp;–&nbsp;' .. arg('tjunc max'))))
 
end
 
end
 
 
 
-- tcase min
 
-- tcase min
 
if has_arg('tcase min') then
 
if has_arg('tcase min') then
  infobox:node(p.add_entry('T<sub>case</sub>', mw.html.create('td'):wikitext('[[min case temperature::' .. arg('tcase min') .. ']]&nbsp;–&nbsp;' ..
+
p.set_val('min case temperature', arg('tcase min'))
  '[[max case temperature::' .. arg('tcase max') .. ']]')))
+
p.set_val('max case temperature', arg('tcase max'))
 +
  infobox:node(p.add_entry('T<sub>case</sub>', mw.html.create('td'):wikitext(arg('tcase min') .. '&nbsp;–&nbsp;' .. arg('tcase max'))))
 
end
 
end
 
 
 
-- tstorage min
 
-- tstorage min
 
if has_arg('tstorage min') then
 
if has_arg('tstorage min') then
  infobox:node(p.add_entry('T<sub>storage</sub>', mw.html.create('td'):wikitext('[[min storage temperature::' .. arg('tstorage min') .. ']]&nbsp;–&nbsp;' ..
+
p.set_val('min storage temperature')
  '[[max storage temperature::' .. arg('tstorage max') .. ']]')))
+
p.set_val('max storage temperature')
 +
  infobox:node(p.add_entry('T<sub>storage</sub>', mw.html.create('td'):wikitext(arg('tstorage min') .. '&nbsp;–&nbsp;' .. arg('tstorage max'))))
 
end
 
end
 
 
 
-- tambient min
 
-- tambient min
 
if has_arg('tambient min') then
 
if has_arg('tambient min') then
  infobox:node(p.add_entry('T<sub>ambient</sub>', mw.html.create('td'):wikitext('[[min ambient temperature::' .. arg('tambient min') .. ']]&nbsp;–&nbsp;' ..
+
p.set_val('min ambient temperature', arg('tambient min'))
  '[[max ambient temperature::' .. arg('tambient max') .. ']]')))
+
p.set_val('max ambient temperature', arg('tambient max'))
 +
infobox:node(p.add_entry('T<sub>ambient</sub>', mw.html.create('td'):wikitext(arg('tambient min') .. '&nbsp;–&nbsp;' .. arg('tambient max'))))
 
end
 
end
 
 
Line 650: Line 700:
 
end
 
end
 
 
infobox:wikitext('[[instance of::microprocessor| ]]')
+
p.set_val('instance of', 'microprocessor')
 +
p.set_val('full page name', frame:preprocess('{{FULLPAGENAME}}'))
 
     infobox:wikitext('[[Category:all microprocessor models]]')
 
     infobox:wikitext('[[Category:all microprocessor models]]')
    infobox:wikitext('[[full page name::' .. frame:preprocess('{{FULLPAGENAME}}') .. '| ]]')
 
 
      
 
      
 
     if has_arg('future') and
 
     if has_arg('future') and
 
     (string.lower(arg('future')) == 'yes' or string.lower(arg('future')) == 'true') then
 
     (string.lower(arg('future')) == 'yes' or string.lower(arg('future')) == 'true') then
     infobox:wikitext('[[Category:future microprocessor models]][[ldate::3000| ]]')
+
p.set_val('ldate', '3000')
 +
     infobox:wikitext('[[Category:future microprocessor models]]')
 
elseif has_arg('first launched') then
 
elseif has_arg('first launched') then
    infobox:wikitext('[[ldate::' .. arg('first launched') .. '| ]]')
+
p.set_val('ldate', arg('first launched'))
 
elseif has_arg('first announced') then
 
elseif has_arg('first announced') then
    infobox:wikitext('[[ldate::' .. arg('first announced') .. '| ]]')
+
p.set_val('ldate', arg('first announced'))
 
else --alright launched but no date?
 
else --alright launched but no date?
    infobox:wikitext('[[ldate::1000| ]]')
+
p.set_val('ldate', '1000')
 
     end
 
     end
 
 

Revision as of 01:16, 20 July 2017

To add this template, simple add
{{chip}}
to the page and save. The chip infobox will have a small [Edit Values] button at the top-right corner which can be used to add values using a form.
local p = {}
local origArgs

function p.add_file_prefix(str)
  if string.match(string.lower(str), '^file:') then
    return str
  else
    return 'File:' .. str
  end
end

function p.add_separator(box, title)
  box:tag('tr')
           :tag('td')
           :attr('class', 'header')
           :attr('colspan', '2')
           :wikitext(title)
end

function p.add_entry(value, right)
  local e = mw.html.create('tr')
  e:tag('td')
    :attr('class', 'label')
    :wikitext(value)
  e:node(right)
  return e   
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 p.set_val(prop, val)
	p.frame:preprocess('{{#set: ' .. prop .. '=' .. val .. '}}')	
end

function p.chip(frame)
	
	p.frame = frame
    if frame == mw.getCurrentFrame() then
        origArgs = frame:getParent().args
    else
        origArgs = frame.args
    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;')
            :wikitext('[[Special:FormEdit/mpu/' .. frame:preprocess('{{FULLPAGENAME}}') .. '|<i class="fa fa-edit"></i>Edit Values]]')

    -- header
    if has_arg('name') then
		infobox
			:tag('tr')
			:tag('td')
			:attr('class', 'header-main')
			:attr('colspan', '2')
			:wikitext(arg('name'))
		p.set_val('name', arg('name'))
    end

    -- image
	if has_arg('image') then
		local image = p.add_file_prefix(arg('image'))
		local image_size = has_arg('image size') and arg('image size') or "200px" 
		infobox
		:tag('tr')
		  :tag('td')
		    :attr('style', 'text-align: center;')
		    :attr('colspan', '2')
		    :wikitext('[[' .. image .. '|' .. image_size .. ']]')
		
		p.set_val('main image', image)

      -- add a caption, if provided
      if has_arg('caption') then
		infobox
			:tag('tr')
			:tag('td')
			:attr('style', 'text-align: center;')
			:attr('colspan', '2')
			:wikitext(arg('caption'))
		p.set_val('main image caption', arg('caption'))
      end
	elseif not has_arg('no image') then
      infobox
        :tag('tr')
          :tag('td')
            :attr('style', 'text-align: center;')
            :attr('colspan', '2')
            :wikitext('[[File:no photo (ic).svg|link=|200px]]')
    end

    -- ####################################################################
    -- some general info first
    p.add_separator(infobox, 'General Info')
    
    -- designer
    if has_arg('designer') then
      	local designers = mw.html.create('td'):attr('style', 'width: 99%;')
      	p.set_val('designer', arg('designer'))
      	designers:wikitext('[[' .. arg('designer') .. ']]' ..
      				'[[category:microprocessor models by ' .. mw.ustring.lower(arg('designer')) .. ']]')
		if has_arg('microarch') then
			designers:wikitext('[[category:microprocessor models by ' .. mw.ustring.lower(arg('designer')) ..
					' based on ' .. mw.ustring.lower(arg('microarch')) .. ']]')
		end
      
      for i = 2, 10 do
      	if not has_arg('designer ' .. i) then break end
      		p.set_val('designer',arg('designer ' .. i))
      		designers:wikitext(', [[' .. arg('designer ' .. i) .. ']]' ..
      				'[[category:microprocessor models by ' .. mw.ustring.lower(arg('designer ' .. i)) .. ']]')
  		if has_arg('microarch') then
			designers:wikitext('[[category:microprocessor models by ' .. mw.ustring.lower(arg('designer ' .. i)) ..
  					' based on ' .. mw.ustring.lower(arg('microarch')) .. ']]')
  		end
      end
   	  infobox:node(p.add_entry('Designer', designers))
	end
    
    -- manufacturer
    if has_arg('manufacturer') then
      local manufacturers = '[[' .. arg('manufacturer') .. ']]' ..
      		'[[category:microprocessor models by ' .. mw.ustring.lower(arg('manufacturer')) .. ']]'
  		p.set_val('manufacturer', arg('manufacturer'))
      		
      for i = 2, 10 do
      	if not has_arg('manufacturer ' .. i) then break end
      	manufacturers = manufacturers .. ', [[' .. arg('manufacturer ' .. i) .. ']]' ..
      		'[[category:microprocessor models by ' .. mw.ustring.lower(arg('manufacturer ' .. i)) .. ']]'
  		p.set_val('manufacturer', arg('manufacturer ' .. i))
      end
      
   	  infobox:node(p.add_entry('Manufacturer', mw.html.create('td'):wikitext(manufacturers)))
	end
	
	-- model number
	if has_arg('model number') then
		p.set_val('model number', arg('model number'))
	  	infobox:node(p.add_entry('Model Number', mw.html.create('td'):attr('style', 'width: 99%;'):wikitext(arg('model number'))))
	end
    
    -- part number
    if has_arg('part number') then
		p.set_val('part number', arg('part number'))
		local parts = arg('part number')
		for i = 2, 10 do
			if not has_arg('part number ' .. i) then break end
			p.set_val('part number', arg('part number ' .. i))
			parts = parts .. ', ' .. arg('part number ' .. i)
		end
		infobox:node(p.add_entry('Part Number', mw.html.create('td'):wikitext(parts)))
	end
    
    -- s-spec
    if has_arg('s-spec') or has_arg('s-spec qs') then
      local sspec = ''
      if has_arg('s-spec') then
      	p.set_val('s-spec', arg('s-spec'))
        sspec = arg('s-spec')
        for i = 2, 30 do
        	if not has_arg('s-spec ' .. i) then break end
      		p.set_val('s-spec', arg('s-spec ' .. i))
        	sspec = sspec .. ', ' .. arg('s-spec ' .. i)
        end
      end
      if has_arg('s-spec qs') then
      	if has_arg('s-spec') then sspec = sspec .. '<br>' end
      	p.set_val('s-spec (qs)', arg('s-spec qs'))
        sspec = sspec .. arg('s-spec qs') .. ' ([[qualification sample|QS]])'
        for i = 2, 30 do
        	if not has_arg('s-spec qs ' .. i) then break end
      		p.set_val('s-spec (qs)', arg('s-spec qs ' .. i))
        	sspec = sspec .. ', ' .. arg('s-spec qs ' .. i) .. ' ([[qualification sample|QS]])'
        end
      end
   	  infobox:node(p.add_entry('S-Spec', mw.html.create('td'):wikitext(sspec)))
	end
	
	-- market segment
    if has_arg('market') then
		p.set_val('market segment', arg('market'))
      	local markets = mw.html.create('td'):wikitext(arg('market'))
      	for i = 2, 5 do
  			if not has_arg('market ' .. i) then break end
			p.set_val('market segment', arg('market ' .. i))
      		markets:wikitext(', ' .. arg('market ' .. i))
      	end
   	  	infobox:node(p.add_entry('Market', markets))
	end
	
	-- release date
	if has_arg('first launched') or has_arg('first announced') then
	  local release = mw.html.create('td')
	  if has_arg('first announced') then
	  	p.set_val('first announced', arg('first announced'))
	    release:wikitext(arg('first announced') .. ' (announced)')
	  end
	  if has_arg('first launched') then
	  	if has_arg('first announced') then
	  	  release:wikitext('<br>')	
  		end
  		p.set_val('first launched', arg('first launched'))
	    release:wikitext(arg('first launched') .. ' (launched)')
	  end
	  infobox:node(p.add_entry('Introduction', release))
	end
	
	-- EOL
	if has_arg('last order') or has_arg('last shipment') then
	  local release = mw.html.create('td')
	  if has_arg('last order') then
	  	p.set_val('last order', arg('last order'))
	    release:wikitext(arg('last order') .. ' (last order)')
	  end
	  if has_arg('last shipment') then
	  	if has_arg('last order') then
	  	  release:wikitext('<br>')	
  		end
  		p.set_val('last shipment', arg('last shipment'))
	    release:wikitext(arg('last shipment') .. ' (last shipment)')
	  end
	  infobox:node(p.add_entry('End-of-life', release))
	end
	
	-- release price
	if has_arg('release price') then
		infobox:node(p.add_entry('Release Price', mw.html.create('td'):wikitext(arg('release price'))))
		p.set_val('release price', arg('release price'))
	end
	
	
	

    -- ####################################################################
    -- some general specs
    p.add_separator(infobox, 'General Specs')
	
	-- family
	if has_arg('family') then
		p.set_val('microprocessor family', arg('family'))
		infobox:node(p.add_entry('Family', mw.html.create('td'):wikitext(
	  				'[[' .. mw.ustring.lower(arg('designer') .. '/' .. arg('family')) .. '|' .. arg('family') .. ']]')))
	end
	
	-- series
	if has_arg('series') then
		p.set_val('microprocessor series', arg('series'))
	  	infobox:node(p.add_entry('Series', mw.html.create('td'):wikitext(arg('series'))))
	end
	
	-- locked?
	if has_arg('locked') then
		p.set_val('has locked clock multiplier', arg('locked'))
		infobox:node(p.add_entry('Locked', mw.html.create('td'):wikitext(arg('locked'))))
	end
    
    -- frequency
    if has_arg('frequency') then
		p.set_val('base frequency', arg('frequency'))
		local frequencies = mw.html.create('td'):wikitext( arg('frequency'))
		for i = 2, 10 do
			if not has_arg('frequency ' .. i) then break end
			p.set_val('base frequency', arg('frequency ' .. i))
			frequencies:wikitext(', ' .. arg('frequency ' .. i))
		end
		infobox:node(p.add_entry('Frequency', frequencies))
	end
    
    -- turbo frequency
    local hasTurbo = false
    for i = 1, 42 do
    	if has_arg('turbo frequency' .. i) then hasTurbo = true break end
	end
    if hasTurbo then
      local turbo = mw.html.create('td')
      for i = 1, 42 do
      	--sometimes turbo is not specified for odd-cores, so skip 2 each time, so we can't break
        --if not has_arg('turbo frequency' .. i) then break end
        if has_arg('turbo frequency' .. i) then
        	local s = i > 1 and 's' or ''
        	local br = i > 1 and ',<br>' or ''
        	p.set_val('turbo frequency (' .. i .. ' core' .. s .. ')', arg('turbo frequency' .. i))
			turbo:wikitext(br .. arg('turbo frequency' .. i) .. ' (' .. i .. ' core' .. s .. ')')
      	end
      end
   	  infobox:node(p.add_entry('Turbo Frequency', turbo))
	end
	
	-- bus type
	if has_arg('bus type') then
		p.set_val('bus type', arg('bus type'))
		infobox:node(p.add_entry('Bus type', mw.html.create('td'):wikitext(arg('bus type'))))
	end
	
	-- bus speed
	if has_arg('bus speed') then
		p.set_val('bus speed', arg('bus speed'))
		infobox:node(p.add_entry('Bus speed', mw.html.create('td'):wikitext(arg('bus speed'))))
	end
	
	-- bus rate
	if has_arg('bus rate') then
		local links = ''
		if has_arg('bus links') then
			p.set_val('bus links', arg('bus links'))
			links = arg('bus links') .. '&nbsp;×&nbsp;'
		end
		p.set_val('bus rate', arg('bus rate'))
		infobox:node(p.add_entry('Bus rate', mw.html.create('td'):wikitext(links .. arg('bus rate'))))
	end
	
	-- clock mult
	if has_arg('clock multiplier') then
		p.set_val('clock multiplier', arg('clock multiplier'))
		infobox:node(p.add_entry('Clock multiplier', mw.html.create('td'):wikitext(arg('clock multiplier'))))
	end
	
	-- CPUID
    if has_arg('cpuid') then
		p.set_val('cpuid', arg('cpuid'))
		local cpuid = mw.html.create('td'):wikitext(arg('cpuid'))
		for i = 2, 10 do
			if not has_arg('cpuid ' .. i) then break end
			p.set_val('cpuid', arg('cpuid ' .. i))
			cpuid:wikitext(', ' .. arg('cpuid ' .. i))
		end
   	  infobox:node(p.add_entry('CPUID', cpuid))
	end

    -- ####################################################################
    -- some general info first
    p.add_separator(infobox, 'Microarchitecture')
	
	-- ISA
    if has_arg('isa') or has_arg('isa family') then
  		p.set_val('isa', arg('isa'))
      	local isa = mw.html.create('td'):wikitext(arg('isa'))
      	for i = 2, 10 do
      		if not has_arg('isa ' .. i) then break end
      		p.set_val('isa', arg('isa ' .. i))
      		isa:wikitext(', ' .. arg('isa ' .. i))
      	end
		if has_arg('isa family') then
			p.set_val('isa family', arg('isa family'))
			isa:wikitext('&nbsp;(' .. arg('isa family') .. ')')
		end
   	  infobox:node(p.add_entry('ISA', isa))
	end
	
	-- microarch
    if has_arg('microarch') then
      local microarchs = mw.html.create('td')
      p.set_val('microarchitecture', arg('microarch'))
      microarchs:wikitext('[[' .. mw.ustring.lower(arg('designer')) .. '/microarchitectures/' ..
      		mw.ustring.lower(arg('microarch')) .. '|' .. arg('microarch') .. ']]')
      for i = 2, 10 do
      	if not has_arg('microarch ' .. i) then break end
      	p.set_val('microarchitecture', arg('microarch ' .. i))
        microarchs:wikitext('[[' .. mw.ustring.lower(arg('designer')) .. '/microarchitectures/' ..
      		mw.ustring.lower(arg('microarch ' .. i)) .. '|' .. arg('microarch ' .. i) .. ']]')
      end
   	  infobox:node(p.add_entry('Microarchitecture', microarchs))
	end
	
	-- platform
	if has_arg('platform') then
		p.set_val('platform', arg('platform'))
		infobox:node(p.add_entry('Platform', mw.html.create('td'):wikitext(arg('platform'))))
	end
	
	-- chipset
    if has_arg('chipset') then
		p.set_val('chipset', arg('chipset'))
		local chipset = mw.html.create('td'):wikitext(arg('chipset'))
		for i = 2, 10 do
			if not has_arg('chipset ' .. i) then break end
			p.set_val('chipset', arg('chipset ' .. i))
			chipset:wikitext(', ' .. arg('chipset ' .. i))
      	end
		infobox:node(p.add_entry('Chipset', chipset))
	end
	
	-- core name
    if has_arg('core name') then
		p.set_val('core name', arg('core name'))
      	local core_name = mw.html.create('td'):wikitext(arg('core name') ..
      				'[[' .. mw.ustring.lower(arg('designer')) .. '/cores/' .. mw.ustring.lower(arg('core name')) .. '|' ..
      				arg('core name') .. ']]')
      for i = 2, 10 do
      	if not has_arg('core name ' .. i) then break end
      	p.set_val('core name', arg('core name ' .. i))
      	core_name:wikitext(', ' .. arg('core name ' .. i) ..
      				'[[' .. mw.ustring.lower(arg('designer')) .. '/cores/' .. mw.ustring.lower(arg('core name ' .. i)) .. '|' ..
      				arg('core name ' .. i) .. ']]')
      end
   	  infobox:node(p.add_entry('Core Name', core_name))
	end
	
	-- core family
    if has_arg('core family') then
    	p.set_val('core family', arg('core family'))
      	local corefam = mw.html.create('td'):wikitext(arg('core family'))
      for i = 2, 10 do
      	if not has_arg('core family ' .. i) then break end
      	p.set_val('core family', arg('core family ' .. i))
      	corefam:wikitext(', ' .. arg('core family ' .. i))
      end
   	  infobox:node(p.add_entry('Core Family', corefam))
	end
	
	-- core model
    if has_arg('core model') then
    	p.set_val('core model', arg('core model'))
		local coremodel = mw.html.create('td'):wikitext(arg('core model'))
		for i = 2, 10 do
			if not has_arg('core model ' .. i) then break end
    		p.set_val('core model', arg('core model ' .. i))
			coremodel:wikitext(', ' .. arg('core model ' .. i))
		end
		 infobox:node(p.add_entry('Core Model', coremodel))
	end
	
	-- core stepping
    if has_arg('core stepping') then
    	p.set_val('core stepping', arg('core stepping'))
		local corestep = mw.html.create('td'):wikitext(arg('core stepping'))
		for i = 2, 10 do
			if not has_arg('core stepping ' .. i) then break end
    		p.set_val('core stepping', arg('core stepping ' .. i))
			corestep:wikitext(', ' .. arg('core stepping ' .. i))
		end
		infobox:node(p.add_entry('Core Stepping', corestep))
	end
	
	-- process
    if has_arg('process') then
		p.set_val('process', arg('process'))
      	local process = mw.html.create('td'):wikitext(arg('process'))
      	for i = 2, 10 do
      		if not has_arg('process ' .. i) then break end
			p.set_val('process', arg('process ' .. i))
      		process:wikitext(', ' .. arg('process ' .. i))
      	end
   	  	infobox:node(p.add_entry('Process', process))
	end
	
	-- Transistors
	if has_arg('transistors') then
		p.set_val('transistor count', arg('transistors'))
	  	infobox:node(p.add_entry('Transistors', mw.html.create('td'):wikitext(arg('transistors'))))
	end
	
	-- Technology
	if has_arg('technology') then
		p.set_val('technology', arg('technology'))
	  	infobox:node(p.add_entry('Technology', mw.html.create('td'):wikitext(arg('technology'))))
	end
	
	-- die size
	if has_arg('die area') or has_arg('die size') then
		local die
		if has_arg('die size') then
			p.set_val('die area', arg('die size'))
      		die = mw.html.create('td'):wikitext(arg('die size'))
		else
			p.set_val('die area', arg('die area'))
			die = mw.html.create('td'):wikitext(arg('die area'))
		end
		if has_arg('die length') and has_arg('die width') then
			p.set_val('die length', arg('die length'))
			p.set_val('die width', arg('die width'))
			die:wikitext('<br>' .. arg('die length') .. ' × ' .. arg('die width'))	
		end
	  	infobox:node(p.add_entry('Die', die))
	end
	
	if has_arg('mcp') then
		p.set_val('is multi-chip package', arg('mcp'))
  		mcp = mw.html.create('td'):wikitext(arg('mcp'))
		if has_arg('die count') then
			p.set_val('die count', arg('die count'))
      		mcp:wikitext(' (' .. arg('die count') .. ' dies)')
		end
	  	infobox:node(p.add_entry('MCP', mcp))
	end
	
	-- word size
	if has_arg('word size') then
		p.set_val('word size', arg('word size'))
		infobox:node(p.add_entry('Word Size', mw.html.create('td'):wikitext(arg('word size'))))
	end
	
	-- core count
	if has_arg('core count') then
		p.set_val('core count', arg('core count'))
	  infobox:node(p.add_entry('Cores', mw.html.create('td'):wikitext(arg('core count'))))
	end
	
	-- thread count
	if has_arg('thread count') then
		p.set_val('thread count', arg('thread count'))
	  infobox:node(p.add_entry('Threads', mw.html.create('td'):wikitext(arg('thread count'))))
	end
	
	-- max cpus
	if has_arg('max cpus') then
		local type = tonumber(arg('max cpus')) == 1 and ' (Uniprocessor)' or ' (Multiprocessor)'
		p.set_val('max cpu count', arg('max cpus'))
		infobox:node(p.add_entry('Max CPUs', mw.html.create('td'):wikitext(arg('max cpus') .. type)))
	end
	
	-- max memory
	if has_arg('max memory') then
		p.set_val('max memory', arg('max memory'))
		infobox:node(p.add_entry('Max Memory', mw.html.create('td'):wikitext(arg('max memory'))))
	end
	
	-- max memory addr
	if has_arg('max memory addr') then
		p.set_val('max memory address', arg('max memory addr'))
	  infobox:node(p.add_entry('Max Address Mem', mw.html.create('td'):wikitext(arg('max memory addr'))))
	end

    -- ####################################################################
    -- Electrical
    if has_arg('power') or has_arg('average power') or has_arg('idle power')
    	or has_arg('v core') or has_arg('v io') or has_arg('sdp') or has_arg('tdp')
    	or has_arg('tdp typical') or has_arg('ctdp down') or has_arg('ctdp down frequency')
		or has_arg('ctdp up') or has_arg('ctdp up frequency')
		or has_arg('temp min') or has_arg('tjunc min')
		or has_arg('tcase min') or has_arg('tstorage min') or has_arg('tambient min') then
		p.add_separator(infobox, 'Electrical')
    end
	
	-- power
	if has_arg('power') then
		p.set_val('power dissipation', arg('power'))
	  infobox:node(p.add_entry('Power dissipation', mw.html.create('td'):wikitext(arg('power'))))
	end
	
	-- average power
	if has_arg('average power') then
		p.set_val('power dissipation (average)', arg('average power'))
	  infobox:node(p.add_entry('power dissipation (average)', mw.html.create('td'):wikitext(arg('average power'))))
	end
	
	-- power
	if has_arg('idle power') then
		p.set_val('power dissipation (idle)', arg('idle power'))
	  infobox:node(p.add_entry('Power dissipation (idle)', mw.html.create('td'):wikitext(arg('idle power'))))
	end
	
	-- vcore
	if has_arg('v core') then
		p.set_val('core voltage', arg('v core'))
		local vcore =  mw.html.create('td'):wikitext(arg('v core'))
		if has_arg('v core tolerance') then
			p.set_val('core voltage tolerance', arg('v core tolerance'))
			vcore:wikitext(' ± ' .. arg('v core tolerance'))	
		end
		infobox:node(p.add_entry('V<sub>core</sub>', vcore))
	end
	if has_arg('v core min') then
		p.set_val('core voltage (min)', arg('v core min'))
		p.set_val('core voltage (max)', arg('v core max'))
		infobox:node(p.add_entry('V<sub>core</sub>', mw.html.create('td'):wikitext(arg('v core min') .. '-' .. arg('v core max'))))
	end

	-- io
	if has_arg('v io') then
		p.set_val('io voltage', arg('v io'))
		local vcore =  mw.html.create('td'):wikitext(arg('v io'))
		if has_arg('v io tolerance') then
			p.set_val('io voltage tolerance', arg('v io tolerance'))
			vcore:wikitext(' ± ' .. arg('v io tolerance'))
		end
		for i = 2, 10 do
	  		if not has_arg('v io ' .. i) then break end
			p.set_val('io voltage', arg('v io ' .. i))
	  		vcore:wikitext(', ' .. arg('v io ' .. i))
		end
		infobox:node(p.add_entry('V<sub>I/O</sub>', vcore))
	end
	
	-- sdp
	if has_arg('sdp') then
		p.set_val('sdp', arg('sdp'))
	  infobox:node(p.add_entry('<abbr title="Scenario Design Power">SDP</abbr>', mw.html.create('td'):wikitext(arg('sdp'))))
	end
	
	-- tdp
	if has_arg('tdp') then
		p.set_val('tdp', arg('tdp'))
		local tdp =  mw.html.create('td'):wikitext(arg('tdp'))
		for i = 2, 10 do
	  		if not has_arg('tdp ' .. i) then break end
			p.set_val('tdp', arg('tdp ' .. i))
	  		tdp:wikitext(', ' .. arg('tdp ' .. i))
		end
	  	infobox:node(p.add_entry('<abbr title="Thermal Design Power">TDP</abbr>', tdp))
	end
	
	-- tdp typical
	if has_arg('tdp typical') then
		p.set_val('tdp (typical)', arg('tdp typical'))
		infobox:node(p.add_entry('<abbr title="Thermal Design Power">TDP</abbr> (Typical)', mw.html.create('td'):wikitext(arg('tdp typical'))))
	end
	
	-- ctdp down
	if has_arg('ctdp down') then
		p.set_val('tdp down', arg('ctdp down'))
	  	infobox:node(p.add_entry('cTDP down', mw.html.create('td'):wikitext(arg('ctdp down'))))
	end
	
	-- ctdp down
	if has_arg('ctdp down frequency') then
		p.set_val('tdp down frequency', arg('ctdp down frequency'))
		infobox:node(p.add_entry('cTDP down frequency', mw.html.create('td'):wikitext(arg('ctdp down frequency'))))
	end
	
	-- ctdp up
	if has_arg('ctdp up') then
		p.set_val('tdp up', arg('ctdp up'))
	  	infobox:node(p.add_entry('cTDP up', mw.html.create('td'):wikitext(arg('ctdp up'))))
	end
	
	-- ctdp up
	if has_arg('ctdp up frequency') then
		p.set_val('tdp up frequency', arg('ctdp up frequency'))
	  	infobox:node(p.add_entry('cTDP up frequency', mw.html.create('td'):wikitext(arg('ctdp up frequency'))))
	end
	
	-- temp min
	if has_arg('temp min') then
		p.set_val('min operating temperature', arg('temp min'))
		p.set_val('max operating temperature', arg('temp max'))
	  	infobox:node(p.add_entry('OP Temperature', mw.html.create('td'):wikitext(arg('temp min') .. '&nbsp;–&nbsp;' .. arg('temp max'))))
	end
	
	-- tjunc min
	if has_arg('tjunc min') then
		p.set_val('min junction temperature', arg('tjunc min'))
		p.set_val('max junction temperature', arg('tjunc max'))
	  	infobox:node(p.add_entry('T<sub>junction</sub>', mw.html.create('td'):wikitext(arg('tjunc min') .. '&nbsp;–&nbsp;' .. arg('tjunc max'))))
	end
	
	-- tcase min
	if has_arg('tcase min') then
		p.set_val('min case temperature', arg('tcase min'))
		p.set_val('max case temperature', arg('tcase max'))
	  	infobox:node(p.add_entry('T<sub>case</sub>', mw.html.create('td'):wikitext(arg('tcase min') .. '&nbsp;–&nbsp;' .. arg('tcase max'))))
	end
	
	-- tstorage min
	if has_arg('tstorage min') then
		p.set_val('min storage temperature')
		p.set_val('max storage temperature')
	  	infobox:node(p.add_entry('T<sub>storage</sub>', mw.html.create('td'):wikitext(arg('tstorage min') .. '&nbsp;–&nbsp;' .. arg('tstorage max'))))
	end
	
	-- tambient min
	if has_arg('tambient min') then
		p.set_val('min ambient temperature', arg('tambient min'))
		p.set_val('max ambient temperature', arg('tambient max'))
		infobox:node(p.add_entry('T<sub>ambient</sub>', mw.html.create('td'):wikitext(arg('tambient min') .. '&nbsp;–&nbsp;' .. arg('tambient max'))))
	end
	
	

    -- ####################################################################
    -- Packaging
    if has_arg('package module 1') then
	    p.add_separator(infobox, 'Packaging')
		for i = 1, 10 do
		    if has_arg('package module ' .. i) then
				infobox
					:tag('tr'):tag('td'):attr('colspan', '2'):attr('style', 'padding: 5px;')
					:wikitext(frame:preprocess(arg('package module ' .. i)))
			end
		end
	end


	if has_arg('packaging') or has_arg('package 0') then
		infobox:wikitext('[[Category:Articles with invalid parameter in template]]')	
	end
	
	p.set_val('instance of', 'microprocessor')
	p.set_val('full page name', frame:preprocess('{{FULLPAGENAME}}'))
    infobox:wikitext('[[Category:all microprocessor models]]')
    
    if has_arg('future') and
    	(string.lower(arg('future')) == 'yes' or string.lower(arg('future')) == 'true') then
		p.set_val('ldate', '3000')
    	infobox:wikitext('[[Category:future microprocessor models]]')
	elseif has_arg('first launched') then
		p.set_val('ldate', arg('first launched'))
	elseif has_arg('first announced') then
		p.set_val('ldate', arg('first announced'))
	else --alright launched but no date?
		p.set_val('ldate', '1000')
    end
	
    return infobox
end

return p