origen_sim 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/version.rb +1 -1
- data/ext/bridge.c +10 -11
- data/lib/origen_sim/commands/build.rb +1 -1
- data/lib/origen_sim/simulator.rb +15 -5
- data/lib/origen_sim/tester.rb +8 -2
- data/lib/origen_sim_dev/dut.rb +32 -8
- data/pattern/test.rb +10 -0
- data/templates/rtl_v/origen.v.erb +1 -3
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07feeaf38e2cacb8a570887c9bfc2acd38b26956
|
4
|
+
data.tar.gz: 693b70230e195a5b0fd49c586ec16f5116fe7d0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 295d5c1df56f7341fa5e60b35b902169d92d21c482a2bee4452827d84e847697975e218aa4eb86e07d10d79e0939bee3d4e2a58ede7a347c8599fb26733ac7b9
|
7
|
+
data.tar.gz: e51c858045564989fa53ce7bc281d70afc887e5312f81908e44463a303c93d0c65d5a61cb15095a12892e7d3ff4dc3002bb5565f0735a3c37284298889500f7e
|
data/config/version.rb
CHANGED
data/ext/bridge.c
CHANGED
@@ -30,7 +30,7 @@ typedef struct Pin {
|
|
30
30
|
} Pin;
|
31
31
|
|
32
32
|
typedef struct Event {
|
33
|
-
|
33
|
+
uint64_t time;
|
34
34
|
char data;
|
35
35
|
} Event;
|
36
36
|
|
@@ -62,7 +62,7 @@ static void bridge_capture_pin(char*);
|
|
62
62
|
static void bridge_stop_capture_pin(char*);
|
63
63
|
static void bridge_dont_care_pin(char*);
|
64
64
|
static void bridge_register_wave_events(void);
|
65
|
-
static void bridge_register_wave_event(int, int, int,
|
65
|
+
static void bridge_register_wave_event(int, int, int, uint64_t);
|
66
66
|
static void bridge_enable_drive_wave(Pin*);
|
67
67
|
static void bridge_disable_drive_wave(Pin*);
|
68
68
|
static void bridge_enable_compare_wave(Pin*);
|
@@ -160,7 +160,7 @@ static void bridge_register_wave_events() {
|
|
160
160
|
int x = 0;
|
161
161
|
|
162
162
|
while (drive_waves[i].events[x].data != 'T' && x < MAX_WAVE_EVENTS) {
|
163
|
-
|
163
|
+
uint64_t time;
|
164
164
|
|
165
165
|
time = drive_waves[i].events[x].time;
|
166
166
|
|
@@ -180,7 +180,7 @@ static void bridge_register_wave_events() {
|
|
180
180
|
int x = 0;
|
181
181
|
|
182
182
|
while (compare_waves[i].events[x].data != 'T' && x < MAX_WAVE_EVENTS) {
|
183
|
-
|
183
|
+
uint64_t time;
|
184
184
|
|
185
185
|
time = compare_waves[i].events[x].time;
|
186
186
|
|
@@ -260,9 +260,9 @@ static void bridge_clear_waves_and_pins() {
|
|
260
260
|
}
|
261
261
|
|
262
262
|
|
263
|
-
static void bridge_set_period(char *
|
264
|
-
|
265
|
-
period_in_ps = p
|
263
|
+
static void bridge_set_period(char * p_in_ps_str) {
|
264
|
+
uint64_t p = (uint64_t) strtol(p_in_ps_str, NULL, 10);
|
265
|
+
period_in_ps = p;
|
266
266
|
bridge_clear_waves_and_pins();
|
267
267
|
}
|
268
268
|
|
@@ -472,8 +472,7 @@ PLI_INT32 bridge_apply_wave_event_cb(p_cb_data data) {
|
|
472
472
|
|
473
473
|
|
474
474
|
/// Registers a callback to apply the given wave during this cycle
|
475
|
-
static void bridge_register_wave_event(int wave_ix, int event_ix, int compare,
|
476
|
-
uint64_t delay_in_ps = delay_in_ns * 1000;
|
475
|
+
static void bridge_register_wave_event(int wave_ix, int event_ix, int compare, uint64_t delay_in_ps) {
|
477
476
|
s_cb_data call;
|
478
477
|
s_vpi_time time;
|
479
478
|
|
@@ -565,7 +564,7 @@ PLI_INT32 bridge_wait_for_msg(p_cb_data data) {
|
|
565
564
|
bridge_define_pin(arg1, arg2, arg3, arg4);
|
566
565
|
break;
|
567
566
|
// Set Period
|
568
|
-
// 1^
|
567
|
+
// 1^100000
|
569
568
|
case '1' :
|
570
569
|
arg1 = strtok(NULL, "^");
|
571
570
|
bridge_set_period(arg1);
|
@@ -757,7 +756,7 @@ static void end_simulation() {
|
|
757
756
|
v.value.str = "1";
|
758
757
|
vpi_put_value(handle, &v, NULL, vpiNoDelay);
|
759
758
|
// Corner case during testing, the timeset may not have been set yet
|
760
|
-
bridge_set_period("
|
759
|
+
bridge_set_period("1000");
|
761
760
|
// Do a cycle so that the simulation sees the edge on origen.finish
|
762
761
|
bridge_cycle();
|
763
762
|
}
|
data/lib/origen_sim/simulator.rb
CHANGED
@@ -367,12 +367,14 @@ module OrigenSim
|
|
367
367
|
# moving onto another pattern
|
368
368
|
def pattern_generated(path)
|
369
369
|
sync_up if simulation_tester?
|
370
|
+
@simulation_completed_cleanly = true
|
370
371
|
end
|
371
372
|
|
372
373
|
# Called before every pattern is generated, but we only use it the
|
373
374
|
# first time it is called to kick off the simulator process if the
|
374
375
|
# current tester is an OrigenSim::Tester
|
375
376
|
def before_pattern(name)
|
377
|
+
@simulation_completed_cleanly = false
|
376
378
|
if simulation_tester?
|
377
379
|
unless @enabled
|
378
380
|
# When running pattern back-to-back, only want to launch the simulator the
|
@@ -438,14 +440,14 @@ module OrigenSim
|
|
438
440
|
|
439
441
|
def wave_to_str(wave)
|
440
442
|
wave.evaluated_events.map do |time, data|
|
441
|
-
time = time * (config[:time_factor] || 1)
|
443
|
+
time = time * time_conversion_factor * (config[:time_factor] || 1)
|
442
444
|
if data == :x
|
443
445
|
data = 'X'
|
444
446
|
elsif data == :data
|
445
447
|
data = wave.drive? ? 'D' : 'C'
|
446
448
|
end
|
447
449
|
if data == 'C'
|
448
|
-
"#{time}_#{data}_#{time + (config[:time_factor] || 1)}_X"
|
450
|
+
"#{time}_#{data}_#{time + (time_conversion_factor * (config[:time_factor] || 1))}_X"
|
449
451
|
else
|
450
452
|
"#{time}_#{data}"
|
451
453
|
end
|
@@ -466,8 +468,8 @@ module OrigenSim
|
|
466
468
|
end
|
467
469
|
|
468
470
|
def set_period(period_in_ns)
|
469
|
-
|
470
|
-
put("1^#{
|
471
|
+
period_in_ps = period_in_ns * time_conversion_factor * (config[:time_factor] || 1)
|
472
|
+
put("1^#{period_in_ps}")
|
471
473
|
end
|
472
474
|
|
473
475
|
def cycle(number_of_cycles)
|
@@ -536,7 +538,7 @@ module OrigenSim
|
|
536
538
|
# deal with it here to ensure cross simulator compatibility.
|
537
539
|
|
538
540
|
# http://rubular.com/r/eTVGzrYmXQ
|
539
|
-
if net =~ /(.*)\[(\d+):?(\.\.)?(\d*)\]$/
|
541
|
+
if !config[:vendor] == :synopsys && net =~ /(.*)\[(\d+):?(\.\.)?(\d*)\]$/
|
540
542
|
path = Regexp.last_match(1)
|
541
543
|
msb = Regexp.last_match(2).to_i
|
542
544
|
lsb = Regexp.last_match(4)
|
@@ -606,6 +608,9 @@ module OrigenSim
|
|
606
608
|
if c > 0
|
607
609
|
@failed = true
|
608
610
|
Origen.log.error "The simulation failed with #{c} errors!"
|
611
|
+
elsif !@simulation_completed_cleanly
|
612
|
+
@failed = true
|
613
|
+
Origen.log.error 'The simulation exited early!'
|
609
614
|
end
|
610
615
|
end
|
611
616
|
end
|
@@ -688,6 +693,11 @@ module OrigenSim
|
|
688
693
|
|
689
694
|
private
|
690
695
|
|
696
|
+
# Pre 0.8.0 the simulator represented the time in ns instead of ps
|
697
|
+
def time_conversion_factor
|
698
|
+
@time_conversion_factor ||= dut_version < '0.8.0' ? 1 : 1000
|
699
|
+
end
|
700
|
+
|
691
701
|
def clean(net)
|
692
702
|
if net =~ /^dut\./
|
693
703
|
"origen.#{net}"
|
data/lib/origen_sim/tester.rb
CHANGED
@@ -23,7 +23,13 @@ module OrigenSim
|
|
23
23
|
@sync_cycles = 0
|
24
24
|
yield
|
25
25
|
end
|
26
|
-
@sync_pins.map
|
26
|
+
@sync_pins.map do |pin|
|
27
|
+
if @sync_cycles.size == 1
|
28
|
+
simulator.peek("origen.pins.#{pin.id}.sync_memory[0]")
|
29
|
+
else
|
30
|
+
simulator.peek("origen.pins.#{pin.id}.sync_memory[#{@sync_cycles - 1}:0]")
|
31
|
+
end
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
35
|
# Start the simulator
|
@@ -100,8 +106,8 @@ module OrigenSim
|
|
100
106
|
end
|
101
107
|
end
|
102
108
|
if simulator.sync_active?
|
109
|
+
@sync_cycles += 1
|
103
110
|
pins.each do |pin|
|
104
|
-
@sync_cycles += 1
|
105
111
|
@sync_pins << pin unless @sync_pins.include?(pin)
|
106
112
|
end
|
107
113
|
end
|
data/lib/origen_sim_dev/dut.rb
CHANGED
@@ -59,6 +59,17 @@ module OrigenSimDev
|
|
59
59
|
reg.bits 5..2, :p3
|
60
60
|
reg.bits 9..6, :p4
|
61
61
|
end
|
62
|
+
|
63
|
+
# Reg for testing parallel read/sync when this one is read the data will
|
64
|
+
# be read out via dout rather than JTAG
|
65
|
+
add_reg :parallel_read, 0x18 do |reg|
|
66
|
+
reg.bits 30..28, :b1
|
67
|
+
reg.bits 26..24, :b2
|
68
|
+
reg.bits 18..16, :b3
|
69
|
+
reg.bits 14..12, :b4
|
70
|
+
reg.bits 6..4, :b5
|
71
|
+
reg.bits 2..0, :b6
|
72
|
+
end
|
62
73
|
end
|
63
74
|
|
64
75
|
def interactive_startup
|
@@ -90,14 +101,27 @@ module OrigenSimDev
|
|
90
101
|
end
|
91
102
|
|
92
103
|
def read_register(reg, options = {})
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
104
|
+
# Special read for this register to test sync'ing over a parallel
|
105
|
+
if reg.id == :parallel_read
|
106
|
+
pins = []
|
107
|
+
reg.shift_out_with_index do |bit, i|
|
108
|
+
if bit.is_to_be_stored?
|
109
|
+
pins << dut.pins(:dout)[i]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
tester.store_next_cycle(*pins.reverse)
|
113
|
+
1.cycle
|
114
|
+
dut.pins(:dout).dont_care
|
115
|
+
else
|
116
|
+
jtag.write_ir(0x8, size: 4)
|
117
|
+
dr.rg_enable.write(1)
|
118
|
+
dr.rg_read.write(1)
|
119
|
+
dr.rg_addr.write(reg.address)
|
120
|
+
jtag.write_dr(dr)
|
121
|
+
dr.rg_enable.write(0)
|
122
|
+
dr.rg_data.copy_all(reg)
|
123
|
+
jtag.read_dr(dr)
|
124
|
+
end
|
101
125
|
end
|
102
126
|
end
|
103
127
|
end
|
data/pattern/test.rb
CHANGED
@@ -60,6 +60,16 @@ Pattern.create do
|
|
60
60
|
unless dut.cmd.data == 0x2244_6688
|
61
61
|
fail "CMD register did not sync from simulation"
|
62
62
|
end
|
63
|
+
|
64
|
+
ss "Test sync of a register via a parallel interface"
|
65
|
+
dut.parallel_read.write(0)
|
66
|
+
dut.data_out.write!(0x7707_7077)
|
67
|
+
dut.pins(:dout).assert!(0x7707_7077)
|
68
|
+
dut.pins(:dout).dont_care
|
69
|
+
dut.parallel_read.sync
|
70
|
+
unless dut.parallel_read.data == 0x7707_7077
|
71
|
+
fail "PARALLEL_READ register did not sync from simulation"
|
72
|
+
end
|
63
73
|
end
|
64
74
|
|
65
75
|
ss "Do some operations with the counter, just for fun"
|
@@ -167,13 +167,11 @@ module origen;
|
|
167
167
|
begin
|
168
168
|
$vcdplusfile("origen.vpd");
|
169
169
|
$vcdpluson;
|
170
|
+
$vcdplusmemon;
|
170
171
|
end
|
171
172
|
`endif
|
172
173
|
|
173
174
|
always @(posedge finish) begin
|
174
|
-
`ifdef ORIGEN_VPD
|
175
|
-
$vcdplusoff;
|
176
|
-
`endif
|
177
175
|
//$display("********************************");
|
178
176
|
//$display("Finishing simulation...");
|
179
177
|
//$display("********************************");
|
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.8.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: 2018-
|
11
|
+
date: 2018-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.32'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.32'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: origen_testers
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|