Closed ginty closed 5 years ago
@chrisnappi, as part of the cleanup of the bootstrapping process for VCS, I renamed the bootstrap
function to origen_init
.
I wanted to make it clearer which functions were internal use and which could be called from outside (prefixed with origen_).
I didn't think anyone actually used the bootstrap method but its since been brought to my attention that you may have used it.
If you prefer I keep the old method around for legacy compatibility just say and I can add it bank.
Thanks!
Yes, the function must be named 'bootstrap' for the ancient version of ncsim I am using on some projects. Originally the bootstrap was init() - and Corey and I added bootstrap just calling init as a work-around for this...
Yes @pderouen, no problem with reintroducing that function now that I know that bootstrap
is a required name for it.
This PR adds the following:
sim:build
peek
andpoke
to support real numbersforce
andrelease
method so that forces can now be created in Origen application codeAMS Support
OrigenSim supports analog/mixed-signal (AMS) simulations via real-number modeling (RNM), whereby top-level pins can be defined as real wire types (WREALs) and then Origen APIs can be used to drive and measure real number values from them.
By default, OrigenSim's built in simulation setups will run a digital simulation, allowing such real number inputs to be used by behavioral models within that DUT which can themselves output real numbers to be observed on the DUT's pins by Origen APIs.
The DUT could also contain full electical models which consume the real number inputs, in that case a [custom simulation configuration](<%= path "guides/simulation/environment/#Custom_Simulator_Configuration" %>) will be required to define the run command to start the simulation.
Building Support for AMS Simulation
AMS support must be added in when building the testbench, this is done by adding the
--wreal
switch to thesim:build
command:By adding this switch, any pins which are defined as
wreal
types within the given top level will be assigned an analog pin driver by the testbench rather than a digital driver which is the default.Pins can be defined as a
wreal
type either by adding thereal
type to their definition:or by adding a
wreal
wire within the module body:Here is an example which uses both approaches to declare the
vdd
andana
pins as analog pins whenever theUSE_WREAL
define is enabled:A digital testbench for this would be built via this command:
while AMS support would be added by running:
Origen Application Configuration
Within the corresponding Origen DUT model of the design, the wreal pins should be declared as either an analog, power or ground pins.
From the above example, the wreal pins could be modeled like this:
See the [Pins Guide](<%= path "guides/models/pins" %>) for more information on modeling pins in Origen.
AMS APIs
With all of the AMS configuration done, real values can now be driven and read from Origen application code during a simulation like this:
The
peek
,poke
andforce
methods from [the Simulation Only API](<%= path "guides/simulation/api" %>) are also available to manipulate real valued nets during simulation.The analog pin APIs will not work correctly when generating a pattern for an ATE and the application code is responsible for handling them safely, typically like this:
It is easy to build more complex functionality in your application code from these simple APIs, for example to ramp a vdd pin:
It is hoped that the community will contribute plugins that contain higher-level functionality like this to make such functions available off-the-shelf in the future.
Direct DUT Manipulation
A number of methods exist to directly manipulate the state of the DUT during a simulation, in all cases these methods do not re-target to the ATE because they rely on being able to directly look inside and manipulate the DUT which is not possible in the physical world.
The user is responsible for ensuring that the use of these APIs is safely handled when generating for an ATE or other non-simulation target, normally via one of these constructs:
Poke
Poking is the term commonly given to changing the value of a register or other variable, i.e. poking a new value into an existing storage element.
To use the
poke
method, supply the net path of the storage element to be changed and the value you want to change it to:The poke method can be used on real variables too, in that case a float should be given as the second argument instead of an integer to indicate to Origen that a real value net is being poked. e.g. to poke the value
1
to a real value net then supply1.0
as the value argument instead of1
.Peek
Peeking allows you to read the value of an internal register or other variable.
The value returned from the
peek
method will be an instance of [Origen::Value](<%= path "api/Origen/Value.html" %>) which can also handleX
orZ
values.Normally, if you don't care about catching
Z
orX
cases you can simply callto_i
on the value returned frompeek
, here are some examples:When peeking a real number,
X
orZ
states are not supported and a float will be returned.You must indicate to Origen that you are peeking a real value by supplying a second argument of
true
, or for convenience callingpeek_real
instead:Force
When poking the DUT, you are changing the value of a reg or other variable which provides drive. i.e. as soon as the
poke
operation is done, the responsibility for maintaining and driving the new value is down to the DUT. For this reason, you cannot just poke any net, only those which can store/drive state. In Verilog terms, you can poke a register but you can't poke a wire.With a force, the simulator provides infinite drive/storage of the forced value and this will override any drive produced in the DUT. So when you force a value on a net, that will persist there for the entire simulation regardless of what goes on in the DUT until the force is released.
The
force
method has the same arguments as thepeek
method:A force can be released by calling the
release
method and supplying the net reference: