origen_sim 0.20.6 → 0.21.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 +4 -4
- data/config/commands.rb +27 -1
- data/config/shared_commands.rb +9 -2
- data/config/version.rb +2 -2
- data/ext/bridge.c +27 -13
- data/ext/common.h +1 -0
- data/ext/defines.h.erb +3 -0
- data/lib/origen_sim/commands/build.rb +191 -92
- data/lib/origen_sim/origen/pins/pin.rb +4 -4
- data/lib/origen_sim/origen/top_level.rb +17 -8
- data/lib/origen_sim/origen_testers/api.rb +1 -1
- data/lib/origen_sim/simulator.rb +129 -21
- data/lib/origen_sim/tester.rb +61 -25
- data/lib/origen_sim.rb +13 -0
- data/lib/origen_sim_dev/dut.rb +4 -0
- data/pattern/test.rb +9 -2
- data/templates/origen_guides/simulation/patterns.md.erb +8 -0
- data/templates/probe.tcl.erb +1 -2
- data/templates/rtl_v/origen.v.erb +104 -34
- metadata +5 -6
@@ -1,4 +1,53 @@
|
|
1
|
-
|
1
|
+
// This is an auto-generated file from OrigenSim
|
2
|
+
// (https://origen-sdk.org/origen/guides/simulation/introduction/)
|
3
|
+
// This file was generated with this command:
|
4
|
+
// <%= options[:build_cmd] %>
|
5
|
+
|
6
|
+
% pins_by_type = [[nil]]
|
7
|
+
% type = nil
|
8
|
+
% dut.rtl_pins.each do |n, p|
|
9
|
+
% if p.type == type
|
10
|
+
% pins_by_type.last << p
|
11
|
+
% else
|
12
|
+
% pins_by_type << [p.type, p]
|
13
|
+
% type = p.type
|
14
|
+
% end
|
15
|
+
% end
|
16
|
+
|
17
|
+
// Utility Macros
|
18
|
+
// Cast define value as a string.
|
19
|
+
`define ORIGEN_SIM_TO_S(s) `"s`"
|
20
|
+
|
21
|
+
// Indicate the target vendor
|
22
|
+
% if options[:vendor] == :cadence
|
23
|
+
`define ORIGEN_SIM_CADENCE
|
24
|
+
% elsif options[:vendor] == :synopsis
|
25
|
+
`define ORIGEN_SIM_SYNOPSIS
|
26
|
+
% elsif options[:vendor] == :icarus
|
27
|
+
`define ORIGEN_SIM_ICARUS
|
28
|
+
% end
|
29
|
+
|
30
|
+
// Indicate the file type, without resorting to System Verilog or vendor-specific functions
|
31
|
+
% if options[:file_type] == :sv
|
32
|
+
`define ORIGEN_SV_FILE
|
33
|
+
% elsif options[:file_type] == :vams
|
34
|
+
`define ORIGEN_VAMS_FILE
|
35
|
+
% else
|
36
|
+
`define ORIGEN_V_FILE
|
37
|
+
% end
|
38
|
+
|
39
|
+
`ifdef ORIGEN_WREAL
|
40
|
+
`define ORIGEN_USE_REAL
|
41
|
+
`define ORIGEN_REAL_TYPE wreal
|
42
|
+
`elsif ORIGEN_WREALAVG
|
43
|
+
`define ORIGEN_USE_REAL
|
44
|
+
`define ORIGEN_REAL_TYPE wrealavg
|
45
|
+
`ifdef ORIGEN_SIM_CADENCE
|
46
|
+
import cds_rnm_pkg::*;
|
47
|
+
`elsif ORIGEN_SIM_SYNOPSIS
|
48
|
+
import snps_msv_nettype_pkg::*;
|
49
|
+
`endif
|
50
|
+
`endif
|
2
51
|
|
3
52
|
// To create the big fonts - http://patorjk.com/software/taag/#p=display&f=Big
|
4
53
|
|
@@ -103,7 +152,7 @@ module pin_driver(pin, sync);
|
|
103
152
|
endmodule
|
104
153
|
|
105
154
|
|
106
|
-
`ifdef
|
155
|
+
`ifdef ORIGEN_USE_REAL
|
107
156
|
// _ _____ _ _____ _
|
108
157
|
// /\ | | | __ (_) | __ \ (_)
|
109
158
|
// / \ _ __ __ _| | ___ __ _ | |__) | _ __ | | | |_ __ ___ _____ _ __
|
@@ -113,13 +162,13 @@ endmodule
|
|
113
162
|
// __/ |
|
114
163
|
// |___/
|
115
164
|
|
116
|
-
// A simple WREAL pin driver that can drive real value on a pin or else hi-Z, when the driver is in
|
165
|
+
// A simple WREAL/WREALAVG pin driver that can drive real value on a pin or else hi-Z, when the driver is in
|
117
166
|
// hi-Z mode the value applied by any other driver connected to the pin can be measured by peeking
|
118
167
|
// the value on pin
|
119
168
|
module ana_pin_driver(pin);
|
120
169
|
inout pin;
|
121
170
|
|
122
|
-
|
171
|
+
`ORIGEN_REAL_TYPE pin;
|
123
172
|
|
124
173
|
reg drive_en = 0;
|
125
174
|
real drive = 0.0; // Value that will be driven on pin when drive is enabled
|
@@ -140,36 +189,52 @@ endmodule
|
|
140
189
|
// drivers are therefore accessible via origen.pins.my_pin_name
|
141
190
|
module pin_drivers(<%= dut.rtl_pins.map { |n, p, o| "#{p.id}_o" }.join(', ') %>);
|
142
191
|
|
143
|
-
%
|
144
|
-
% if
|
145
|
-
`ifdef
|
192
|
+
% pins_by_type.each do |group|
|
193
|
+
% if group.first == :analog
|
194
|
+
`ifdef ORIGEN_USE_REAL
|
195
|
+
% group[1..-1].each do |pin|
|
146
196
|
inout <%= pin.id %>_o;
|
197
|
+
% end
|
147
198
|
`else
|
199
|
+
% group[1..-1].each do |pin|
|
148
200
|
output <%= pin.id %>_o;
|
201
|
+
% end
|
149
202
|
`endif
|
150
203
|
% else
|
204
|
+
% group[1..-1].each do |pin|
|
151
205
|
output <%= pin.id %>_o;
|
206
|
+
% end
|
152
207
|
% end
|
153
208
|
% end
|
154
209
|
|
155
|
-
`ifdef
|
210
|
+
`ifdef ORIGEN_USE_REAL
|
156
211
|
% dut.rtl_pins(type: :analog).each do |name, pin, options|
|
157
|
-
|
212
|
+
`ORIGEN_REAL_TYPE <%= pin.id %>_o;
|
158
213
|
% end
|
159
214
|
`endif
|
160
215
|
|
161
216
|
reg sync = 0;
|
162
217
|
|
163
|
-
%
|
164
|
-
%
|
165
|
-
|
166
|
-
|
218
|
+
% pins_by_type.each do |group|
|
219
|
+
% if group.first == :analog
|
220
|
+
`ifdef ORIGEN_USE_REAL
|
221
|
+
% group[1..-1].each do |pin|
|
222
|
+
% unless pin.meta[:origen_sim_init_pin_state] == -2
|
167
223
|
ana_pin_driver <%= pin.id %>(.pin(<%= pin.id %>_o));
|
224
|
+
% end
|
225
|
+
% end
|
168
226
|
`else
|
227
|
+
% group[1..-1].each do |pin|
|
228
|
+
% unless pin.meta[:origen_sim_init_pin_state] == -2
|
169
229
|
pin_driver #(<%= pin.meta[:origen_sim_init_pin_state].nil? ? '' : ".init_drive(#{pin.meta[:origen_sim_init_pin_state]}), "%>.pin_name("<%= pin.id %>")) <%= pin.id %>(.pin(<%= pin.id %>_o), .sync(sync));
|
230
|
+
% end
|
231
|
+
% end
|
170
232
|
`endif
|
171
|
-
%
|
233
|
+
% else
|
234
|
+
% group[1..-1].each do |pin|
|
235
|
+
% unless pin.meta[:origen_sim_init_pin_state] == -2
|
172
236
|
pin_driver #(<%= pin.meta[:origen_sim_init_pin_state].nil? ? '' : ".init_drive(#{pin.meta[:origen_sim_init_pin_state]}), "%>.pin_name("<%= pin.id %>")) <%= pin.id %>(.pin(<%= pin.id %>_o), .sync(sync));
|
237
|
+
% end
|
173
238
|
% end
|
174
239
|
% end
|
175
240
|
% end
|
@@ -224,7 +289,7 @@ endmodule
|
|
224
289
|
|
225
290
|
// Instantiated as origen.debug, this module contains the error count, current pattern name and comments,
|
226
291
|
// metadata associated with the snapshot build, and other debug information
|
227
|
-
module
|
292
|
+
module <%= options[:debug_module_name] %>;
|
228
293
|
reg [31:0] errors = 0;
|
229
294
|
reg [15:0] marker = 0;
|
230
295
|
reg [31:0] match_errors = 0;
|
@@ -238,10 +303,16 @@ module debug;
|
|
238
303
|
|
239
304
|
snapshot_details snapshot_details();
|
240
305
|
|
241
|
-
`ifdef
|
242
|
-
reg
|
306
|
+
`ifdef ORIGEN_USE_REAL
|
307
|
+
reg real_enabled = 1;
|
308
|
+
`ifdef ORIGEN_SV_FILE
|
309
|
+
reg [1023:0] real_type = `ORIGEN_SIM_TO_S(`ORIGEN_REAL_TYPE`);
|
310
|
+
`else
|
311
|
+
reg [1023:0] real_type = "wreal";
|
312
|
+
`endif
|
243
313
|
`else
|
244
|
-
reg
|
314
|
+
reg real_enabled = 0;
|
315
|
+
reg [1023:0] real_type = 0;
|
245
316
|
`endif
|
246
317
|
|
247
318
|
endmodule
|
@@ -255,19 +326,25 @@ endmodule
|
|
255
326
|
// | |
|
256
327
|
// |_|
|
257
328
|
|
258
|
-
module
|
329
|
+
module <%= options[:testbench] %>;
|
259
330
|
|
260
|
-
reg
|
331
|
+
reg <%= options[:finish_signal] %> = 0;
|
261
332
|
|
262
|
-
%
|
263
|
-
% if
|
264
|
-
`ifdef
|
265
|
-
|
333
|
+
% pins_by_type.each do |group|
|
334
|
+
% if group.first == :analog
|
335
|
+
`ifdef ORIGEN_USE_REAL
|
336
|
+
% group[1..-1].each do |pin|
|
337
|
+
`ORIGEN_REAL_TYPE <%= pin.id %>;
|
338
|
+
% end
|
266
339
|
`else
|
340
|
+
% group[1..-1].each do |pin|
|
267
341
|
wire <%= pin.id %>;
|
342
|
+
% end
|
268
343
|
`endif
|
269
344
|
% else
|
345
|
+
% group[1..-1].each do |pin|
|
270
346
|
wire <%= pin.id %>;
|
347
|
+
% end
|
271
348
|
% end
|
272
349
|
% end
|
273
350
|
|
@@ -278,13 +355,7 @@ module origen;
|
|
278
355
|
);
|
279
356
|
|
280
357
|
// Instantiate the DUT
|
281
|
-
<%= options[:top].sub(/\..*/, '') %>
|
282
|
-
% dut.power_pins.each do |name, pin, options|
|
283
|
-
.<%= pin.id %>(<%= pin.id %>),
|
284
|
-
% end
|
285
|
-
% dut.ground_pins.each do |name, pin, options|
|
286
|
-
.<%= pin.id %>(<%= pin.id %>),
|
287
|
-
% end
|
358
|
+
<%= options[:top].sub(/\..*/, '') %> <%= options[:top_level_name] %> (
|
288
359
|
% # Keep track of the primary groups seen.
|
289
360
|
% seen_groups = []
|
290
361
|
% dut.rtl_pins.each_with_index do |(name, pin, options), i|
|
@@ -303,7 +374,7 @@ module origen;
|
|
303
374
|
% end
|
304
375
|
);
|
305
376
|
|
306
|
-
|
377
|
+
<%= options[:debug_module_name] %> <%= options[:debug_module_name] %> ();
|
307
378
|
|
308
379
|
initial
|
309
380
|
begin
|
@@ -319,12 +390,11 @@ module origen;
|
|
319
390
|
$vcdplusmemon;
|
320
391
|
`endif
|
321
392
|
`ifdef ORIGEN_FSDB
|
322
|
-
$fsdbDumpfile("origen.fsdb");
|
323
393
|
$fsdbDumpvars(0, "+all");
|
324
394
|
`endif
|
325
395
|
end
|
326
396
|
|
327
|
-
always @(posedge
|
397
|
+
always @(posedge <%= options[:finish_signal] %>) begin
|
328
398
|
$finish(2);
|
329
399
|
end
|
330
400
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: origen_sim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen McGinty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.6.
|
47
|
+
version: 0.6.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.6.
|
54
|
+
version: 0.6.3
|
55
55
|
description:
|
56
56
|
email:
|
57
57
|
- stephen.f.mcginty@gmail.com
|
@@ -147,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: 1.8.11
|
149
149
|
requirements: []
|
150
|
-
|
151
|
-
rubygems_version: 2.7.7
|
150
|
+
rubygems_version: 3.1.6
|
152
151
|
signing_key:
|
153
152
|
specification_version: 4
|
154
153
|
summary: Plugin that provides a testbench environment to simulate Origen test patterns
|