Verilog Reperesentation of Digital Logic 3

2023. 6. 13. 17:08FPGA/Verilog

728x90
  • Multiplexer

 

진리표 / 회로도

module Multiplexer_0(
    input IN_0,
    input IN_1,
    input IN_2,
    input IN_3,
    input SEL_0,
    input SEL_1,
    output out
);
    wire NOT_0;
    wire NOT_0;
    wire AND_0, AND_1, AND_2, AND_3;
    assign NOT_0 = ~SEL_0;
    assign NOT_1 = ~SEL_1;
    
    assign AND_0 = A & NOT_1 & NOT_0;
    assign AND_1 = B & NOT_1 & SEL_0;
    assign AND_2 = C & SEL_1 & NOT_0;
    assign AND_3 = D & SEL_1 & SEL_0;
    assign OUT = AND_0 | AND_1 | AND_2 | AND_3;

endmodule

게이트레벨로 설계한 코드 

synthesis하면 위의 회로도와 같이 구성된다.

 

 

  • Demultiplexer

진리표 / 회로도

module Demultiplexer_1(
    input IN,
    input SEL_0,
    input SEL_1,
    output OUT_0,
    output OUT_1,
    output OUT_2,
    output OUT_3
);

    assign NOT_0 = ~SEL_0;
    assign NOT_1 = ~SEL_1;
    
    assign OUT_0 = IN & NOT_1 & NOT_0;
    assign OUT_1 = IN & NOT_1 & SEL_0;
    assign OUT_2 = IN & SEL_1 & NOT_0;
    assign OUT_3 = IN & SEL_1 & SEL_0;
    
endmodule

 


 

베릴로그를 이용하면 디지털로직의 회로도 게이트 연결정보를 코드 형식으로 표현가능.

-> 게이트레벨을 좀더 가독성 좋게 베릴로그 코드로 나타내는 것이 더욱 좋다.

-> 코딩한 것을 Synthesis 해주어 게이트 정보들을 추출할 수 있다. 

'FPGA > Verilog' 카테고리의 다른 글

Verilog Simulation 2  (0) 2023.06.14
Verilog Simulation 1  (0) 2023.06.14
Digital Logic 3  (0) 2023.06.13
Verilog Reperesentation of Digital Logic 2  (0) 2023.06.13
Digital Logic2  (0) 2023.06.13