Ⅰ. Case
- verilog와 동일하기 때문에 짧게만 설명하겠습니다.
- 앞에서 포스팅하였던 내용에서 unique / unique0 / priority 키워드가 나왔는데, case에도 동일하게 적용 가능합니다.
2022.10.11 - [Digital Hardware Design/System verilog] - Control - condition
+ unique-case : 하나도 매치가 안될 경우와 여러 case와 매치가 될 경우에 대해서 error report를 함
+ unique0-case : 위와 유사하나, 아무것도 매치가 안될 때에는 report를 하지 않음
+ prority-case : 조건 중에 어느 것도 매치가 안될 경우나 else에 대한 절이 없는 경우 error report를 함
ⅰ. Simulation
- 예제를 참고하여 간단한 simulation 진행.
module sverilog_case();
bit [1:0] uni_exam;
initial begin
uni_exam = 1;
$display ("unique example 1============================");
// A violation is reported here
unique case (uni_exam)
0 : $display ("Found to be 0");
2 : $display ("Found to be 2");
endcase
$display ("unique example 2============================");
uni_exam = 0;
unique case (uni_exam)
0 : $display ("Found to be 0");
0 : $display ("Again found to be 0");
2 : $display ("Found to be 2");
endcase
$display ("priority example ============================");
uni_exam = 0;
priority case (uni_exam)
0 : $display ("Found to be 0");
0 : $display ("Again found to be 0");
2 : $display ("Found to be 2");
endcase
end
endmodule
- 결과는 아래 참고하세요!
run all
unique example 1============================
WARNING: 0ns : none of the conditions were true for unique case from File:C:/999_PROJECT/sverilog_teset/sverilog_teset.srcs/sources_1/new/sverilog_case.sv:30
unique example 2============================
WARNING: 0ns : Multiple conditions true
condition at line:38 conflicts with condtion at line:37
for unique case from File:C:/999_PROJECT/sverilog_teset/sverilog_teset.srcs/sources_1/new/sverilog_case.sv:36
Found to be 0
priority example ============================
Found to be 0
'Digital Hardware Design > System verilog' 카테고리의 다른 글
Blocking & Non-Blocking (0) | 2022.10.25 |
---|---|
Control - condition (0) | 2022.10.11 |
Control - loop (0) | 2022.10.09 |
Data type(3) (0) | 2022.10.09 |
data type(2) (0) | 2022.10.03 |
댓글