2021年3月22日 星期一

DE2-115 開發 以解碼器 Decodere 為例(Verilog behavioral modeling )

 DE2-115 開發 以解碼器 Decodere 為例(Verilog behavioral modeling )


//7442 one-to-ten decoder

module decoder_7442_behavioral(SW,LEDR );

input [17:0] SW;

output [17:0] LEDR;

decoder(SW[17:0],LEDR[17:0]);

endmodule

//======================

//-- decoder.v

//-- Component has an input (Din) and an output (Dout)

module decoder( Din, Dout );

    input [17:0]Din;

    output [17:0]Dout;

// Data flow modeling

reg [17:0] Dout;

// Example 1: case statement

always @(Din) begin

case(Din)

4'b0000: begin Dout=10'b11_1111_1110; end

4'b0001: begin Dout=10'b11_1111_1101; end

4'b0010: begin Dout=10'b11_1111_1011; end

4'b0011: begin Dout=10'b11_1111_0111; end

4'b0100: begin Dout=10'b11_1110_1111; end

4'b0101: begin Dout=10'b11_1101_1111; end

4'b0110: begin Dout=10'b11_1011_1111; end

4'b0111: begin Dout=10'b11_0111_1111; end

4'b1000: begin Dout=10'b10_1111_1111; end

4'b1001: begin Dout=10'b01_1111_1111; end


endcase

end

endmodule


沒有留言:

張貼留言

WOKWI ESP32 LED Control , Node-Red MQTT SQLITE  

WOKWI ESP32 LED Control ,  Node-Red  MQTT SQLITE   const char broker[] = "test.mosquitto.org" ; //const char broker[] = "br...