Skip to content

Commit

Permalink
icestick bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
faramire committed Apr 19, 2024
1 parent 1944909 commit 19d8679
Show file tree
Hide file tree
Showing 7 changed files with 7,433 additions and 35 deletions.
8 changes: 8 additions & 0 deletions icestick/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

yosys -p "synth_ice40 -blif stopwatch.blif" tb_icestick.v

arachne-pnr -d 1k -p icestick.pcf stopwatch.blif -o stopwatch.txt

icepack stopwatch.txt stopwatch.bin

iceprog stopwatch.bin
26 changes: 26 additions & 0 deletions icestick/clockDividerIce.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
module clockDividerIce (
input wire clk_in, // input clock 12 MHz
input wire ena,
input wire res, // reset, active low
output reg clk_out // output clock 1 MHz
);

reg[2:0] counter;
parameter div = 6; // 12 MHz / 12 = 1 MHz, 50% duty cycle => 1/2 of that


always @(posedge clk_in) begin
if (!res) begin // reset
counter <= 3'b0;
clk_out <= 1'b0;
end else if (ena) begin
if (counter < (div-1)) begin // count up
counter <= counter + 1;
end else begin // reset counter and invert output
counter <= 3'b0;
clk_out <= ~clk_out;
end
end
end

endmodule //clockDividerIce
10 changes: 5 additions & 5 deletions icestick/icestick.pcf
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
set_io CLK_IN 21

set_io o_stopwatch_enabled 95
set_io o_display_enabled 96
set_io o_mosi 97
set_io o_cs 98
set_io o_sck 99
set_io l_stopwatch_enabled 95
set_io l_display_enabled 96
set_io l_mosi 97
set_io l_cs 98
set_io l_sck 99

set_io i_board_reset 119
set_io i_button_start_stop 118
Expand Down
Binary file added icestick/stopwatch.bin
Binary file not shown.
1,725 changes: 1,725 additions & 0 deletions icestick/stopwatch.blif

Large diffs are not rendered by default.

Loading

0 comments on commit 19d8679

Please sign in to comment.