Skip to content

Instantly share code, notes, and snippets.

@mkvenkit
Created December 20, 2020 13:13
Show Gist options
  • Select an option

  • Save mkvenkit/d28ae6c90d572e55a6fc68e39ac8b875 to your computer and use it in GitHub Desktop.

Select an option

Save mkvenkit/d28ae6c90d572e55a6fc68e39ac8b875 to your computer and use it in GitHub Desktop.
icebling-top.v
// LED pattern
parameter PAT_LETTERS = 2'b00;
parameter PAT_CONWAY = 2'b01;
parameter PAT_RAIN = 2'b10;
reg [1:0] curr_patt;
...
// assign buffer based on curent pattern
wire [63:0] w_fb = (curr_patt == PAT_LETTERS) ? w_fb_lett :
((curr_patt == PAT_CONWAY) ?
w_fb_conway : w_fb_rain);
...
// letters module
wire [63:0] w_fb_lett;
letters88 let (
.resetn(resetn),
.clk(clk),
.fb(w_fb_lett)
);
// rain module
wire [63:0] w_fb_rain;
rain88 rn(
.resetn(resetn),
.clk(clk),
.fb(w_fb_rain)
);
// Conway's GOL
wire [63:0] w_fb_conway;
conway88 c88 (
.resetn(resetn),
.clk(clk),
.fb(w_fb_conway)
);
// instatiate dot88
dot88 d88(
.resetn(resetn),
.clk(clk),
.fb(w_fb),
.row(row),
.col(col)
);
always @(posedge clk)
begin
// initialise rot
if (!resetn)
begin
counter <= 0;
curr_patt <= PAT_LETTERS;
sw_counter <= 0;
end
else
begin
// increment counters
counter <= counter + 1;
sw_counter <= sw_counter + 1;
// switch pattern
if (!sw_counter)
curr_patt <= curr_patt + 1;
// blink LED
if (!counter)
begin
L2 = ~L2;
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment