cfelton / rhea

A collection of MyHDL cores and tools for complex digital circuit design
MIT License
85 stars 34 forks source link

Would be nice if Clock() type exposed 'clock ticks' to 'simulation ticks' ratio. #34

Closed NickShaffner closed 8 years ago

NickShaffner commented 8 years ago

This would be particularly useful for being able to delay a certain number of clock ticks. Adding a delay() generator method to the clock type would be another means of exposing this.

ex:

something.next = False
yield glbl.clock.delay(1)
something.next = True
cfelton commented 8 years ago

@NickShaffner this sounds reasonable, my gut says a slightly different name: wait or pause possibly, mainly to avoid confusion with myhdl.delay.

NickShaffner commented 8 years ago

@cfelton I can see that - wait() would work for me. Also about the clock ticks to simulation ticks constant - how about 'ticks'? (since _hticks is used as half ticks in the clock already).

NickShaffner commented 8 years ago

https://github.com/cfelton/rhea/pull/40 has Clock.ticks and Clock.delay. @cfelton - it made sense to me to use delay() instead of wait() in the end because it's really doing exactly the same thing as delay() does for the simulation clock. In fact, it might be cool if the simulation clock was somehow exposed as a Clock() object. (but that's the subject for another pull request :))

NickShaffner commented 8 years ago

Added in: https://github.com/cfelton/rhea/pull/40