From 7b168dd25b912966a39d058c77b1bcd7e079c71b Mon Sep 17 00:00:00 2001 From: Redo Date: Mon, 14 Nov 2022 13:45:35 -0600 Subject: [PATCH] fix 1x rom names --- sim/compiled_sim.dll | Bin 120918 -> 120918 bytes sim/compiled_sim_gates.lua | 16 ++++++++-------- sim/gencfuncs.lua | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sim/compiled_sim.dll b/sim/compiled_sim.dll index 5668a7d039f7ce1f990a143c9f243350666d2cba..f631617b14bef058bf78e9b4593e648164a05a04 100644 GIT binary patch delta 31 ncmcb%f&JPB_6Z$~mnL@lGYOq-ytVZfqn0Y;rR}V0jDec~=cx@t delta 31 ncmcb%f&JPB_6Z$~t`j@`nSPvZytVZfqn0Y8>vmQ(#=uPg=GF}j diff --git a/sim/compiled_sim_gates.lua b/sim/compiled_sim_gates.lua index a55f700..8937926 100644 --- a/sim/compiled_sim_gates.lua +++ b/sim/compiled_sim_gates.lua @@ -219,24 +219,24 @@ cFuncsByName = { ["demux 7 bit vertical"] = 77, ["demux 8 bit"] = 78, ["demux 8 bit vertical"] = 78, - ["rom 4x4x1"] = 79, + ["rom 4x4"] = 79, ["rom 4x4x4"] = 80, ["rom 8x2x8"] = 81, - ["rom 8x8x1"] = 82, + ["rom 8x8"] = 82, ["rom 8x8x4"] = 83, ["rom 8x8x8"] = 84, ["rom 16x4x16"] = 85, ["rom 32x2x32"] = 86, ["rom 64x1x48"] = 87, ["rom 64x1x64"] = 88, - ["rom 16x16x1"] = 89, + ["rom 16x16"] = 89, ["rom 16x16x4"] = 90, ["rom 16x16x8"] = 91, ["rom 16x16x16"] = 92, ["rom 32x8x32"] = 93, ["rom 64x4x48"] = 94, ["rom 64x4x64"] = 95, - ["rom 32x16x1"] = 96, + ["rom 32x16"] = 96, ["rom 32x16x4"] = 97, ["rom 32x16x8"] = 98, ["rom 32x16x16"] = 99, @@ -277,24 +277,24 @@ cDataSizeByName = { ["demux 7 bit vertical"] = 1, ["demux 8 bit"] = 1, ["demux 8 bit vertical"] = 1, - ["rom 4x4x1"] = 16, + ["rom 4x4"] = 16, ["rom 4x4x4"] = 64, ["rom 8x2x8"] = 128, - ["rom 8x8x1"] = 64, + ["rom 8x8"] = 64, ["rom 8x8x4"] = 256, ["rom 8x8x8"] = 512, ["rom 16x4x16"] = 1024, ["rom 32x2x32"] = 2048, ["rom 64x1x48"] = 3072, ["rom 64x1x64"] = 4096, - ["rom 16x16x1"] = 256, + ["rom 16x16"] = 256, ["rom 16x16x4"] = 1024, ["rom 16x16x8"] = 2048, ["rom 16x16x16"] = 4096, ["rom 32x8x32"] = 8192, ["rom 64x4x48"] = 12288, ["rom 64x4x64"] = 16384, - ["rom 32x16x1"] = 512, + ["rom 32x16"] = 512, ["rom 32x16x4"] = 2048, ["rom 32x16x8"] = 4096, ["rom 32x16x16"] = 8192, diff --git a/sim/gencfuncs.lua b/sim/gencfuncs.lua index fd57b05..1393b36 100644 --- a/sim/gencfuncs.lua +++ b/sim/gencfuncs.lua @@ -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