Generate Valid In, Valid Out with HDL Coder - Best practice?

8 visualizaciones (últimos 30 días)
TS
TS el 20 de Nov. de 2017
Comentada: Ludo Visser el 7 de Ag. de 2018
I am using Matlab HDL Coder to generate VHDL Code and want to add a "valid in/out" Port to my subsystems to ensure the timing in sequential operations on a macro level.
Valid in: Triggers the calculation of the subsystem with the current values of the subsytem input ports
Valid out: Signals (e.g. with an rising edge) that the calculation of the subsystem is finished
I have tinkered with several idears:
- Enabled subsystem with a state machine outside of the subsystem to control if the output values have changed
- A parallel path inside the subsystem which just routes the valid in directly to valid out - a rising edge is sourced when the calculation is started -> with "balenced delays" the valid out signal (should) rise when the calculation is ready
- some minor variations of the above / unsucessful approches
So , what is best practice when implementing a valid in / out control for a HDL Subsytem?

Respuestas (1)

Ludo Visser
Ludo Visser el 7 de Ag. de 2018
I typically follow your second suggestion. I used enabled subsystems to split up the computations into blocks that can either be done in a single clock cycle (like addition, logic, etc.) or that require a predictable number of pipeline registers (e.g. multiplication). In this way, I can manage the results of the delay balancing feature (which I really dislike, but that's another discussion).
A typical subsystem looks like this:
You can see the "input valid" to "output valid" line in the top and the data line directly below it.
As you can see, I'm generous with unit delays, so I can predict better where the delay balancing will insert delays. In later stages, if I run into performance issues, I can optimize a bunch of them away, but typically it's not necessary in my applications.
  2 comentarios
TS
TS el 7 de Ag. de 2018
thanks for your contribution to the discussion. I pretty much kept using the second variation, which works fine for me atm.
I almost always disable balance delay on the "top level" subsystem which i generate and only use it in the underlying subsystems and "shedule" the tasks inside of the "top level" myself with enabled subsystems and an "auto-balanced-delay data line" so i know what goes on
Ludo Visser
Ludo Visser el 7 de Ag. de 2018
I also turn it off at the top level. It's annoying that HDLWA pushes this setting so hard - it generates an error if you turn it off, which you can only bypass by setting "ignore warnings", and who knows what other warnings go unseen because of that.

Iniciar sesión para comentar.

Categorías

Más información sobre Code Generation en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by