Changes between Version 5 and Version 6 of VHDLCoding
- Timestamp:
- Apr 20, 2020, 10:46:20 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
VHDLCoding
v5 v6 20 20 === Testbench Notes === 21 21 22 Problem: how to handle a repeating clock and other synchronous signals, mixed with reading test vectors and asserting them. 22 Problem: how to handle a repeating clock and other synchronous signals, mixed with reading test vectors and asserting them. First, some suggestions on how to handle clocks. Even calculating the period is a pain in VHDL due to the weird behavior of the 'time' type. Clock and reset can be done without a process, so: 23 23 24 24 {{{ … … 27 27 constant clk_per : time := (real(1e9)/real(freq)) * 1 ns; 28 28 constant half_period : time := clk_per/2; 29 30 signal clk : std_logic := '0'; -- init needed if clock done as below 29 31 begin 30 32 clk <= not clk after half_period; … … 32 34 }}} 33 35 36 Next question: test vectors from file. One approach is to have a scheduled launch time in the vector file, in clock ticks or BcN/OrN or some other scheme. How to handle this? 37 34 38 Internet references: 35 39