+/EE316

digital logic

git clone https://git.julia.blue/+/EE316

Joseph RyanUpload whole semester91885ad

master
628 B30 linesraw
1`timescale 1ns / 1ps
2
3module call_system(
4    input wire clk,
5    input wire call_button,
6    input wire cancel_button,
7    output reg light_state
8    );
9    
10    reg next_state;
11    
12always @(*) begin
13    case ({call_button, cancel_button, light_state})
14    3'b000: next_state = 1'b0;
15    3'b001: next_state = 1'b1;
16    3'b010: next_state = 1'b0;
17    3'b011: next_state = 1'b0;
18    3'b100: next_state = 1'b1;
19    3'b101: next_state = 1'b1;
20    3'b110: next_state = 1'b1;
21    3'b111: next_state = 1'b1;
22    default: next_state = 1'b0;
23    endcase
24end
25
26always @( posedge clk ) begin
27    light_state <= next_state;
28end
29
30endmodule