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

Target vs. Environment for snapshots #22

Closed coreyeng closed 5 years ago

coreyeng commented 6 years ago

Hello,

I'm looking for a bit guidance for how I would organize the following:

I have a single application that support two different, call them teams: a typical SoC team and a dedicated block team. I have two targets that will perform some custom startup, and pick a target compilation toolchain, based on the targets. I have two targets: soc.rb, and block.rb. The default.rb target points to the soc.rb target.

However, all of these targets use the same simulation snapshot. Is this the correct usage of targets? How does that fit into OrigenSim expecting the target name? Should some support be added to have multiple targets point to the same snapshot?

To go a bit further, I'm also building two snapshots: a RTL and an AMS snapshot. This seems like like it would be more of an environment: sim_rtl vs. sim_ams, supporting the same targets.

Is the organization correct here? Would RTL vs. AMS be a target setting? Should OrigenSim support the setup outlined here?

ginty commented 6 years ago

I think having all simulator setups in environment/sim.rb works well and is a convention that we should embrace, I've said this is the way to do it in the new docs btw - https://origen-sdk.org/origen/guides/simulation/environment/

The multiple targets sharing the same simulator setup doesn't feel like we are fighting Origen, so its probably the right way to do it, and I would personally just handle this at app-level rather than add a specific API for it:

# environment/sim.rb

case Origen.target.name

when "soc", "block"
  OrigenSim.cadence do |sim|
    # Configuration of Cadence simulator to be used for both targets here
  end

when "some_other_target"
  # ...

Obviously you don't need the case statement at all if your app will only ever support these two targets and they will share a common simulator config.

How to nicely select RTL vs AMS sim though is another question....hmm.

I think the right way to do it today, would be to add another environment, environment/sim_ams.rb, but it does feel like that is too much duplication and we are missing another selector somewhere.

What about adding the concept of environment and target options?

So that within environment/sim.rb you could just say if options[:ams]...

Such options would be passed from the command line, something like:

origen g my_pattern -eopts ams
coreyeng commented 6 years ago

Thanks! I actually hadn't seen that case selector before. I'll give that a try for target selection. I thought that the paths within the application were based on targets though.

I was thinking AMS as an environment as I could see us kinda of 'going into AMS mode' once we've got the digital doing the right thing. I'll look more into the snapshot selection. Last I looked it, I remember seeing it dependent on target and vendor, with no way to select based on environment.

I'll give this a try. May have jumped the gun on opening an issue.