Skip to content

Commit

Permalink
bitcraze#10 Reimplement timing fix from e9a1518
Browse files Browse the repository at this point in the history
  • Loading branch information
krichardsson committed Jun 12, 2020
1 parent 30a0690 commit 1afa43f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $(PROJ).json: LighthouseTopLevel.v
yosys -p 'read_verilog LighthouseTopLevel.v; read_verilog blackboxes.v; synth_ice40 -top LighthouseTopLevel; write_json $@'

%.asc: %.json $(PIN_DEF)
nextpnr-ice40 --seed 18 --up5k --json $< --asc $@ --pcf $(PIN_DEF)
nextpnr-ice40 --seed 19 --up5k --json $< --asc $@ --pcf $(PIN_DEF)
python3 tools/update_bitstream_comment.py $@ "$(VERSION)"

%.bin: %.asc
Expand Down
12 changes: 8 additions & 4 deletions rtl/ts4231Configurator.v
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ module ts4231Configurator (
reg [5:0] config_bit_counter = 0;
reg [14:0] config_value = {14'h392b, 1'b0};
reg config_bit = 0;
reg [4:0] config_wait_counter = 0;
always @(posedge clk) begin
if (config_enable) begin
prev_reconfigure <= reconfigure;
Expand All @@ -55,7 +56,10 @@ module ts4231Configurator (
case (config_state)
CONFIG_IDLE: if (prev_reconfigure == 0 && reconfigure == 1) config_state <= CONFIG_WAIT_PULSE;
CONFIG_WAIT_PULSE: if (config_prev_d == 1 && d_in == 0) config_state <= CONFIG_START_CFG;
CONFIG_START_CFG: config_state <= CONFIG_WRITE_START;
CONFIG_START_CFG: begin
if (config_wait_counter == 4) config_state <= CONFIG_WRITE_START;
config_wait_counter = config_wait_counter + 1;
end
CONFIG_WRITE_START: begin
config_bit_counter <= 0;
config_state <= CONFIG_WRITE_E_LOW;
Expand Down Expand Up @@ -87,8 +91,8 @@ module ts4231Configurator (
(* parallel_case *)
case (config_state)
CONFIG_START_CFG: begin
e_out = 1;
e_oe = 1;
e_out = (config_wait_counter == 4);
e_oe = (config_wait_counter == 4);
d_out = 0;
d_oe = 0;
end
Expand Down Expand Up @@ -142,4 +146,4 @@ module ts4231Configurator (
end
endcase
end
endmodule
endmodule

0 comments on commit 1afa43f

Please sign in to comment.