일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
- synopsys
- Synthesis
- Design Compiler
- C Element
- gray code
- binary conversion
- code conversion
- C-Gate
- dc directive
- Asynchronous
- 비동기회로
- DesignCompiler
- systemverilog type
- DC
- gray conversion
- generated_clock
- verilog
- SECDED
- hdl compiler
- directive
- SystemVerilog
- muller-C
- full_case
- parallel_case
- 마크다운 적용
- created_clock
- Verification
- SECDEC
- HDL
- binary code
- Today
- Total
KimB - Designer
[Synopsys DC directives] full_case (Evil Twins of Verilog Synthesis...) 본문
[Synopsys DC directives] full_case (Evil Twins of Verilog Synthesis...)
KimB 2020. 10. 6. 21:35full_case
module ex_3mux(input [1:0] s, output reg y);
always @(*)
begin
case (s)
2'b00 : A Expression;
2'b01 : B Expression;
2'b10 : C Expression;
endcase
end
endmodule
상기의 Verilog Code에서 Select Signal인 s의 경우의 수는 0~3 4가지입니다. 하지만 상기 Code에서는 3가지 경우만 기술되어 있죠.
이렇게 되면, Design compiler는 기술되지 않은 경우에 대해서 이전과 동일하게 출력 결과를 유지하기 위해, Latch Logic을 자동으로 삽입하게 됩니다. (일반적으로 상기와 같이 기술해서는 안되겠죠.)
하지만, full_case directive를 사용하게 되면 기술되지 않은 경우에 대한 latch 생성을 강제로 막게 됩니다.
module ex_3mux(input [1:0] s, output reg y);
always @(*) // synopsys full_case
begin
case (s)
2'b00 : A Expression;
2'b01 : B Expression;
2'b10 : C Expression;
endcase
end
endmodule
상기 code처럼 case 구문 옆에 // synopsys full_case 라는 directive를 삽입하게 되면, latch 생성을 강제로 막게됩니다. 이는 Synopsys Design compiler에서만 사용되는 directive이므로, 다른 Tool에서는 그저 주석으로 인식하게 됩니다.
하지만, full_case는 사용하지 않는 편이 안전합니다. 차라리, full_case가 되도록 Coding하는 것이 더 안전하죠.
Evil twins of Verilog synthesis
SNUG-1999 ( Synopsys User Group )에서 소개한 Best Paper에서 full_case와 parallel_case에 대해 evil twins라고 표현하고 있습니다. 사실, full_case와 parallel_case를 정확한 이해없이 사용하게 되면, Simulator와 합성 Tool에서 합성한 결과가 다르게 됩니다. 이는 상당히 위험하고 나쁜 코딩 습관이라고 합니다.
module ex_3mux(input [1:0] s, output reg y);
always @(*)
begin
case (s)
2'b00 : A Expression;
2'b01 : B Expression;
2'b10 : C Expression;
default : D Expression;
endcase
end
endmodule
위 Code처럼 모든 구문을 기술해준다면, Design Compiler는 해당 case를 자동으로 full_case로 구성하게 됩니다. Parallel_case 같은 경우도 code를 잘 기술해주면, 자동으로 구성하게 되죠. 상기의 best paper에서 해당 내용이 상세히 나와 있습니다. 저도 제대로 정독해 봐야 할 것 같습니다.
'Synopsys-DC > Directives' 카테고리의 다른 글
[Synopsys DC directives] parallel_case (0) | 2020.10.04 |
---|---|
HDL Compiler Synthesis directives (0) | 2020.10.03 |