From WikiChip
Module:process nodes

Doc:

{{#invoke:process nodes
 | compare
 | fab 1 name link   = 
 | fab 1 name        = 
 | fab 1 proc name   = 
 | fab 1 date        = 
 | fab 1 wafer.type  = 
 | fab 1 wafer.size  = 
 | fab 1 xtor.tech   = 
 | fab 1 xtor.type   = 
 | fab 1 xtor.volt   = 
 | fab 1 layers      = 
 | fab 1 diff from   = 
 | fab 1 xtor.lg     = 
 | fab 1 xtor.lgΔ    = 
 | fab 1 xtor.cpp    = 
 | fab 1 xtor.cppΔ   = 
 | fab 1 xtor.mmp    = 
 | fab 1 xtor.mmpΔ   = 
 | fab 1 sram.hp     = 
 | fab 1 sram.hpΔ    = 
 | fab 1 sram.hd     = 
 | fab 1 sram.hdΔ    = 
 | fab 1 sram.lv     = 
 | fab 1 sram.lvΔ    = 
 | fab 1 dram.edram  = 
 | fab 1 dram.edramΔ = 

 | fab 2 name link   = 
 | fab 2 name        = 
 | fab 2 proc name   = 
 | fab 2 date        = 
 | fab 2 wafer.type  = 
 | fab 2 wafer.size  = 
 | fab 2 xtor.tech   = 
 | fab 2 xtor.type   = 
 | fab 2 xtor.volt   = 
 | fab 2 layers      = 
 | fab 2 diff from   = 
 | fab 2 xtor.lg     = 
 | fab 2 xtor.lgΔ    = 
 | fab 2 xtor.cpp    = 
 | fab 2 xtor.cppΔ   = 
 | fab 2 xtor.mmp    = 
 | fab 2 xtor.mmpΔ   = 
 | fab 2 sram.hp     = 
 | fab 2 sram.hpΔ    = 
 | fab 2 sram.hd     = 
 | fab 2 sram.hdΔ    = 
 | fab 2 sram.lv     = 
 | fab 2 sram.lvΔ    = 
 | fab 2 dram.edram  = 
 | fab 2 dram.edramΔ  = 

 | fab 3 name link   = 
 | fab 3 name        = 
 | fab 3 proc name   = 
 | fab 3 date        = 
 | fab 3 wafer.type  = 
 | fab 3 wafer.size  = 
 | fab 3 xtor.tech   = 
 | fab 3 xtor.type   = 
 | fab 3 xtor.volt   = 
 | fab 3 layers      = 
 | fab 3 diff from   = 
 | fab 3 xtor.lg     = 
 | fab 3 xtor.lgΔ    = 
 | fab 3 xtor.cpp    = 
 | fab 3 xtor.cppΔ   = 
 | fab 3 xtor.mmp    = 
 | fab 3 xtor.mmpΔ   = 
 | fab 3 sram.hp     = 
 | fab 3 sram.hpΔ    = 
 | fab 3 sram.hd     = 
 | fab 3 sram.hdΔ    = 
 | fab 3 sram.lv     = 
 | fab 3 sram.lvΔ    = 
 | fab 3 dram.edram  = 
 | fab 3 dram.edramΔ  = 

 | fab 4 name link   = 
 | fab 4 name        = 
 | fab 4 proc name   = 
 | fab 4 date        = 
 | fab 4 wafer.type  = 
 | fab 4 wafer.size  = 
 | fab 4 xtor.tech   = 
 | fab 4 xtor.type   = 
 | fab 4 xtor.volt   = 
 | fab 4 layers      = 
 | fab 4 diff from   = 
 | fab 4 xtor.lg     = 
 | fab 4 xtor.lgΔ    = 
 | fab 4 xtor.cpp    = 
 | fab 4 xtor.cppΔ   = 
 | fab 4 xtor.mmp    = 
 | fab 4 xtor.mmpΔ   = 
 | fab 4 sram.hp     = 
 | fab 4 sram.hpΔ    = 
 | fab 4 sram.hd     = 
 | fab 4 sram.hdΔ    = 
 | fab 4 sram.lv     = 
 | fab 4 sram.lvΔ    = 
 | fab 4 dram.edram  = 
 | fab 4 dram.edramΔ  = 

 | fab 5 name link   = 
 | fab 5 name        = 
 | fab 5 proc name   = 
 | fab 5 date        = 
 | fab 5 wafer.type  = 
 | fab 5 wafer.size  = 
 | fab 5 xtor.tech   = 
 | fab 5 xtor.type   = 
 | fab 5 xtor.volt   = 
 | fab 5 layers      = 
 | fab 5 diff from   = 
 | fab 5 xtor.lg     = 
 | fab 5 xtor.lgΔ    = 
 | fab 5 xtor.cpp    = 
 | fab 5 xtor.cppΔ   = 
 | fab 5 xtor.mmp    = 
 | fab 5 xtor.mmpΔ   = 
 | fab 5 sram.hp     = 
 | fab 5 sram.hpΔ    = 
 | fab 5 sram.hd     = 
 | fab 5 sram.hdΔ    = 
 | fab 5 sram.lv     = 
 | fab 5 sram.lvΔ    = 
 | fab 5 dram.edram  = 
 | fab 5 dram.edramΔ  = 
}}

