Skip to content

Commit

Permalink
examples: ice_makefile_blinky: allow blinking with R, G or B easily
Browse files Browse the repository at this point in the history
  • Loading branch information
josuah committed Jun 20, 2024
1 parent 7aef3d3 commit 4ebe348
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions examples/ice_makefile_blinky/ice40.pcf
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
set_io --warn-no-port led_green 39
set_io --warn-no-port clk 35
set_io -nowarn LED_G 39 # active-low
set_io -nowarn LED_B 40 # active-low
set_io -nowarn LED_R 41 # active-low
set_io -nowarn CLK 35
12 changes: 8 additions & 4 deletions examples/ice_makefile_blinky/top.sv
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@

module top (
input clk,
output led_green,
input CLK,
output LED_R,
output LED_G,
output LED_B,
);

localparam N = 22;

reg [N:0] counter;

always @(posedge clk) begin
always @(posedge CLK) begin
counter <= counter + 1;
end

assign led_green = counter[N];
assign LED_R = 1'b1;
assign LED_G = counter[N];
assign LED_B = 1'b1;

endmodule

0 comments on commit 4ebe348

Please sign in to comment.