Gotchas
- 모듈을 먼저 read_file/analyze 한 후 테스트벤치 작성 — 포트를 추측하지 말 것
- 모든 reg 초기화 필수 (clk=0, reset=1) — 미초기화 시 X 전파
- race condition 방지: stimulus는
@(negedge clk)또는#1지연 후 변경 - 무한 대기 방지: fork/join_any + timeout 패턴 사용
- compile: VCS →
vcs -full64 -sverilog -o sim tb.sv dut.svthen./sim; iverilog fallback →iverilog -g2012 -Wall -o sim tb.v dut.vthenvvp sim - self-checking testbench 권장: expected vs actual 비교
Workflow
- read_file(module) → 포트/신호 파악
- generate_module_testbench(path, tb_type) 또는 직접 작성
- 시뮬레이터 컴파일 → 실행 (VCS 기본, iverilog fallback — simulation.md 참조)
- 에러 시 read_lines → replace_in_file → 재컴파일
References (read when needed)
| Situation | File |
|---|---|
| TB patterns (basic, AXI, self-checking) | patterns.md |
| Compilation & simulation commands | simulation.md |