m-labs / migen

A Python toolbox for building complex digital hardware
https://m-labs.hk/migen
Other
1.18k stars 212 forks source link

Migen Simulation ClockDomainsRenamer renaming error #28

Closed cr1901 closed 8 years ago

cr1901 commented 8 years ago

Any attempt to define a clock domain manually in a Migen source file that uses a simulation will cause simulations to fail. Migen decorates the clk and rst signals with a trailing number, either in the top level simulation module or the DUT module, but does not decorate the clk and rst signals in the other module with the same trailing number. This causes undefined references in simulators such as iverilog.

Migen should recognize in the context of simulations that the clk and rst signals in both the DUT and top level modules are in fact the same signal defined twice.

This bug is demonstrated in the following gist: https://gist.github.com/cr1901/8fb5298fe9982456b9d4

A workaround for the time being is to conditionally define clock domains to be defined depending on whether the user wants to simulate the module, or use the module as part of synthesis (e.g. if __name__ == "__main__").

sbourdeauducq commented 8 years ago

Not an issue in the new simulator.