Skip to content

Commit

Permalink
gateware/touch: fix lints and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vk2seb committed Mar 14, 2024
1 parent 40ef1b7 commit ed38530
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 27 deletions.
8 changes: 4 additions & 4 deletions gateware/cores/touch_cv.sv
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ module touch_cv #(
input [7:0] touch7
);

assign sample_out0 = W'(touch0 <<< (W-10));
assign sample_out1 = W'(touch1 <<< (W-10));
assign sample_out2 = W'(touch2 <<< (W-10));
assign sample_out3 = W'(touch3 <<< (W-10));
assign sample_out0 = W'(touch0) <<< (W-10);
assign sample_out1 = W'(touch1) <<< (W-10);
assign sample_out2 = W'(touch2) <<< (W-10);
assign sample_out3 = W'(touch3) <<< (W-10);

endmodule
4 changes: 2 additions & 2 deletions gateware/drivers/pmod_i2c_master.sv
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ always_ff @(posedge clk) begin
I2C_INIT_TOUCH2: begin
case (i2c_config_pos)
default: begin
data_in <= touch_config[i2c_config_pos];
data_in <= touch_config[8'(i2c_config_pos)];
cmd <= I2CMASTER_WRITE;
end
1: begin
Expand All @@ -225,7 +225,7 @@ always_ff @(posedge clk) begin
i2c_state <= I2C_INIT_TOUCH1;
cmd <= I2CMASTER_STOP;
end else begin
data_in <= touch_config[i2c_config_pos];
data_in <= touch_config[8'(i2c_config_pos)];
cmd <= I2CMASTER_WRITE;
end
end
Expand Down
16 changes: 16 additions & 0 deletions gateware/scripts/verilator_lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,29 @@ verilator --lint-only -DVERILATOR_LINT_ONLY \
-Wno-INITIALDLY \
top.sv

# Lint an entire ICE40 design with touch scanning enabled.
verilator --lint-only -DVERILATOR_LINT_ONLY \
-DICE40 \
-DSELECTED_DSP_CORE=touch_cv \
-DTOUCH_SENSE_ENABLED \
-Iboards/icebreaker \
-Ical \
-Idrivers \
-Iexternal \
-Iexternal/no2misc/rtl \
-Icores \
-Icores/util \
-Wno-INITIALDLY \
top.sv

# Lint each core which can be selected
verilator --lint-only -Icores mirror.sv
verilator --lint-only -Icores bitcrush.sv
verilator --lint-only -Icores clkdiv.sv
verilator --lint-only -Icores sampler.sv
verilator --lint-only -Icores seqswitch.sv
verilator --lint-only -Icores vca.sv
verilator --lint-only -Icores touch_cv.sv
verilator --lint-only -Icores -Icores/util vco.sv
verilator --lint-only cores/util/filter/karlsen_lpf.sv
verilator --lint-only cores/util/filter/karlsen_lpf_pipelined.sv
Expand Down
2 changes: 1 addition & 1 deletion gateware/sim/pmod_i2c_master/tb_pmod_i2c_master.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async def test_i2cinit_00(dut):

dut.rst.value = 0

dut.i2c_state.value = 5 # Jump to I2C_INIT_CODEC1
dut.i2c_state.value = 7 # Jump to I2C_INIT_CODEC1

await RisingEdge(dut.sda_oe)

Expand Down
42 changes: 22 additions & 20 deletions gateware/top.sv
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,28 @@ sysmgr sysmgr_instance (
`SELECTED_DSP_CORE #(
.W(W)
) dsp_core_instance (
.rst (rst),
.clk (clk_256fs),
.sample_clk (clk_fs),
.sample_in0 (in0),
.sample_in1 (in1),
.sample_in2 (in2),
.sample_in3 (in3),
.sample_out0 (out0),
.sample_out1 (out1),
.sample_out2 (out2),
.sample_out3 (out3),
.jack (jack),
.touch0 (touch0),
.touch1 (touch1),
.touch2 (touch2),
.touch3 (touch3),
.touch4 (touch4),
.touch5 (touch5),
.touch6 (touch6),
.touch7 (touch7)
.rst (rst)
, .clk (clk_256fs)
, .sample_clk (clk_fs)
, .sample_in0 (in0)
, .sample_in1 (in1)
, .sample_in2 (in2)
, .sample_in3 (in3)
, .sample_out0 (out0)
, .sample_out1 (out1)
, .sample_out2 (out2)
, .sample_out3 (out3)
, .jack (jack)
`ifdef TOUCH_SENSE_ENABLED
, .touch0 (touch0)
, .touch1 (touch1)
, .touch2 (touch2)
, .touch3 (touch3)
, .touch4 (touch4)
, .touch5 (touch5)
, .touch6 (touch6)
, .touch7 (touch7)
`endif
);

`ifdef ECP5
Expand Down

0 comments on commit ed38530

Please sign in to comment.