본문 바로가기
728x90
반응형

HW Design/1. Verilog HDL Basic54

[Testbench] 8. 예제 풀이 1. 기본 테스트벤치에서 DUT에 inputs를 생성하는 블록은? 더보기 The stimulus block is used to generate inputs to the DUT. 2. 테스트벤치로 사용할 수 있는 빈 모듈을 만드시오. 더보기 module exercise_tb(); // code here endmodule : exercise_tb 3. 왜 named instantiation을 선호하는가? 더보기 It is easier to maintain our code as the module connections are explicitly given. 4. $display 와 $monitor의 차이점은? 더보기 The $display task runs once whenever it is called. T.. 2024. 1. 13.
[Testbench] 7. 테스트벤치 full 작성 예제를 통해 테스트벤치 작성 가능한 모든 input 조합을 전부 생성할 예정 회로 분석 2 inputs AND gate D ff 1. Create a Testbench Module 테스트벤치 코드가 들어갈 빈 모듈을 선언 테스트벤치 모듈의 이름 선언에 대해... design 이름과 비슷하게 선언 design 이름 끝에 _tb, _test 를 추가 module example_tb (); // code here endmodule : example_tb2. Instanitate the DUT 작업할 수 있는 빈 테스트벤치 모듈이 생겼다. 테스트할 design을 인스턴스화. positional instantiation보다 named instantiation이 쉽다. example_design dut ( .clo.. 2024. 1. 13.
[Testbench] 6. System Tasks verilog는 테스트벤치 작성시 도움이 되는 task와 함수가 내장되어 있음. 이를 통칭 'system tasks or system functions'라고 하며 항상 '$' 기호로 시작 $display $monitor $time $display 시뮬레이션 중 콘솔에 표시되는 메시지 출력에 사용 printf 느낌 문자열에 %를 사용하여 신호를 표시할 수도 있음. format letter도 포함해야 함. b : 2진 d : 10진 h : 16진 위 format 코드 앞에 숫자를 추가하면 자릿수 결정. // 일반 구문 $display(, ); // Example : x의 값을 다른 진수로 각각 출력 $display("x (bin) = %b, x (hex) = %h, x (decimal) = %d", x, x.. 2024. 1. 13.
[Testbench] 5. forever loop loop는 매우 중요한 함수이다. forever loop testbench 에서 사용하는 중요한 loop type 실제로 무한 loop를 만드는 것. 시뮬레이션 중 계속 실행되는 코드 섹션을 생성 forever begin // code here end 무한 루프 다른 언어에서는 피해야 하는 코드 bug 등으로 생각함. break 없는 while(1) 같은 느낌? verilog는 좀 다르다. clock 신호를 생성하기 위해서라도 한번은 씀. clock generating 신호를 지속적으로 반전 ( ~ ) forever loop로 구현 initial begin clk = 1'b0; forever begin #1 clk = ~clk; end end 2024. 1. 13.
728x90
반응형