fix 1x rom names

This commit is contained in:
Redo
2022-11-14 13:45:35 -06:00
parent ff20fdb2d6
commit 7b168dd25b
3 changed files with 9 additions and 9 deletions

View File

@@ -72,7 +72,7 @@ local function createBuffer (n) return { name = "Buffer" ..n, names = {"Buffer "
local function createDFF (n) return { name = "DFF" ..n, names = {"D FlipFlop " ..n.." Bit", "D FlipFlop " ..n.." Bit Up", "D FlipFlop " ..n.." Bit Down"}, func = "if(getport("..(n*2+1)..")) { copyword("..n..", 1, "..(n+1).."); }" } end
local function createMux(n) return { name = "Mux"..n, names = {"Mux "..n.." Bit", "Mux "..n.." Bit Vertical"}, func = "if(getport("..(n+math.pow(2,n)+1)..")) { setport("..(n+math.pow(2,n)+2)..", getport(getword("..n..", 1)+"..(n+1)..")); } else { setport("..(n+math.pow(2,n)+2)..", 0); }"} end
local function createDemux(n) return { name = "Demux"..n, names = {"Demux "..n.." Bit", "Demux "..n.." Bit Vertical"}, size = 1, func = "int pa = getdata(0); if(getport("..(n+math.pow(2,n)+1)..")) { int a = getword("..n..", 1) + "..(n+1).."; if(pa != a) { if(pa) { setport(pa, 0); } setport(a, 1); setdata(0, a); } } else { if(pa) { setport(pa, 0); setdata(0, 0); } }"} end
local function createRom(x, y, z) local w = log2(x*y); return {name = "Rom"..w.."x"..z, names = {"ROM "..x.."x"..y.."x"..z}, size = x*y*z, func="if(getport("..(w+z+1)..")) { int a = getword("..w..", 1); for(int i=0; i<"..z.."; i++) { setport("..(w+1).."+i, getdata(a + i*"..(x*y)..")); } } else { clearword("..z..", "..(w+1).."); }" } end
local function createRom(x, y, z) local w = log2(x*y); return {name = "Rom"..w.."x"..z, names = {"ROM "..x.."x"..y..(z>1 and ("x"..z) or "")}, size = x*y*z, func="if(getport("..(w+z+1)..")) { int a = getword("..w..", 1); for(int i=0; i<"..z.."; i++) { setport("..(w+1).."+i, getdata(a + i*"..(x*y)..")); } } else { clearword("..z..", "..(w+1).."); }" } end
local romsizes = { -- copied from brick gen
-- 1 bit data 4 bit data 8 bit data 16 bit data 32 bit data 48 bit data 64 bit data