[myhdl-list] Strange behaviour in traceSignals()
Brought to you by:
jandecaluwe
From: David K. <dav...@in...> - 2011-12-22 13:31:56
|
I am puzzled by traceSignals() generating 'Inconsistent hierarchy' messages with the following code, but not if badBehaviour is False. Note that the print at line 32 gives the same structure in both cases, so its something I don't understand in the introspection. I wanted to structure a collection of tests using a common library, and this (bad) behaviour gets in the way of a natural expression of reuse. Example: #!/usr/bin/python # example of strange behaviour in traceSignals() badBehaviour = True from myhdl import * def ClkDriver(clk, halfperiod=5): halfPeriod = delay(halfperiod) @always(halfPeriod) def driveClk(): clk.next = 1 & ~clk return driveClk def device_test(clk1, cd1): clk2 = Signal(0) cd2 = ClkDriver(clk2, halfperiod=3759) # in picoseconds to give 7.5ns(133MHz) cycle if badBehaviour: return (cd2,) else: return cd1, cd2 def test(): # make a clock generator clk1 = Signal(0) cd1 = ClkDriver(clk1, halfperiod=3759) # in picoseconds to give 7.5ns(133MHz) cycle if badBehaviour: ret = (cd1,) + device_test(clk1, cd1) else: ret = device_test(clk1, cd1) print ret return ret def process(timesteps): # wrap in a tracer for vcd output tr_out = traceSignals(test) # simulate sim = Simulation(tr_out) sim.run(timesteps) if __name__ == '__main__': timesteps = 1000 process(timesteps) Dave Kitchen |