Skip to content

Commit 4aeeebd

Browse files
committed
Output VCD file compliant with the standard
1 parent eea5ff4 commit 4aeeebd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pymtl3/passes/tracing/VcdGenerationPass.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def recurse_models( m, spaces ):
204204
# The first cycle VCD contains the default value
205205
bin_str = net[0]._dsl.Type().to_bits().bin()
206206

207-
print( f"b{bin_str} {net_symbol_mapping[i]}", file=vcd_file )
207+
print( f"b{bin_str[2:]} {net_symbol_mapping[i]}", file=vcd_file )
208208

209209
# Set this to be the last cycle value str
210210
last_values[i] = bin_str
@@ -221,7 +221,7 @@ def recurse_models( m, spaces ):
221221
if i != vcd_clock_net_idx ]
222222

223223
# Flip clock for the first cycle
224-
print( '\n#0\nb0b1 {}\n'.format( clock_symbol ), file=vcd_file, flush=True )
224+
print( '\n#0\n1{}\n'.format( clock_symbol ), file=vcd_file, flush=True )
225225

226226
# Returns a dump_vcd function that is ready to be appended to _sched.
227227
# TODO: type check?
@@ -249,15 +249,15 @@ def dump_vcd_inner( s ):
249249
# We store strings instead of values ...
250250
if last_values[i] != net_bits_bin_str:
251251
last_values[i] = net_bits_bin_str
252-
print( f'b{net_bits_bin_str} {symbol}', file=vcd_file )
252+
print( f'b{net_bits_bin_str[2:]} {symbol}', file=vcd_file )
253253

254254
# Flop clock at the end of cycle
255255
next_neg_edge = 100 * vcd_sim_ncycles + 50
256-
print( f'\n#{next_neg_edge}\nb0b0 {clock_symbol}', file=vcd_file )
256+
print( f'\n#{next_neg_edge}\n0{clock_symbol}', file=vcd_file )
257257

258258
# Flip clock of the next cycle
259259
next_pos_edge = next_neg_edge + 50
260-
print( f'#{next_pos_edge}\nb0b1 {clock_symbol}\n', file=vcd_file, flush=True )
260+
print( f'#{next_pos_edge}\n1{clock_symbol}\n', file=vcd_file, flush=True )
261261
vcd_sim_ncycles += 1
262262

263263
def gen_dump_vcd( s ):

0 commit comments

Comments
 (0)