From 1afa43faebbaf956d90f80ce6a562463f19c8973 Mon Sep 17 00:00:00 2001 From: Kristoffer Richardsson Date: Fri, 12 Jun 2020 14:56:38 +0200 Subject: [PATCH] #10 Reimplement timing fix from e9a15182c6c4d577f14b01c4566f41fc5ba8da88 --- Makefile | 2 +- rtl/ts4231Configurator.v | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 275c6a6..c46768e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/rtl/ts4231Configurator.v b/rtl/ts4231Configurator.v index 4f465e2..098ea28 100644 --- a/rtl/ts4231Configurator.v +++ b/rtl/ts4231Configurator.v @@ -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; @@ -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; @@ -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 @@ -142,4 +146,4 @@ module ts4231Configurator ( end endcase end -endmodule \ No newline at end of file +endmodule