local p = {}

function noblank(str)
	if str == '' then
		return ' '
	else
		return str
	end
end

-- 

function p.compare(frame)
    local sideheaders = mw.html.create('table')
    local comptbl = mw.html.create('table')

	sideheaders
		:attr('style', 'float:left; margin:0; margin-right:-1px;')
        :attr('class', 'wikitable')

    comptbl
        :attr('style', 'margin: 0; text-align: center;')
        :attr('class', 'chip-infobox')
        :attr('class', 'wikitable')
        
    -- foundry name
    sideheaders:tag('tr'):tag('th')
    	:attr('style', 'text-align: right;')
    	:attr('colspan', '2')
    	:wikitext('Foundry')
    local fabs = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' name'] then break end
		fabs:tag('th'):attr('colspan', '2'):wikitext('[[' 
			.. (frame.args['fab ' .. i .. ' name link'] and frame.args['fab ' .. i .. ' name link'] or frame.args['fab ' .. i .. ' name'])
			.. '|' .. frame.args['fab ' .. i .. ' name'] .. ']]')
	end
	comptbl:node(fabs)
	
    -- process name
    sideheaders:tag('tr'):tag('th')
    	:attr('style', 'text-align: right;')
    	:attr('colspan', '2')
    	:wikitext('Process Name')
    local fname = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' proc name'] then break end
		fname:tag('td'):attr('colspan', '2'):wikitext(noblank(frame.args['fab ' .. i .. ' proc name']))
	end
	comptbl:node(fname)
	
    -- date
    sideheaders:tag('tr'):tag('th')
    	:attr('style', 'text-align: right;')
    	:attr('colspan', '2')
    	:wikitext('1st Production')
    local fdate = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' name'] then break end
		fdate:tag('td'):attr('colspan', '2'):wikitext(frame.args['fab ' .. i .. ' date'])
	end
	comptbl:node(fdate)
	
	-- wafers
	local waferheader = mw.html.create('tr')
	waferheader:tag('th')
    	:attr('style', 'text-align: center;')
    	:attr('rowspan', '2')
    	:wikitext('Wafer')
	waferheader:tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('Type')
	sideheaders:node(waferheader)
	
	-- wafer type
    local wtype = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' wafer.type'] then break end
		wtype:tag('td'):attr('colspan', '2'):wikitext(frame.args['fab ' .. i .. ' wafer.type'])
	end
	comptbl:node(wtype)
	
	-- wafer size
	sideheaders:tag('tr'):tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('Size')
    local wsize = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' wafer.size'] then break end
		wsize:tag('td'):attr('colspan', '2'):wikitext(noblank(frame.args['fab ' .. i .. ' wafer.size']))
	end
	comptbl:node(wsize)
	
	-- transistor
	local transistor = mw.html.create('tr')
	transistor:tag('th')
    	:attr('style', 'text-align: center;')
    	:attr('rowspan', '3')
    	:wikitext('Transistor')
	transistor:tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('Technology')
	sideheaders:node(transistor)
	
	-- xtor tech
    local xtorsize = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' xtor.tech'] then break end
		xtorsize:tag('td'):attr('colspan', '2'):wikitext(frame.args['fab ' .. i .. ' xtor.tech'])
	end
	comptbl:node(xtorsize)
	
	-- xtor type
	sideheaders:tag('tr'):tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('Type')
    local xtortype = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' xtor.type'] then break end
		xtortype:tag('td'):attr('colspan', '2'):wikitext(frame.args['fab ' .. i .. ' xtor.type'])
	end	
	comptbl:node(xtortype)
	
	-- xtor voltage
	sideheaders:tag('tr'):tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('Voltage')
    local xtorvolt = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' xtor.volt'] then break end
		xtorvolt:tag('td'):attr('colspan', '2'):wikitext(frame.args['fab ' .. i .. ' xtor.volt'])
	end
	comptbl:node(xtorvolt)
	
	-- metal layers
	sideheaders:tag('tr'):tag('th')
		:attr('colspan', '2')
    	:attr('style', 'text-align: right;')
    	:wikitext('Metal Layers')
    local layers = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' layers'] then break end
		layers:tag('td'):attr('colspan', '2'):wikitext(frame.args['fab ' .. i .. ' layers'])
	end
	comptbl:node(layers)
	
	
	
	-- diff from
	sideheaders:tag('tr'):tag('th')
		:attr('colspan', '2')
    	:wikitext(' ')
    local diffrom = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' diff from'] then break end
		
		if frame.args['fab ' .. i .. ' diff from'] == '@' then
			diffrom:tag('th'):wikitext('Value')
			diffrom:tag('th')
				:attr('rowspan', '10')
				:attr('style', 'background: #a3a3a3;')
				:wikitext('N/A')
		else
			diffrom:tag('th'):wikitext('Value')
			diffrom:tag('th'):wikitext(frame.args['fab ' .. i .. ' diff from'])
		end
	end
	comptbl:node(diffrom)


	-- gate length
	sideheaders:tag('tr'):tag('th')
		:attr('colspan', '2')
    	:attr('style', 'text-align: right;')
    	:wikitext('Gate Length (L<sub>g</sub>)')
    local gatelength = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' xtor.lg'] then break end
		gatelength:tag('td'):wikitext(frame.args['fab ' .. i .. ' xtor.lg'])
		if frame.args['fab ' .. i .. ' diff from'] ~= '@' then
			gatelength:tag('td'):wikitext(frame.args['fab ' .. i .. ' xtor.lgΔ'])
		end
	end
	comptbl:node(gatelength)
	
	-- cpp
	sideheaders:tag('tr'):tag('th')
		:attr('colspan', '2')
    	:attr('style', 'text-align: right;')
    	:wikitext('Contacted Gate Pitch (CPP)')
    local cpp = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' xtor.cpp'] then break end
		cpp:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' xtor.cpp']))
		if frame.args['fab ' .. i .. ' diff from'] ~= '@' then
			cpp:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' xtor.cppΔ']))
		end
	end
	comptbl:node(cpp)
	
	-- mmp
	sideheaders:tag('tr'):tag('th')
		:attr('colspan', '2')
    	:attr('style', 'text-align: right;')
    	:wikitext('Minimum Metal Pitch (MMP)')
    local mmp = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' xtor.mmp'] then break end
		mmp:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' xtor.mmp']))
		if frame.args['fab ' .. i .. ' diff from'] ~= '@' then
			mmp:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' xtor.mmpΔ']))
		end
	end
	comptbl:node(mmp)
	

	-- SRAMs
	local sramheader = mw.html.create('tr')
	sramheader:tag('th')
    	:attr('style', 'text-align: center;')
    	:attr('rowspan', '3')
    	:wikitext('[[SRAM]] [[bitcell]]')
	sramheader:tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('High-Perf (HP)')
	sideheaders:node(sramheader)
	
	
	-- sram.hp
    local sramhp = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' sram.hp'] then break end
		sramhp:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' sram.hp']))
		if frame.args['fab ' .. i .. ' diff from'] ~= '@' then
			sramhp:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' sram.hpΔ']))
		end
	end
	comptbl:node(sramhp)
	-- sram.hd
	sideheaders:tag('tr'):tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('High-Density (HD)')
    local sramhd = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' sram.hd'] then break end
		sramhd:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' sram.hd']))
		if frame.args['fab ' .. i .. ' diff from'] ~= '@' then
			sramhd:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' sram.hdΔ']))
		end
	end
	comptbl:node(sramhd)
	-- sram.lv
	sideheaders:tag('tr'):tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('Low-Voltage (LV)')
    local sramlv = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' sram.lv'] then break end
		sramlv:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' sram.lv']))
		if frame.args['fab ' .. i .. ' diff from'] ~= '@' then
			sramlv:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' sram.lvΔ']))
		end
	end
	comptbl:node(sramlv)
	
	
	-- DRAM
	local dramheader = mw.html.create('tr')
	dramheader:tag('th')
    	:attr('style', 'text-align: center;')
    	:attr('rowspan', '2')
    	:wikitext('[[DRAM]] [[bitcell]]')
	dramheader:tag('th')
    	:attr('style', 'text-align: right;')
    	:wikitext('eDRAM')
	sideheaders:node(dramheader)
	
	-- dram.edram
    local edram = mw.html.create('tr')
    for i = 1, 20 do
		if not frame.args['fab ' .. i .. ' dram.edram'] then break end
		edram:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' dram.edram']))
		if frame.args['fab ' .. i .. ' diff from'] ~= '@' then
			edram:tag('td'):wikitext(noblank(frame.args['fab ' .. i .. ' dram.edramΔ']))
		end
	end
	comptbl:node(edram)
	
	
	
   	--
   	-- We need to combine the two tables
   	local maindiv = mw.html.create('div')
   	local sidediv = mw.html.create('div')
   		-- some styles for everything
   		maindiv:attr('style', 'font-family: monospace;')
   		-- add out side table
   		maindiv:node(sideheaders)
   		--make sure the table can overflow nicely
   		sidediv:attr('style', 'overflow-x:auto; white-space:nowrap;')
   		sidediv:node(comptbl)
   		-- add the side div to the main div
   		maindiv:node(sidediv)
   		
	return maindiv
end


return p