15. Verilog HDL을 이용한 7-seg display Decoder 구현
반응형
Verilog HDL을 이용하여 7-seg Decoder를 구현해보자.

방법1: Schematic Entry Implementation
각 Display에 대한 회로를 그대로 코드에 옮겨적는 방법이다.
out6 = /in3*/in2*/in1 + in3*in2*/in1*/in0 + /in3*in2*in1*in0 out5 = /in3*/in2*in0 ...
코드가 굉장히 복잡하고 길어지게 된다.
방법2: Verilog의 게이트 활용
and AND1 (A, nin[3], nin[2], nin[1]); and AND2 (B, nin[3], in[2], in[1], in[0]); and AND3 (C, in[3], in[2], nin[1], nin[0]); or OR1 (out[6], A, B, C);
이 방법 역시 코드가 길고 복잡해진다.
방법3: 진행형 할당 활용
assign out[6] = ~in[3]&~in[2]&~in[1] | in[3]&in[2]&in[1]&~in[0] | ~in[3]&in[2]&in[1]&in[0];
방법 2와 같은 원리지만, OR, AND 연산자를 활용하여 한층 더 간단해졌다.
module hex_to_7seg (out, in):; output [6:0] out; input [3:0] in; assign out[6] = ~~~ assign out[5] = ~~~ ~~~ endmodule
방법4: Behavoural Abstraction
이 방법은 Truth Table을 그대로 코드에 매핑하는 방법이다.
reg [6:0] out; //out을 변수화 always @ (in) case (in) 4'h0: out = 7'b1000000; 4'h1: out = 7'b1111001; 4'h2: out = 7'b0100100; // 중략 4'hf: out = 7'b0001110; endcase
입력이 4-bit hex이며 각 값에 대해, out을 7-bit binary의 대응하는 값으로 매핑해준다.
반응형
'학부 수업 > 디지털시스템' 카테고리의 다른 글
17. Verilog HDL로 순차회로 설계하기 (Sequential Circuit) (0) | 2020.05.23 |
---|---|
16. Verilog HDL의 산술 연산과 Incomplete Specification (0) | 2020.05.23 |
14. 하드웨어 기술 언어와 Verilog HDL(Hardware Description Language: HDL) (0) | 2020.05.22 |
13. 멀티플렉서와 디멀티플렉서 (Multiplexer and Demultiplexer) (0) | 2020.05.16 |
12. 인코더 (Encoder) (0) | 2020.05.15 |
댓글
이 글 공유하기
다른 글
-
17. Verilog HDL로 순차회로 설계하기 (Sequential Circuit)
17. Verilog HDL로 순차회로 설계하기 (Sequential Circuit)
2020.05.23 -
16. Verilog HDL의 산술 연산과 Incomplete Specification
16. Verilog HDL의 산술 연산과 Incomplete Specification
2020.05.23 -
14. 하드웨어 기술 언어와 Verilog HDL(Hardware Description Language: HDL)
14. 하드웨어 기술 언어와 Verilog HDL(Hardware Description Language: HDL)
2020.05.22 -
13. 멀티플렉서와 디멀티플렉서 (Multiplexer and Demultiplexer)
13. 멀티플렉서와 디멀티플렉서 (Multiplexer and Demultiplexer)
2020.05.16
댓글을 사용할 수 없습니다.