Skip to content

Commit

Permalink
Move cal file selection into cal.sv (bit of a hack but gets things wo…
Browse files Browse the repository at this point in the history
…rking for now)
  • Loading branch information
vk2seb committed Feb 2, 2024
1 parent 948a246 commit fcba625
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 13 deletions.
6 changes: 5 additions & 1 deletion gateware/cal/cal.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions gateware/eurorack_pmod.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)(
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion gateware/mk/ecp5.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEFINES = "$(ADD_DEFINES) -DECP5 -DHW_REV=$(HW_REV)"
DEFINES = "$(ADD_DEFINES) -DECP5 -D$(HW_REV)"

all: $(BUILD)/$(PROJ).bin

Expand Down
2 changes: 1 addition & 1 deletion gateware/mk/ice40.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEFINES = "$(ADD_DEFINES) -DICE40 -DHW_REV=$(HW_REV)"
DEFINES = "$(ADD_DEFINES) -DICE40 -D$(HW_REV)"

all: $(BUILD)/$(PROJ).bin

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion gateware/sim/cal/tb_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions gateware/top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit fcba625

Please sign in to comment.