origen_sim 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/config/application.rb +17 -2
- data/config/shared_commands.rb +7 -0
- data/config/version.rb +1 -1
- data/ext/bridge.c +13 -3
- data/lib/origen_sim.rb +10 -0
- data/lib/origen_sim/artifacts.rb +101 -0
- data/lib/origen_sim/commands/build.rb +41 -9
- data/lib/origen_sim/heartbeat.rb +13 -1
- data/lib/origen_sim/origen_testers/api.rb +90 -7
- data/lib/origen_sim/simulation.rb +49 -4
- data/lib/origen_sim/simulator.rb +171 -19
- data/lib/origen_sim/stderr_reader.rb +19 -13
- data/lib/origen_sim/stdout_reader.rb +22 -16
- data/lib/origen_sim/tester.rb +110 -1
- data/lib/origen_sim_dev/dut.rb +5 -0
- data/pattern/test.rb +143 -0
- data/templates/empty.gtkw +19 -1
- data/templates/empty.rc +86 -0
- data/templates/empty.svcf +79 -9
- data/templates/empty.tcl +37 -9
- data/templates/origen_guides/simulation/app.md.erb +131 -0
- data/templates/origen_guides/simulation/artifacts.md.erb +115 -0
- data/templates/origen_guides/simulation/compiling.md.erb +190 -0
- data/templates/origen_guides/simulation/debugging.md.erb +135 -0
- data/templates/origen_guides/simulation/environment.md.erb +217 -0
- data/templates/origen_guides/simulation/flows.md.erb +69 -0
- data/templates/origen_guides/simulation/howitworks.md.erb +64 -0
- data/templates/origen_guides/simulation/introduction.md.erb +35 -0
- data/templates/origen_guides/simulation/log.md.erb +118 -0
- data/templates/origen_guides/simulation/patterns.md.erb +193 -0
- data/templates/probe.tcl.erb +3 -0
- data/templates/rtl_v/origen.v.erb +19 -3
- data/templates/web/layouts/_guides.html.erb +15 -0
- metadata +18 -5
data/templates/empty.tcl
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
# TopLevel.1
|
8
8
|
# TopLevel.2
|
9
9
|
# Source.1: origen.dut
|
10
|
-
# Wave.1:
|
11
|
-
# Group count =
|
10
|
+
# Wave.1: 12 signals
|
11
|
+
# Group count = 3
|
12
12
|
# Group Debug signal count = 3
|
13
13
|
# Group DUT signal count = 0
|
14
14
|
# End_DVE_Session_Save_Info
|
@@ -69,7 +69,7 @@ if {![gui_exist_window -window TopLevel.1]} {
|
|
69
69
|
} else {
|
70
70
|
set TopLevel.1 TopLevel.1
|
71
71
|
}
|
72
|
-
gui_show_window -window ${TopLevel.1} -show_state normal -rect {{
|
72
|
+
gui_show_window -window ${TopLevel.1} -show_state normal -rect {{529 678} {2226 1843}}
|
73
73
|
|
74
74
|
# ToolBar settings
|
75
75
|
gui_set_toolbar_attributes -toolbar {TimeOperations} -dock_state top
|
@@ -149,7 +149,7 @@ if {![gui_exist_window -window TopLevel.2]} {
|
|
149
149
|
} else {
|
150
150
|
set TopLevel.2 TopLevel.2
|
151
151
|
}
|
152
|
-
gui_show_window -window ${TopLevel.2} -show_state normal -rect {{
|
152
|
+
gui_show_window -window ${TopLevel.2} -show_state normal -rect {{297 146} {2368 1196}}
|
153
153
|
|
154
154
|
# ToolBar settings
|
155
155
|
gui_set_toolbar_attributes -toolbar {TimeOperations} -dock_state top
|
@@ -241,15 +241,42 @@ set _session_group_1 Debug
|
|
241
241
|
gui_sg_create "$_session_group_1"
|
242
242
|
set Debug "$_session_group_1"
|
243
243
|
|
244
|
-
gui_sg_addsignal -group "$_session_group_1" { origen.debug.pattern origen.debug.
|
244
|
+
gui_sg_addsignal -group "$_session_group_1" { origen.debug.pattern origen.debug.errors }
|
245
245
|
gui_set_radix -radix {ascii} -signals {V1:origen.debug.pattern}
|
246
246
|
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.pattern}
|
247
|
-
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments}
|
248
|
-
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments}
|
249
247
|
|
250
|
-
set _session_group_2
|
248
|
+
set _session_group_2 $_session_group_1|
|
249
|
+
append _session_group_2 Comments
|
251
250
|
gui_sg_create "$_session_group_2"
|
252
|
-
set
|
251
|
+
set Debug|Comments "$_session_group_2"
|
252
|
+
|
253
|
+
gui_sg_addsignal -group "$_session_group_2" { origen.debug.comments0 origen.debug.comments1 origen.debug.comments2 origen.debug.comments3 origen.debug.comments4 origen.debug.comments5 origen.debug.comments6 origen.debug.comments7 origen.debug.comments8 origen.debug.comments9 }
|
254
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments0}
|
255
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments0}
|
256
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments1}
|
257
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments1}
|
258
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments2}
|
259
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments2}
|
260
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments3}
|
261
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments3}
|
262
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments4}
|
263
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments4}
|
264
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments5}
|
265
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments5}
|
266
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments6}
|
267
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments6}
|
268
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments7}
|
269
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments7}
|
270
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments8}
|
271
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments8}
|
272
|
+
gui_set_radix -radix {ascii} -signals {V1:origen.debug.comments9}
|
273
|
+
gui_set_radix -radix {unsigned} -signals {V1:origen.debug.comments9}
|
274
|
+
|
275
|
+
gui_sg_move "$_session_group_2" -after "$_session_group_1" -pos 1
|
276
|
+
|
277
|
+
set _session_group_3 DUT
|
278
|
+
gui_sg_create "$_session_group_3"
|
279
|
+
set DUT "$_session_group_3"
|
253
280
|
|
254
281
|
|
255
282
|
# Global: Highlighting
|
@@ -317,6 +344,7 @@ gui_list_create_group_when_add -wave -disable
|
|
317
344
|
gui_marker_set_ref -id ${Wave.1} C1
|
318
345
|
gui_wv_zoom_timerange -id ${Wave.1} 0 353973502
|
319
346
|
gui_list_add_group -id ${Wave.1} -after {New Group} {Debug}
|
347
|
+
gui_list_add_group -id ${Wave.1} -after {origen.debug.pattern[1023:0]} {Debug|Comments}
|
320
348
|
gui_list_add_group -id ${Wave.1} -after {New Group} {DUT}
|
321
349
|
gui_seek_criteria -id ${Wave.1} {Any Edge}
|
322
350
|
|
@@ -0,0 +1,131 @@
|
|
1
|
+
% render "layouts/guides.html" do
|
2
|
+
|
3
|
+
Generally speaking, an Origen application setup is the same whether you are generating
|
4
|
+
a pattern/flow for the ATE or if you wish to simulate it.
|
5
|
+
|
6
|
+
Therefore, the rest of the guides are applicable for how to setup a [model](<%= path "guides/models/introduction" %>) and a
|
7
|
+
[controller](<%= path "guides/controllers/introduction" %>) for your DUT,
|
8
|
+
and how to create a [pattern](<%= path "guides/patterns/introduction" %>).
|
9
|
+
|
10
|
+
However, there are still a few simulation-specific points that are worth noting to help
|
11
|
+
make your application simulation-ready.
|
12
|
+
|
13
|
+
#### Pin Definitions
|
14
|
+
|
15
|
+
To simulate, you will at the very least need a model that corresponds to your DUT and which
|
16
|
+
defines the pins that you want to wiggle.
|
17
|
+
|
18
|
+
It is not necessary to define all the pins of your DUT in the model, but for those that you do
|
19
|
+
define the IDs should match up between the model and the top-level Verilog module for your
|
20
|
+
DUT.
|
21
|
+
|
22
|
+
The easiest way to achieve this is to define your model's pins by importing the pins that were
|
23
|
+
extracted from the design (using `sim:build` as described in the
|
24
|
+
[Compiling the DUT section](<%= path "guides/simulation/compiling" %>)).
|
25
|
+
|
26
|
+
This will guarantee that your model exactly matches the design, and if you want
|
27
|
+
to use different pin names in the ATE patterns you can define these as aliases and add a
|
28
|
+
[`pin_pattern_order` statement](<%= path "guides/pattern/pins/#Controlling_the_Pattern_Pin_Order" %>)
|
29
|
+
to choose the alias instead of the h/ware names:
|
30
|
+
|
31
|
+
~~~ruby
|
32
|
+
module MyApp
|
33
|
+
class MyDUT
|
34
|
+
include Origen::TopLevel
|
35
|
+
|
36
|
+
def initialize(options = {})
|
37
|
+
import 'my_dut', dir: "#{Origen.root!}/vendor/pins", namespace: nil
|
38
|
+
|
39
|
+
# Add aliases if you want to use different names in your application and in ATE patterns
|
40
|
+
add_pin_alias :resetn, :reset_neg_async
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
~~~
|
45
|
+
|
46
|
+
Alternatively, if you already have your pins defined manually in the application and you need to
|
47
|
+
reconcile these with what they are called in the design, then you can add the `rtl_name` attribute
|
48
|
+
to your definition:
|
49
|
+
|
50
|
+
~~~ruby
|
51
|
+
add_pin :resetn, rtl_name: :reset_neg_async
|
52
|
+
~~~
|
53
|
+
|
54
|
+
Once you have your pins defined, you can immediately create a pattern and simulate it
|
55
|
+
to see if you can see the pins wiggling!
|
56
|
+
|
57
|
+
~~~ruby
|
58
|
+
# pattern/sign_of_life.rb
|
59
|
+
|
60
|
+
Pattern.create do
|
61
|
+
10.times do
|
62
|
+
dut.pin(:my_pin).drive!(1)
|
63
|
+
dut.pin(:my_pin).drive!(0)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
~~~
|
67
|
+
|
68
|
+
To simulate it:
|
69
|
+
|
70
|
+
~~~text
|
71
|
+
origen g sign_of_life -e environment/sim.rb
|
72
|
+
~~~
|
73
|
+
|
74
|
+
#### Simulation Startup
|
75
|
+
|
76
|
+
When simulating a pattern, the same [startup callback](<%= path "guides/misc/callbacks/#Pattern_Generation" %>)
|
77
|
+
(that you might use to implement a mode entry or other setup sequence) will be called as it would
|
78
|
+
when you are generating for an ATE.
|
79
|
+
|
80
|
+
However, sometimes you may need to do some additional setup in simulation, for example to drive
|
81
|
+
some power pins that would be handled by a power supply on an ATE - i.e. they are not normally
|
82
|
+
cared about in the pattern.
|
83
|
+
|
84
|
+
A simulation-specific callback exists for this purpose, this will be called immediately upon a
|
85
|
+
simulation starting and before the pattern or flow creation gets underway - i.e. it will be
|
86
|
+
called before the regular `startup` callback.
|
87
|
+
|
88
|
+
~~~ruby
|
89
|
+
def simulation_startup
|
90
|
+
# Drive these power pins to 1, these are not included in the ATE patterns and will be handled
|
91
|
+
# be a power supply on the tester
|
92
|
+
pin(:vdd).drive(1)
|
93
|
+
pin(:vddc).drive(1)
|
94
|
+
pin(:vss).drive(0)
|
95
|
+
end
|
96
|
+
~~~
|
97
|
+
|
98
|
+
**Note that if multiple patterns are being generated back-back in a single simulation, then the
|
99
|
+
`simulation_startup` will only be called once at the very start of the simulation. In contrast,
|
100
|
+
the `startup` method will be called at the start of every individual pattern within the simulation.**
|
101
|
+
|
102
|
+
#### Simulation Specific Code
|
103
|
+
|
104
|
+
Any simulation-specific code in your application can be gated as shown below:
|
105
|
+
|
106
|
+
~~~ruby
|
107
|
+
if tester.sim?
|
108
|
+
# Only executed when simulating
|
109
|
+
end
|
110
|
+
~~~
|
111
|
+
|
112
|
+
#### Starting the Simulator in an Interactive Session
|
113
|
+
|
114
|
+
When in an interactive session (`origen i`) the simulator can be started by typing
|
115
|
+
`tester.start`.
|
116
|
+
|
117
|
+
If you want this to happen automatically every time you start an interactive session when
|
118
|
+
the simulation environment is selected, add this to the [interactive startup callback](<%= path "guides/misc/callbacks/#interactive_startup" %>):
|
119
|
+
|
120
|
+
~~~ruby
|
121
|
+
def interactive_startup
|
122
|
+
# Always start the simulator immediately if I open an interactive session with the
|
123
|
+
# simulation environment selected
|
124
|
+
tester.start if tester.sim?
|
125
|
+
end
|
126
|
+
~~~
|
127
|
+
|
128
|
+
See [the debugging guide](<%= path "guides/simulation/debugging" %>) for details about APIs
|
129
|
+
that are useful when interacting with your DUT in a live ad-hoc simulation from the console.
|
130
|
+
|
131
|
+
% end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
% render "layouts/guides.html" do
|
2
|
+
|
3
|
+
When OrigenSim runs, it will change the current directory to run the simulator. This is not necessarily the
|
4
|
+
same directory that the compiled snapshot resides in and will most likely break relative paths compiled into the
|
5
|
+
snapshot.
|
6
|
+
|
7
|
+
OrigenSim provides an <code>artifacts</code> API to handle this problem. <code>Artifacts</code> are just files or
|
8
|
+
directories that need to be available in the run directory prior to the simulation start. This can be used to
|
9
|
+
reconstruct the run directory regardless of vendor or target configurations, and without requiring you to build in the
|
10
|
+
logic into the application itself.
|
11
|
+
|
12
|
+
OrigenSim will automatically look for artifacts in the directory <code>#{Origen.app.root}/simulation/application/artifacts</code>.
|
13
|
+
Anything in the this folder will be moved to the run directory and placed in <code>application/artifacts</code> just before the
|
14
|
+
simulation process starts. These artifacts will be populated across targets. You can override an artifact with one
|
15
|
+
specific to your target by placing an artifact with the same name in <code>simulation/TARGET/artifacts</code>.
|
16
|
+
|
17
|
+
For example, if I have an artifact <code>simulation/application/artifacts/startup.sv</code> that I need for
|
18
|
+
three targets, <code>rtl</code>, <code>part_analog</code>, and <code>all_analog</code>, this same artifact will be used
|
19
|
+
whenever any of those targets are used. Then, consider I have a new target <code>gate</code>, which has a different
|
20
|
+
<code>startup.sv</code> to run. By placing this at <code>simulation/gate/artifacts/startup.sv</code>, OrigenSim
|
21
|
+
will replace the artifact in <code>simulation/application/artifacts</code> with this one, in the same run directory.
|
22
|
+
|
23
|
+
Warning: Default artifacts only go a single level deep. Directories placed at <code>simulation/TARGET/artifacts</code>
|
24
|
+
will override an entire directory at <code>application/artifacts</code>. If you need more
|
25
|
+
control over the artifacts, you can see further down in this guide for manually adding artifacts.
|
26
|
+
|
27
|
+
OrigenSim provides two further customizations to the default setup. Like the target directory, you can pass additional
|
28
|
+
<code>user_artifact_dirs</code>, which will override any artifacts found at either the default or target artifact levels.
|
29
|
+
These artifacts will override each other in the order of the Array definition.
|
30
|
+
|
31
|
+
All of these artifacts have different sources, but they are placed in the same <code>artifact_run_dir</code>, which
|
32
|
+
defaults to <code>application/artifacts</code>. This location is customizable as well with the <code>artifact_run_dir</code>
|
33
|
+
option.
|
34
|
+
|
35
|
+
~~~ruby
|
36
|
+
OrigenSim::cadence do |sim|
|
37
|
+
# Add a user artifact directory
|
38
|
+
sim.user_artifact_dirs ["#{Origen.app.root}/simulation/testbench"]
|
39
|
+
|
40
|
+
# Change the artifact target location, within the context of the run directory.
|
41
|
+
# NOTE: this is relative to the run directory. This expands to /path/to/run/dir/testbench
|
42
|
+
sim.artifact_run_dir "./testbench"
|
43
|
+
end
|
44
|
+
~~~
|
45
|
+
|
46
|
+
Note here that the <code>artifact_run_dir</code> is <b>implicitly relative</b> to the
|
47
|
+
run directory. Relative paths are expanded in the context of the run directory, <b>not</b> relative to
|
48
|
+
the current script location.
|
49
|
+
|
50
|
+
Artifacts can be populated either by symlinks or by copying the contents directly. By default, Linux will symlink the
|
51
|
+
contents and unlink to clean them. However, due to the elevated priveledges required by later Windows systems to symlink objects,
|
52
|
+
the default behavior for Windows is to just copy files. This does mean that larger, and/or a large number, of artifacts
|
53
|
+
may take longer. This behavior can be changed however:
|
54
|
+
|
55
|
+
~~~ruby
|
56
|
+
OrigenSim::cadence do |sim|
|
57
|
+
# Force all artifacts to be copied
|
58
|
+
artifact_populate_method :copy
|
59
|
+
|
60
|
+
# Force all artifacts to be symlinked
|
61
|
+
artifact_populate_method :symlink
|
62
|
+
end
|
63
|
+
~~~
|
64
|
+
|
65
|
+
OrigemSim's artifacts can be queried, populated, or cleaned, directly by accessing the <code>OrigenSim.artifact</code>
|
66
|
+
object (note: the exclusion of the <i>s</i>). Some methods also exist to retrieve and list the current artifacts:
|
67
|
+
|
68
|
+
~~~ruby
|
69
|
+
# Populate all the artifacts
|
70
|
+
tester.simulator.artifact.populate
|
71
|
+
|
72
|
+
# Clean the currently populated artifacts
|
73
|
+
tester.simulator.artifact.clean
|
74
|
+
|
75
|
+
# List the current artifact names
|
76
|
+
tester.simulator.list_artifacts
|
77
|
+
|
78
|
+
# Retrieve the current artifact instances (as a Hash whose keys are the names returned above)
|
79
|
+
tester.simulator.artifacts
|
80
|
+
|
81
|
+
# Retrieve a single artifact
|
82
|
+
tester.simulator.artifacts[my_artifact]
|
83
|
+
tester.simulator.artifact[my_artifact]
|
84
|
+
~~~
|
85
|
+
|
86
|
+
The <code>OrigenSim::Artifacts</code> class inherits from
|
87
|
+
[Origen::Componentable](http://origen-sdk.org/origen/guides/models/componentable/#The_Parent_Class),
|
88
|
+
so any of the <i>componentable</i> methods are available.
|
89
|
+
|
90
|
+
Additional single-artifact items can be added manually:
|
91
|
+
|
92
|
+
~~~ruby
|
93
|
+
# in environment/sim.rb
|
94
|
+
|
95
|
+
tester = OrigenSim::cadence do |sim|
|
96
|
+
end
|
97
|
+
|
98
|
+
tester.simulator.artifact(:my_artifact) do |a|
|
99
|
+
# Point to a custom target
|
100
|
+
a.target "/path/to/my/artifact.mine"
|
101
|
+
|
102
|
+
# Point to a custom run target
|
103
|
+
# Recall this will expand to /path/to/run/dir/custom_artifacts
|
104
|
+
# This ultimately places the artifact at /path/to/run/dir/custom_artifacts/artifact.mine
|
105
|
+
a.run_target "./custom_artifacts"
|
106
|
+
|
107
|
+
# Indicate this artifact should be copied, regardlesss of global/OS settings.
|
108
|
+
a.populate_method :copy
|
109
|
+
end
|
110
|
+
~~~
|
111
|
+
|
112
|
+
Note that this takes place <b>outside</b> of the initial tester instantiation, but can still occur in the environment
|
113
|
+
file.
|
114
|
+
|
115
|
+
% end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
% render "layouts/guides.html" do
|
2
|
+
|
3
|
+
The details of how to build a given IP or SoC design can be complicated and can vary significantly
|
4
|
+
from case to case; it is something that is best managed by the design or verification team for
|
5
|
+
a given design under test (DUT).
|
6
|
+
|
7
|
+
Therefore, OrigenSim does not attempt to manage the simulation build process but instead provides
|
8
|
+
components that should be integrated into the target DUT's existing design build flow in order to
|
9
|
+
produce an output that is compatible with OrigenSim.
|
10
|
+
|
11
|
+
#### High-Level Flow
|
12
|
+
|
13
|
+
The high-level flow that we are aiming for here is as follows:
|
14
|
+
|
15
|
+
1. The design flow owner runs an Origen command to create the Origen components, the top-level Verilog
|
16
|
+
is supplied as an input to this command and this will be used to create a DUT-specific Origen testbench
|
17
|
+
2. The design flow owner incorporates these components into their build flow and executes it, stopping
|
18
|
+
after elaboration to create the Origen simulation object
|
19
|
+
3. The design flow owner delivers the Origen simulation object to the Origen flow owner (e.g. the test engineer)
|
20
|
+
4. The Origen flow owner integrates this simulation object into an Origen application
|
21
|
+
|
22
|
+
This process should be repeated from step 1 anytime either of the following occur:
|
23
|
+
|
24
|
+
* Changes are made to the top-level pin interface of the DUT
|
25
|
+
* A new version of OrigenSim is available with some new features that need to be compiled into the DUT
|
26
|
+
|
27
|
+
The process should be repeated from step 2 anytime:
|
28
|
+
|
29
|
+
* Changes have been made to the internal operation of the DUT (design changes) and you wish to be included
|
30
|
+
in Origen simulations
|
31
|
+
|
32
|
+
|
33
|
+
#### Creating the Origen Components
|
34
|
+
|
35
|
+
The OrigenSim plugin provides a command called `sim:build` to create the Origen components that should
|
36
|
+
be incorporated into the design build process.
|
37
|
+
|
38
|
+
To check if this is available, run the `origen` command outside of an application workspace, you should
|
39
|
+
see something like this:
|
40
|
+
|
41
|
+
~~~text
|
42
|
+
> origen
|
43
|
+
|
44
|
+
Usage: origen COMMAND [ARGS]
|
45
|
+
|
46
|
+
The following commands are available:
|
47
|
+
new Create a new Origen application or plugin. "origen new my_app" creates a
|
48
|
+
new origen application workspace in "./my_app"
|
49
|
+
interactive Start an interactive Origen console (short-cut alias: "i"), this is just
|
50
|
+
IRB with the 'origen' lib loaded automatically
|
51
|
+
|
52
|
+
The following global commands are provided by plugins:
|
53
|
+
sim:build Build an Origen testbench and simulator extension for a given design
|
54
|
+
|
55
|
+
Many commands can be run with -h (or --help) for more information.
|
56
|
+
~~~
|
57
|
+
|
58
|
+
Note the `sim:build` command is noted as being provided by a plugin at the bottom. If you don't see that
|
59
|
+
then it means that OrigenSim needs to be installed into your global Ruby, if you have the required admin
|
60
|
+
rights you can do this by simply executing:
|
61
|
+
|
62
|
+
~~~text
|
63
|
+
gem install origen_sim
|
64
|
+
~~~
|
65
|
+
|
66
|
+
If you don't have the required permission then speak to your system administrator to have them do this.
|
67
|
+
More detailed information on how to manage your globally available plugins like this can be found in
|
68
|
+
the [advanced guide on how Origen is invoked](<%= path "guides/advanced/invocations" %>).
|
69
|
+
|
70
|
+
If the `origen` command does not work at all, then first refer
|
71
|
+
to [the guide on how to install Origen](<%= path "guides/starting/installing" %>).
|
72
|
+
|
73
|
+
Once you have verified that you have the `sim:build` command available, execute it by supplying the
|
74
|
+
path to your top-level Verilog file like this:
|
75
|
+
|
76
|
+
~~~text
|
77
|
+
origen sim:build path/to/my_top_level.v
|
78
|
+
~~~
|
79
|
+
|
80
|
+
**It is highly recommended that you supply a stub model here, all that Origen needs to know about is the
|
81
|
+
top-level pin interface and reducing the amount of superfluous design code will reduce the chance
|
82
|
+
of parse errors during this step.**
|
83
|
+
|
84
|
+
Multiple files can be passed in, for example to include a defines file:
|
85
|
+
|
86
|
+
~~~text
|
87
|
+
origen sim:build path/to/my_defines.v path/to/my_top_level.v
|
88
|
+
~~~
|
89
|
+
|
90
|
+
If you prefer, it also works by supplying the source file directory path(s) separately:
|
91
|
+
|
92
|
+
~~~text
|
93
|
+
origen sim:build my_defines.v my_top_level.v -s path/to
|
94
|
+
~~~
|
95
|
+
|
96
|
+
The `sim:build` command does have some rudimentary support for evaluating and applying Verilog compiler
|
97
|
+
directive rules, though at the time of writing it does not evaluate Verilog parameters.
|
98
|
+
|
99
|
+
If you find that it does choke on your design files please do enter a ticket describing the code
|
100
|
+
which failed to parse here - <https://github.com/Origen-SDK/origen_verilog/issues>
|
101
|
+
|
102
|
+
In most cases any parse issues can be resolved by moving to a stub model or by simply removing the
|
103
|
+
offending code to create a partial stub.
|
104
|
+
|
105
|
+
Once you see a message like this, you are ready to move onto the next step:
|
106
|
+
|
107
|
+
~~~text
|
108
|
+
-----------------------------------------------------------
|
109
|
+
|
110
|
+
Testbench and VPI extension created!
|
111
|
+
|
112
|
+
This file can be imported into an Origen top-level DUT model to define the pins:
|
113
|
+
|
114
|
+
/path/to/origen/my_top_level.rb
|
115
|
+
|
116
|
+
See above for what to do now to create an Origen-enabled simulation object for your particular simulator.
|
117
|
+
|
118
|
+
~~~
|
119
|
+
|
120
|
+
#### Building the Design
|
121
|
+
|
122
|
+
We need to start from a command which can compile and elaborate the DUT only, so any 3rd party testbench
|
123
|
+
should be removed from the build process before we go any further.
|
124
|
+
|
125
|
+
The output from the previous step contains compiler-specific instructions on what files and switches
|
126
|
+
should be added to your build command, here for example for Cadence:
|
127
|
+
|
128
|
+
|
129
|
+
~~~text
|
130
|
+
-----------------------------------------------------------
|
131
|
+
Cadence (irun)
|
132
|
+
-----------------------------------------------------------
|
133
|
+
|
134
|
+
Add the following to your build script to create an Origen-enabled simulation object (AND REMOVE ANY OTHER TESTBENCH!):
|
135
|
+
|
136
|
+
/path/to/my/origen/origen.v \
|
137
|
+
/path/to/my/origen/*.c \
|
138
|
+
-ccargs "-std=c99" \
|
139
|
+
-top origen \
|
140
|
+
-elaborate \
|
141
|
+
-snapshot origen \
|
142
|
+
-access +rw \
|
143
|
+
-timescale 1ns/1ns
|
144
|
+
|
145
|
+
The following files should then be used for Origen integration:
|
146
|
+
|
147
|
+
/home/nxa21353/Code/my_origen/origen/my_design_top.rb
|
148
|
+
INCA_libs/ (created by irun)
|
149
|
+
~~~
|
150
|
+
|
151
|
+
At the time of writing Cadence, Synopsys and Icarus Verilog simulators are supported.
|
152
|
+
|
153
|
+
Simply add the files and switches as instructed to your baseline build command and it should then create
|
154
|
+
a snapshot of your design that is ready to talk to Origen.
|
155
|
+
|
156
|
+
The compiler-specific notes also mention what files should be given to the Origen application integrator, in
|
157
|
+
this case for Cadence the `INCA_libs` directory and an Origen file that defines the DUT's pins.
|
158
|
+
|
159
|
+
Once you are in possession of these files, you are ready for the final step:
|
160
|
+
|
161
|
+
|
162
|
+
#### Integrating the Simulation Object
|
163
|
+
|
164
|
+
One of the generated components from the `sim:build` command is an Origen file that defines the DUT's pins. If you wish to use this
|
165
|
+
in your model (optional, you can define them in the model by hand or any other way you like), then check it
|
166
|
+
into your application's `vendor` directory and import it within your model's `initialize` method like this:
|
167
|
+
|
168
|
+
~~~ruby
|
169
|
+
# Import pin definitions as extracted from the design
|
170
|
+
import 'my_top_level', dir: "#{Origen.root!}/vendor/wherever/i/like", namespace: nil
|
171
|
+
~~~
|
172
|
+
|
173
|
+
Note that `'my_top_level'` corresponds to the name of the file.
|
174
|
+
|
175
|
+
Your application should already have a target setup that corresponds to this DUT, if not create one.
|
176
|
+
|
177
|
+
The copy the compiled design files into `simulation/TARGET/SIMULATOR/.`, where `TARGET` is the name
|
178
|
+
of the target, e.g. `my_dut` and `SIMULATOR` is either `cadence`, `synopsys` or `icarus`.
|
179
|
+
|
180
|
+
For example, the `INCA_libs` directory in this Cadence example might be copied to `simulation/my_dut/cadence/INCA_libs`.
|
181
|
+
|
182
|
+
You can check these simulation files into your application's revision control system, but since they can be very large binaries
|
183
|
+
it is recommended that you add the `simulation` directory to your `.gitignore` and use an alternative revision control
|
184
|
+
tool like DesignSync to store them.
|
185
|
+
|
186
|
+
This will be further discussed in the environment setup, which is the [next section](<%= path "guides/simulation/environment" %>)
|
187
|
+
of this guide to simulation...
|
188
|
+
|
189
|
+
|
190
|
+
% end
|