2021年5月4日 星期二

HBLbits_Verilog Basic_Exams/2014 q3c

HBLbits_Verilog Basic_Exams/2014 q3c 

Given the state-assigned table shown below, implement the logic functions Y[0] and z.



module top_module (
    input clk,
    input [2:0] y,
    input x,
    output Y0,
    output z
);
    parameter A=3'b000,B=3'b001,C=3'b010,D=3'b011,E=3'b100; 
    reg[2:0] current_state, next_state;
    always@(*)begin
        case(current_state)
            A: next_state = x?B:A;
            B: next_state = x?E:B;
            C: next_state = x?B:C;
            D: next_state = x?C:B;
            E: next_state = x?E:D;
            default: next_state = A;
        endcase
    end
    assign Y0 = (x & y == 3'b000 || ~x & y == 3'b001 || x & y == 3'b010 || ~x & y == 3'b011 || ~x & y == 3'b100);
    assign z = (y == 3'b011 || y == 3'b100);
endmodule

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...