일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Synthesis
- C-Gate
- 비동기회로
- binary code
- parallel_case
- 마크다운 적용
- synopsys
- muller-C
- DC
- systemverilog type
- C Element
- Verification
- verilog
- SECDEC
- SECDED
- gray conversion
- created_clock
- HDL
- hdl compiler
- SystemVerilog
- code conversion
- binary conversion
- directive
- dc directive
- Asynchronous
- full_case
- generated_clock
- Design Compiler
- gray code
- DesignCompiler
- Today
- Total
KimB - Designer
[Synopsys DC directives] parallel_case 본문
Verilog에서 case 문의 합성
verilog에는 C/C++의 switch~case 와 유사한 case ~ endcase를 지원합니다.
Function적으로는 문제 될 것이 없지만, 합성시에는 case 내의 모든 조건 비교 회로를 가정하는 logic이 추가됩니다.
module ex_case(output reg [3:0] z, input [3:0] en);
always@(*)
begin
z = 4'b0000;
case (en)
en[0] : z = 4'b0001; //첫번째 조건
en[1] : z = 4'b0010; //두번째 조건
en[2] : z = 4'b0100; //세번째 조건
en[3] : z = 4'b1000; //네번째 조건
endcase
end
endmodule
상기 모듈을 합성하게 되면, 두번째 조건이 실행되기 위해, 첫번째 조건의 not에 해당하는 combi-logic이 합성되게 됩니다. 즉, if~else if 구문과 동일한 logic, Priority Encoder가 됩니다.
parallel_case directive 사용시, 이러한 문제를 해결할 수 있습니다.
parallel_case 사용법
module ex_case(output reg [3:0] z, input [3:0] en);
always@(*)
begin
z = 4'b0000;
case (en) // synopsys parallel_case
en[0] : z = 4'b0001; //첫번째 조건
en[1] : z = 4'b0010; //두번째 조건
en[2] : z = 4'b0100; //세번째 조건
en[3] : z = 4'b1000; //네번째 조건
endcase
end
endmodule
case 구문에 //synopsys parallel_case라고 삽입해주면, Synopsys Design Compiler에서는 이를 progma로 사용하게 됩니다.
이 경우, 합성시 각 조건에 대해 병렬적으로 combi-logic을 생성하게 됩니다. 즉, case에 선언된 모든 조건들이 parallel하게 동작하게 됩니다.
여기서 주의할 점은 case에 사용되는 조건들은 반드시, 상호배타적(Mutually Exclusive)해야 합니다.
만약 위 예제에서 en[1]과 en[0]이 동시에 assert된다면, parallel_case에서는 두번째 조건 실행을 위해서 첫번째 조건에 대한 선행이 불필요하므로, 어떻게 동작할 지 알 수 없게 됩니다. (Synthesis 조건에 따라 다릅니다.)
Synthesis coding Styles
참고로 full_case나 parallel_case 같은 directive는 Function Level과 Gate-Level의 시뮬레이션 결과를 다르게 만들 수 있습니다.
시뮬레이터에서 사용하는 function과 다르게 Synthesis Tool에 적용하는 것은 나쁜 코딩 습관이라는 얘기가 많네요. 해당 directive의 효과를 매우 잘 알고 사용해야 할 것 같습니다.
'Synopsys-DC > Directives' 카테고리의 다른 글
[Synopsys DC directives] full_case (Evil Twins of Verilog Synthesis...) (0) | 2020.10.06 |
---|---|
HDL Compiler Synthesis directives (0) | 2020.10.03 |