diff --git a/gateware/cal/cal.sv b/gateware/cal/cal.sv index 1e327bf..44ea2b8 100644 --- a/gateware/cal/cal.sv +++ b/gateware/cal/cal.sv @@ -18,7 +18,11 @@ module cal #( parameter W = 16, // sample width - parameter CAL_MEM_FILE = "cal/cal_mem.hex" +`ifdef HW_R33 + parameter CAL_MEM_FILE = "cal/cal_mem_default_r33.hex" +`else + parameter CAL_MEM_FILE = "cal/cal_mem_default_r31.hex" +`endif )( input rst, input clk_256fs, diff --git a/gateware/eurorack_pmod.sv b/gateware/eurorack_pmod.sv index fc1ab0a..8cdf403 100644 --- a/gateware/eurorack_pmod.sv +++ b/gateware/eurorack_pmod.sv @@ -9,7 +9,6 @@ module eurorack_pmod #( parameter W = 16, // sample width, bits - parameter CAL_MEM_FILE = "cal/cal_mem.hex", parameter CODEC_CFG_FILE = "drivers/ak4619-cfg.hex", parameter LED_CFG_FILE = "drivers/pca9635-cfg.hex" )( @@ -73,8 +72,7 @@ logic signed [W-1:0] sample_dac3; // Compensates for DC bias in CODEC, gain differences, resistor // tolerances and so on. cal #( - .W(W), - .CAL_MEM_FILE(CAL_MEM_FILE) + .W(W) ) cal_instance ( .rst(rst), .clk_256fs (clk_256fs), diff --git a/gateware/mk/ecp5.mk b/gateware/mk/ecp5.mk index 98b8389..78749ac 100644 --- a/gateware/mk/ecp5.mk +++ b/gateware/mk/ecp5.mk @@ -1,4 +1,4 @@ -DEFINES = "$(ADD_DEFINES) -DECP5 -DHW_REV=$(HW_REV)" +DEFINES = "$(ADD_DEFINES) -DECP5 -D$(HW_REV)" all: $(BUILD)/$(PROJ).bin diff --git a/gateware/mk/ice40.mk b/gateware/mk/ice40.mk index 571e708..8687941 100644 --- a/gateware/mk/ice40.mk +++ b/gateware/mk/ice40.mk @@ -1,4 +1,4 @@ -DEFINES = "$(ADD_DEFINES) -DICE40 -DHW_REV=$(HW_REV)" +DEFINES = "$(ADD_DEFINES) -DICE40 -D$(HW_REV)" all: $(BUILD)/$(PROJ).bin diff --git a/gateware/sim/cal/cal/cal_mem.hex b/gateware/sim/cal/cal/cal_mem_default_r31.hex similarity index 100% rename from gateware/sim/cal/cal/cal_mem.hex rename to gateware/sim/cal/cal/cal_mem_default_r31.hex diff --git a/gateware/sim/cal/tb_cal.py b/gateware/sim/cal/tb_cal.py index d9e2bf2..0efccfb 100644 --- a/gateware/sim/cal/tb_cal.py +++ b/gateware/sim/cal/tb_cal.py @@ -32,7 +32,7 @@ async def test_cal_00(dut): ] cal_mem = [] - with open("cal/cal_mem.hex", "r") as f_cal_mem: + with open("cal/cal_mem_default_r31.hex", "r") as f_cal_mem: for line in f_cal_mem.readlines(): if '//' in line: continue diff --git a/gateware/top.sv b/gateware/top.sv index a54f414..56a6e1e 100644 --- a/gateware/top.sv +++ b/gateware/top.sv @@ -130,12 +130,7 @@ assign i2c_sda_i = PMOD_I2C_SDA; `endif eurorack_pmod #( - .W(W), -`ifdef HW_R33 - .CAL_MEM_FILE("cal/cal_mem_default_r33.hex") -`else - .CAL_MEM_FILE("cal/cal_mem_default_r31.hex") -`endif + .W(W) ) eurorack_pmod1 ( .clk_256fs(clk_256fs), .clk_fs (clk_fs),