Origen-SDK / origen_sim

Plugin to enable Origen patterns to be run in a dynamic Verilog simulation
MIT License
1 stars 4 forks source link

Cadence simulations running out of tmp/ #18

Closed coreyeng closed 6 years ago

coreyeng commented 6 years ago

Hello,

What are the reasons for running cadence simulations out of tmp/origen_sim/target/cadence, as opposed to just running it out of simulation/target/cadence? Is it just due to the amount of collateral Cadence generates? I believe we can adjust the irun command to place logs and use tcl scripts from tmp to keep the simulation directory cleaner.

For one of my test benches, I have several files that I need to reference at run time (several initial blocks get run). Its messy and error prone to define these as ../../../../simulation/... and then it can be dependent on the target. These paths are compiled into the design itself, so the paths are hard-coded and no Origen.app.root.

I compiled with just ./ at first, and if I move my static files into tmp/origen_sim/... it works alright, but I either need a build script to move everything there (probably during the checkout), or I need to move where Cadence invokes the simulations from.

I think the cleanest thing to do would either be to provide a method for static files to move into the Cadence environment (that is, have OrigenSim do it instead of a user function) or change the irun command to run out of simulation/... Any opinions on this? I noticed that both Icarus and Synopsis run out of simulation. Should we change Cadence to match? Or do we need to run Cadence there for it to work at all?

Here is the part that sets the run_dir: https://github.com/Origen-SDK/origen_sim/blob/master/lib/origen_sim/simulator.rb#L336-L347

Though, that said, should all of these try to run out of the same place? Should Cadence run out of the wave_dir instead?

ginty commented 6 years ago

I think it runs from there because it generates output files that we mostly don't care about, e.g. irun.history, irun.log, etc.

The contents of simulation/target/cadence are intended to be checked in, so running from there is not ideal since you then need to manage/think about how these transient files are handled by the revision control system. Maybe in practice that is not really an issue because we tend to commit that dir via DesignSync rather than Git, but at least that was the thought process behind running it in a place where the transient files would naturally be ignored.

There used to be the concept of a config option called :artifacts which worked along the lines of what you are looking for here, however that was a simulation model compile-time concept and it was dropped when we moved the building of the simulation model out of Origen. You can see it in here - https://github.com/Origen-SDK/origen_sim/blob/711ca2c33d17b3792380e46eb609d7f9e33f3a21/lib/origen_sim/simulator.rb

Maybe we should re-introduce that and it would copy such files over to the run dir at simulation time.

However, I'm not saying that I couldn't be persuaded to change the run dir if that makes more sense now based on how we actually use this.

coreyeng commented 6 years ago

Thanks! I think for now I'll reinstate the artifacts then. Seems the safest since the user doesn't need to know anything about where the simulations are run from: just list the artifacts and they'll end up wherever the simulation is run from, regardless of vendor, target, etc. I'll go that route.

coreyeng commented 6 years ago

Added in #20