diff options
| -rw-r--r-- | SEG7_LUT.v | 42 | ||||
| -rw-r--r-- | button_sync.v | 20 | ||||
| -rw-r--r-- | counter.v | 18 | ||||
| -rw-r--r-- | delay.v | 35 | ||||
| -rw-r--r-- | game_win_anim.v | 41 | ||||
| -rw-r--r-- | main.v | 362 | ||||
| -rw-r--r-- | natural_counter.v | 23 | ||||
| -rw-r--r-- | round_win_anim.v | 42 | ||||
| -rw-r--r-- | sequence_generator.v | 30 | ||||
| -rw-r--r-- | variable_delay.v | 77 |
10 files changed, 690 insertions, 0 deletions
diff --git a/SEG7_LUT.v b/SEG7_LUT.v new file mode 100644 index 0000000..7526b3f --- /dev/null +++ b/SEG7_LUT.v @@ -0,0 +1,42 @@ +module SEG7_LUT ( oSEG,iDIG );
+input [3:0] iDIG;
+output [6:0] oSEG;
+reg [6:0] oSEG;
+always @(iDIG)
+begin
+ case(iDIG)
+ 4'h1:
+ oSEG = 7'b1111001; // ---t----
+ 4'h2:
+ oSEG = 7'b0100100; // | |
+ 4'h3:
+ oSEG = 7'b0110000; // lt rt
+ 4'h4:
+ oSEG = 7'b0011001; // | |
+ 4'h5:
+ oSEG = 7'b0010010; // ---m----
+ 4'h6:
+ oSEG = 7'b0000010; // | |
+ 4'h7:
+ oSEG = 7'b1111000; // lb rb
+ 4'h8:
+ oSEG = 7'b0000000; // | |
+ 4'h9:
+ oSEG = 7'b0011000; // ---b----
+ 4'ha:
+ oSEG = 7'b0001000;
+ 4'hb:
+ oSEG = 7'b0000011;
+ 4'hc:
+ oSEG = 7'b1000110;
+ 4'hd:
+ oSEG = 7'b0100001;
+ 4'he:
+ oSEG = 7'b0000110;
+ 4'hf:
+ oSEG = 7'b0001110;
+ 4'h0:
+ oSEG = 7'b1000000;
+ endcase
+end
+endmodule
diff --git a/button_sync.v b/button_sync.v new file mode 100644 index 0000000..5913ce5 --- /dev/null +++ b/button_sync.v @@ -0,0 +1,20 @@ +// This module is used for sycronizing the keys to the clock. +// The key input is active low, like the keys on the board. +// This module inverts the buttons so that the pressed output is active high +// button_down is high if any of the buttons are pressed +module button_sync ( + input clk, + input [7:0] key, + output button_down, + output reg [7:0] pressed +); + // used to avoid metastability + reg [7:0] key1; + + assign button_down = |pressed; + + always @(posedge clk) begin + pressed <= key1; + key1 <= key; + end +endmodule diff --git a/counter.v b/counter.v new file mode 100644 index 0000000..f41311f --- /dev/null +++ b/counter.v @@ -0,0 +1,18 @@ +// This module is used to count things such as the number of rounds +// that have been won or the current position in the sequence +// If reset is high the counter will reset to 0 +// If increment is high the counter will be incremented by 1 +// NOTE: this module updates on the positive edge of the clock +module counter ( + input clk, + input increment, + input reset, + output reg [4:0] count +); + always @(posedge clk) begin + if (reset) + count <= 5'b00000; + else if (increment) + count <= count + 5'b00001; + end +endmodule @@ -0,0 +1,35 @@ +// This module is used for creating delays +// reset will reset this module +// fast pulse will go high for one clock cycle 0.2 seconds after a reset +// slow pulse will go high for one clock cycle 0.75 seconds after a reset +// NOTE: Every time this module is reset the time before getting will also +// be reset. So if reset is constantly held high you will never get +// either pulse. +module delay ( + input clk, + input reset, + input [3:0] variable_pulse_index, + output slow_pulse, + output fast_pulse, + output variable_pulse +); + reg [31:0] counter; + wire [31:0] variable_pulse_num; + + assign variable_pulse_num = 32'd24000000 - (32'd2000000 * variable_pulse_index); + + assign slow_pulse = (counter == 31'd18000000); //18mil + assign fast_pulse = (counter == 31'd4800000); //4.8mil + assign variable_pulse = (counter == variable_pulse_num); + + initial begin + counter <= 32'd0; + end + + always @(posedge clk) begin +// if (reset) +// counter <= 32'd0; +// else +// counter <= counter + 1'b1; + end +endmodule diff --git a/game_win_anim.v b/game_win_anim.v new file mode 100644 index 0000000..b0dda07 --- /dev/null +++ b/game_win_anim.v @@ -0,0 +1,41 @@ +module game_win_anim(input clk, next, reset, output light1, light2, light3, light4, light5, light6, light7, light8, done); + + reg [4:0] state, nState; + + initial begin + state <= 5'b11111; + end + + always @ (negedge clk) begin + + state <= nState; + + end + + always @ (*) begin + + if (~reset) begin + + if (next) + nState = state + 5'b00001; + else + nState = state; + end + else begin + nState = 5'b11111; + end + + end + + assign light1 = state[0]; + assign light2 = state[0]; + assign light3 = state[0]; + assign light4 = state[0]; + assign light5 = state[0]; + assign light6 = state[0]; + assign light7 = state[0]; + assign light8 = state[0]; + + assign done = (state == 5'b11111); + +endmodule @@ -0,0 +1,362 @@ +module main(clk, reset, b1, b2, b3, b4, b5, b6, b7, b8, board_key0, led1, led2, led3, led4, led5, led6, led7, led8, board_led0, board_led1, board_led2, board_led3, board_led4); + + input clk, reset, b1, b2, b3, b4, b5, b6, b7, b8, board_key0; + output board_led0, board_led1, board_led2, board_led3, board_led4; + output reg led1, led2, led3, led4, led5, led6, led7, led8; + + /* ==================== INPUT SETUP ==================== */ + + wire hax; + assign hax = ~board_key0; + + wire [7:0] raw_bundle; + assign raw_bundle[0] = b1; + assign raw_bundle[1] = b2; + assign raw_bundle[2] = b3; + assign raw_bundle[3] = b4; + assign raw_bundle[4] = b5; + assign raw_bundle[5] = b6; + assign raw_bundle[6] = b7; + assign raw_bundle[7] = b8; + + wire [7:0] buttons; + wire any_button_pressed; + + button_sync b_inst(clk, raw_bundle, any_button_pressed, buttons); + + + /* ====================== COUNTERS ===================== */ + + wire [4:0] max_sequence, cur_sequence, completed_sequences; + wire reset_max_sequence, reset_cur_sequence, reset_completed_sequences; + wire inc_max_sequence, inc_cur_sequence, inc_completed_sequences; + + wire [4:0] cur_speed; + + natural_counter max_sequence_counter(clk, inc_max_sequence, reset_max_sequence, max_sequence); + counter cur_sequence_counter(clk, inc_cur_sequence, reset_cur_sequence, cur_sequence); + counter completed_sequences_counter(clk, inc_completed_sequences, reset_completed_sequences, completed_sequences); + + /* ==================== DELAY MODULES ================== */ + + wire reset_var, reset_short, reset_round; + wire var_delay, short_delay, round_delay; + + variable_delay delay_var(clk, reset_var, cur_speed, var_delay); + variable_delay delay_short(clk, reset_short, 5'b11110, short_delay); + variable_delay delay_round(clk, reset_round, 5'b01100, round_delay); + + /* ================== SEQUENCE GENERATOR =============== */ + + wire randomize_seq, seq_next, seq_start_over; + wire [7:0] seq_out; + + sequence_generator seq_inst(clk, randomize_seq, seq_next, seq_start_over, seq_out); + + /* ================= ANIMATION MODULES ================= */ + + wire sa_next, sa_reset; + + wire sa_light1, sa_light2, sa_light3, sa_light4, sa_light5, sa_light6, sa_light7, sa_light8; + wire sa_done; + + round_win_anim sa_inst(clk, sa_next, sa_reset, sa_light1, sa_light2, sa_light3, sa_light4, sa_light5, sa_light6, sa_light7, sa_light8, sa_done); + + + wire gw_next, gw_reset; + + wire gw_light1, gw_light2, gw_light3, gw_light4, gw_light5, gw_light6, gw_light7, gw_light8; + wire gw_done; + + game_win_anim gw_inst(clk, gw_next, gw_reset, gw_light1, gw_light2, gw_light3, gw_light4, gw_light5, gw_light6, gw_light7, gw_light8, gw_done); + + /* ==================== STATE STORAGE ================== */ + + reg [31:0] state; + reg [31:0] nState; + + + /* ===================== STATE NAMES =================== */ + + parameter ABSOLUTE_START_STATE = 32'd40; + parameter RANDOMIZE = 32'd41; + parameter START_OVER = 32'd42; + parameter GENERATING = 32'd43; + parameter RESET_DELAY_VAR = 32'd44; + parameter SHOWING = 32'd45; + parameter RESET_DELAY_SHORT = 32'd46; + parameter WAIT_PAUSE = 32'd47; + parameter SHOWING_COMPLETE = 32'd48; + + parameter START_OVER_INPUT = 32'd100; + parameter GENERATING_INPUT = 32'd101; + + parameter ACCEPTING_INPUT = 32'd102; + parameter RESET_INPUT_BUFFER_DOWN = 32'd103; + parameter WAIT_INPUT_BUFFER_DOWN = 32'd104; + + parameter WAITING_BUTTON_UP = 32'd105; + parameter RESET_INPUT_BUFFER_UP = 32'd106; + parameter WAIT_INPUT_BUFFER_UP = 32'd107; + + parameter BUTTON_SUCCESSFUL = 32'd108; + + parameter GAME_OVER = 32'd200; + parameter GAME_WIN = 32'd201; + + parameter ROUND_WIN = 32'd250; + parameter ROUND_INCREMENT = 32'd251; + parameter ANIMATION_CHECK = 32'd252; + + parameter REGULAR_ANIMATION = 32'd300; + parameter RA_RESET_DELAY = 32'd301; + parameter RA_DO_ANIM = 32'd302; + + parameter SPECIAL_ANIMATION = 32'd350; + parameter SA_RESET_MODULE = 32'd351; + parameter SA_RESET_DELAY = 32'd352; + parameter SA_NEXT = 32'd353; + parameter SA_DO_ANIM = 32'd354; + + parameter GAME_WIN_ANIMATION = 32'd400; + parameter GW_RESET_MODULE = 32'd401; + parameter GW_RESET_DELAY = 32'd402; + parameter GW_NEXT = 32'd403; + parameter GW_DO_ANIM = 32'd404; + + initial begin + state = ABSOLUTE_START_STATE; + end + + always @ (posedge clk) begin + + state <= nState; + + end + + always @ (*) begin + + if(~reset) + begin + + /* ================== STATE TRANSITION ================= */ + + case (state) + ABSOLUTE_START_STATE: nState = RANDOMIZE; + RANDOMIZE: nState = START_OVER; + START_OVER:nState = GENERATING; + GENERATING: nState = RESET_DELAY_VAR; + RESET_DELAY_VAR: nState = SHOWING; + SHOWING: begin + if (var_delay) begin + if (cur_sequence >= max_sequence) + nState = SHOWING_COMPLETE; + else + nState = RESET_DELAY_SHORT; + end + else + nState = SHOWING; + end + RESET_DELAY_SHORT: nState = WAIT_PAUSE; + WAIT_PAUSE: begin + if (short_delay) + nState = GENERATING; + else + nState = WAIT_PAUSE; + end + SHOWING_COMPLETE: nState = START_OVER_INPUT; + START_OVER_INPUT: nState = GENERATING_INPUT; + GENERATING_INPUT: nState = ACCEPTING_INPUT; + ACCEPTING_INPUT: begin + if (~any_button_pressed) + if (cur_sequence >= max_sequence) + if (max_sequence == 5'b11111) + nState = GAME_WIN; + else + nState = ROUND_WIN; + else + // -----HAX------ to automatically win the game + if (hax) + nState = GAME_WIN; + else + nState = ACCEPTING_INPUT; + else + if (buttons == seq_out) + nState = RESET_INPUT_BUFFER_DOWN; + else + nState = GAME_OVER; + end + + RESET_INPUT_BUFFER_DOWN: nState = WAIT_INPUT_BUFFER_DOWN; + WAIT_INPUT_BUFFER_DOWN: begin + if (short_delay) + nState = WAITING_BUTTON_UP; + else + nState = WAIT_INPUT_BUFFER_DOWN; + end + WAITING_BUTTON_UP: begin + if (any_button_pressed) + nState = WAITING_BUTTON_UP; + else + nState = BUTTON_SUCCESSFUL; + end + + BUTTON_SUCCESSFUL: nState = RESET_INPUT_BUFFER_UP; + RESET_INPUT_BUFFER_UP: nState = WAIT_INPUT_BUFFER_UP; + WAIT_INPUT_BUFFER_UP: begin + if (short_delay) + nState = GENERATING_INPUT; + else + nState = WAIT_INPUT_BUFFER_UP; + end + GAME_OVER: nState = GAME_OVER; + GAME_WIN: nState = GAME_WIN_ANIMATION; + ROUND_WIN: nState = ROUND_INCREMENT; + ROUND_INCREMENT: nState = ANIMATION_CHECK; + ANIMATION_CHECK: begin + if (completed_sequences == 5'd5) + nState = SPECIAL_ANIMATION; + else + nState = REGULAR_ANIMATION; + end + REGULAR_ANIMATION: nState = RA_RESET_DELAY; + RA_RESET_DELAY: nState = RA_DO_ANIM; + RA_DO_ANIM: begin + if (round_delay) + nState = START_OVER; + else + nState = RA_DO_ANIM; + end + SPECIAL_ANIMATION: nState = SA_RESET_MODULE; + SA_RESET_MODULE: nState = SA_RESET_DELAY; + SA_RESET_DELAY: nState = SA_NEXT; + SA_NEXT: nState = SA_DO_ANIM; + SA_DO_ANIM: begin + if (short_delay) + if (sa_done) + nState = START_OVER; + else + nState = SA_RESET_DELAY; + else + nState = SA_DO_ANIM; + end + GAME_WIN_ANIMATION: nState = GW_RESET_MODULE; + GW_RESET_MODULE: nState = GW_RESET_DELAY; + GW_RESET_DELAY: nState = GW_NEXT; + GW_NEXT: nState = GW_DO_ANIM; + GW_DO_ANIM: begin + if (round_delay) + if (gw_done) + nState = GAME_OVER; + else + nState = GW_RESET_DELAY; + else + nState = GW_DO_ANIM; + end + default: nState = ABSOLUTE_START_STATE; + endcase + + /* ================ LIGHT OUTPUT ============= */ + + case (state) + SHOWING: begin + case (seq_out) + 8'b00000001: begin + led1 = 1; led2 = 0; led3 = 0; led4 = 0; led5 = 0; led6 = 0; led7 = 0; led8 = 0; + end + 8'b00000010: begin + led1 = 0; led2 = 1; led3 = 0; led4 = 0; led5 = 0; led6 = 0; led7 = 0; led8 = 0; + end + 8'b00000100: begin + led1 = 0; led2 = 0; led3 = 1; led4 = 0; led5 = 0; led6 = 0; led7 = 0; led8 = 0; + end + 8'b00001000: begin + led1 = 0; led2 = 0; led3 = 0; led4 = 1; led5 = 0; led6 = 0; led7 = 0; led8 = 0; + end + 8'b00010000: begin + led1 = 0; led2 = 0; led3 = 0; led4 = 0; led5 = 1; led6 = 0; led7 = 0; led8 = 0; + end + 8'b00100000: begin + led1 = 0; led2 = 0; led3 = 0; led4 = 0; led5 = 0; led6 = 1; led7 = 0; led8 = 0; + end + 8'b01000000: begin + led1 = 0; led2 = 0; led3 = 0; led4 = 0; led5 = 0; led6 = 0; led7 = 1; led8 = 0; + end + 8'b10000000: begin + led1 = 0; led2 = 0; led3 = 0; led4 = 0; led5 = 0; led6 = 0; led7 = 0; led8 = 1; + end + default: begin + led1 = 0; led2 = 0; led3 = 0; led4 = 0; led5 = 0; led6 = 0; led7 = 0; led8 = 0; + end + endcase + + end + WAITING_BUTTON_UP: begin + led1 = buttons[0]; + led2 = buttons[1]; + led3 = buttons[2]; + led4 = buttons[3]; + led5 = buttons[4]; + led6 = buttons[5]; + led7 = buttons[6]; + led8 = buttons[7]; + end + GAME_OVER, RA_DO_ANIM: begin + led1 = 1; led2 = 1; led3 = 1; led4 = 1; led5 = 1; led6 = 1; led7 = 1; led8 = 1; + end + SA_DO_ANIM: begin + led1 = sa_light1; led2 = sa_light2; led3 = sa_light3; led4 = sa_light4; led5 = sa_light5; led6 = sa_light6; led7 = sa_light7; led8 = sa_light8; + end + GW_DO_ANIM: begin + led1 = gw_light1; led2 = gw_light2; led3 = gw_light3; led4 = gw_light4; led5 = gw_light5; led6 = gw_light6; led7 = gw_light7; led8 = gw_light8; + end + default: begin + led1 = 0; led2 = 0; led3 = 0; led4 = 0; led5 = 0; led6 = 0; led7 = 0; led8 = 0; + end + endcase + end + else begin + nState = ABSOLUTE_START_STATE; + led1 = 0; led2 = 0; led3 = 0; led4 = 0; led5 = 0; led6 = 0; led7 = 0; led8 = 0; + end + end + + /* ====== INTERNAL WIRES AND SUBMODULE CONNECTIONS ===== */ + + // mostly resets, incrementers, and other commands that correspond to one or multiple states + + assign reset_var = (state == RESET_DELAY_VAR); + assign reset_short = (state == RESET_DELAY_SHORT) | (state == RESET_INPUT_BUFFER_UP) | (state == RESET_INPUT_BUFFER_DOWN) | (state == SA_RESET_DELAY); + assign reset_round = (state == RA_RESET_DELAY) | (state == GW_RESET_DELAY); + + + assign randomize_seq = (state == RANDOMIZE); + assign seq_next = (state == GENERATING) | (state == GENERATING_INPUT); + assign seq_start_over = (state == START_OVER) | (state == START_OVER_INPUT); + + + assign sa_next = (state == SA_NEXT); + assign sa_reset = (state == SA_RESET_MODULE); + + assign gw_next = (state == GW_NEXT); + assign gw_reset = (state == GW_RESET_MODULE); + + + + assign reset_max_sequence = (state == ABSOLUTE_START_STATE); + assign reset_cur_sequence = (state == ABSOLUTE_START_STATE) | (state == START_OVER) | (state == SHOWING_COMPLETE); + assign reset_completed_sequences = (state == ABSOLUTE_START_STATE) | (state == SPECIAL_ANIMATION); + + assign inc_max_sequence = (state == ROUND_INCREMENT); + assign inc_cur_sequence = (state == GENERATING) | (state == BUTTON_SUCCESSFUL); + assign inc_completed_sequences = (state == ROUND_INCREMENT); + + assign cur_speed = max_sequence - 5'b00001; + + assign board_led0 = cur_sequence[0]; + assign board_led1 = cur_sequence[1]; + assign board_led2 = cur_sequence[2]; + assign board_led3 = cur_sequence[3]; + assign board_led4 = cur_sequence[4]; + +endmodule diff --git a/natural_counter.v b/natural_counter.v new file mode 100644 index 0000000..4e63ffd --- /dev/null +++ b/natural_counter.v @@ -0,0 +1,23 @@ +// This module is used to count things such as the number of rounds +// that have been won or the current position in the sequence +// If reset is high the counter will reset to 0 +// If increment is high the counter will be incremented by 1 +// NOTE: this module updates on the positive edge of the clock +module natural_counter ( + input clk, + input increment, + input reset, + output reg [4:0] count +); + + initial begin + count = 5'b00001; + end + + always @(negedge clk) begin + if (reset) + count <= 5'b00001; + else if (increment) + count <= count + 5'b00001; + end +endmodule diff --git a/round_win_anim.v b/round_win_anim.v new file mode 100644 index 0000000..1f18eb5 --- /dev/null +++ b/round_win_anim.v @@ -0,0 +1,42 @@ +module round_win_anim(input clk, next, reset, output light1, light2, light3, light4, light5, light6, light7, light8, done); + + reg [3:0] state, nState; + + initial begin + state <= 4'b0000; + end + + always @ (negedge clk) begin + + state <= nState; + + end + + always @ (*) begin + + if (~reset) begin + if (state == 4'b1111) + nState = 4'b1111; + else + if (next) + nState = state + 4'b0001; + else + nState = state; + end + else begin + nState = 4'b0000; + end + end + + assign light1 = state[0]; + assign light2 = ~state[0]; + assign light3 = state[0]; + assign light4 = ~state[0]; + assign light5 = state[0]; + assign light6 = ~state[0]; + assign light7 = state[0]; + assign light8 = ~state[0]; + + assign done = (state == 4'b1111); + +endmodule diff --git a/sequence_generator.v b/sequence_generator.v new file mode 100644 index 0000000..0bdbd70 --- /dev/null +++ b/sequence_generator.v @@ -0,0 +1,30 @@ +// This module generates the "random" sequences for the simon game. +// This module uses a perpetually running LFSR for seeding the sequence generator. +// If randomize is high this module will use the current LFSR value as the seed. +// Effectively this results in choosing a new random sequence. +// If start_over is high this module moves to the start of the random sequence. +// If next is high this module moves to the next element of the sequence. +// seq outputs the current element of the sequence using a one-hot encoding. +module sequence_generator ( + input clk, + input randomize, + input next, + input start_over, + output [7:0] seq +); + reg [17:0] counter = 18'b100110101011010111; + reg [17:0] seed; + reg [17:0] current; + + assign seq = 8'b1 << current[2:0]; + + always @(posedge clk) begin + counter <= {counter[15:0], counter[17:16] ^ counter[10:9]}; + if (randomize) + seed <= counter; + if (start_over) + current <= seed; + else if (next) + current <= {current[15:0], current[17:16] ^ current[10:9]}; + end +endmodule diff --git a/variable_delay.v b/variable_delay.v new file mode 100644 index 0000000..3ce30de --- /dev/null +++ b/variable_delay.v @@ -0,0 +1,77 @@ +// This module is used for creating delays +// reset will reset this module +// fast pulse will go high for one clock cycle 0.2 seconds after a reset +// slow pulse will go high for one clock cycle 0.75 seconds after a reset +// NOTE: Every time this module is reset the time before getting will also +// be reset. So if reset is constantly held high you will never get +// either pulse. +module variable_delay ( + input clk, + input reset, + input [4:0] variable_pulse_index, + output variable_pulse +); + reg [31:0] counter = 32'd0; + reg [31:0] variable_pulse_num; + + //assign variable_pulse_num = 32'd24000000 - (32'd2000000 * variable_pulse_index); + + assign variable_pulse = (counter == variable_pulse_num); + + initial begin + counter <= 32'd0; + //variable_pulse_num <= 32'd10; + variable_pulse_num <= 32'd32000000; + end + + always @ (negedge clk) begin + + if (reset) + counter <= 32'd0; + else + counter <= counter + 32'd1; + + end + + always @ (posedge clk) begin + case (variable_pulse_index) + 5'b00000: variable_pulse_num <= 32'd32000000; + 5'b00001: variable_pulse_num <= 32'd31000000; + 5'b00010: variable_pulse_num <= 32'd30000000; + 5'b00011: variable_pulse_num <= 32'd29000000; + 5'b00100: variable_pulse_num <= 32'd28000000; + 5'b00101: variable_pulse_num <= 32'd27000000; + 5'b00110: variable_pulse_num <= 32'd26000000; + 5'b00111: variable_pulse_num <= 32'd25000000; + 5'b01000: variable_pulse_num <= 32'd24000000; + 5'b01001: variable_pulse_num <= 32'd23000000; + 5'b01010: variable_pulse_num <= 32'd22000000; + 5'b01011: variable_pulse_num <= 32'd21000000; + 5'b01100: variable_pulse_num <= 32'd20000000; + 5'b01101: variable_pulse_num <= 32'd19000000; + 5'b01110: variable_pulse_num <= 32'd18000000; + 5'b01111: variable_pulse_num <= 32'd17000000; + 5'b10000: variable_pulse_num <= 32'd16000000; + 5'b10001: variable_pulse_num <= 32'd15000000; + 5'b10010: variable_pulse_num <= 32'd14000000; + 5'b10011: variable_pulse_num <= 32'd13000000; + 5'b10100: variable_pulse_num <= 32'd12000000; + 5'b10101: variable_pulse_num <= 32'd11000000; + 5'b10110: variable_pulse_num <= 32'd10000000; + 5'b10111: variable_pulse_num <= 32'd9000000; + 5'b11000: variable_pulse_num <= 32'd8000000; + 5'b11001: variable_pulse_num <= 32'd7000000; + 5'b11010: variable_pulse_num <= 32'd6000000; + 5'b11011: variable_pulse_num <= 32'd5000000; + 5'b11100: variable_pulse_num <= 32'd4000000; + 5'b11101: variable_pulse_num <= 32'd3000000; + 5'b11110: variable_pulse_num <= 32'd2000000; + 5'b11111: variable_pulse_num <= 32'd1000000; + endcase + +// if (reset) +// counter <= 32'd0; +// +// counter <= counter + 32'd1; + end +endmodule |
