origen_sim 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,11 +16,12 @@ module OrigenSimDev
16
16
  add_pin :trstn, reset: :drive_lo
17
17
  add_pin_alias :tclk, :tck
18
18
  add_pin :dout, size: 32
19
+ add_pin :test_bus, size: 16
19
20
  add_pin :din_port, size: 32, rtl_name: 'din', reset: :drive_lo
20
- add_pin :p1, tie_off: 0
21
- add_pin :p2, tie_off: 1
22
- add_pin :p3, size: 4, tie_off: 0
23
- add_pin :p4, size: 4, tie_off: 1
21
+ add_pin :p1, force: 0
22
+ add_pin :p2, force: 1
23
+ add_pin :p3, size: 4, force: 0
24
+ add_pin :p4, size: 4, force: 0xA
24
25
  add_pin :v1, rtl_name: 'nc'
25
26
  add_pin :v2, rtl_name: :nc
26
27
 
@@ -68,6 +69,7 @@ module OrigenSimDev
68
69
  end
69
70
 
70
71
  def startup(options = {})
72
+ # tester.simulator.log_messages = true
71
73
  tester.set_timeset('func', 100)
72
74
 
73
75
  dut.pin(:rstn).drive!(1)
@@ -34,27 +34,32 @@ Pattern.create do
34
34
  dut.cmd.write!(0x1234_5678)
35
35
  dut.cmd.read!(0x1234_5678)
36
36
 
37
- tester.simulator.poke("dut.cmd", 0x1122_3344)
38
- dut.cmd.read!(0x1122_3344)
37
+ if tester.sim?
38
+ tester.simulator.poke("dut.cmd", 0x1122_3344)
39
+ dut.cmd.read!(0x1122_3344)
40
+ end
39
41
 
40
42
  ss "Test storing a register"
41
43
  dut.cmd.write!(0x2244_6688)
42
44
  dut.cmd.store!
43
45
 
44
- capture_value = tester.simulator.peek("origen.pins.tdo.memory")
45
- unless capture_value == 0x11662244 # 0x2244_6688 reversed
46
- if capture_value
47
- fail "Captured #{capture_value.to_hex} instead of 0x11662244!"
48
- else
49
- fail "Nothing captured instead of 0x11662244!"
46
+ if tester.sim?
47
+ sim = tester.simulator
48
+ capture_value = sim.peek("origen.pins.tdo.memory").to_i
49
+ unless capture_value == 0x11662244 # 0x2244_6688 reversed
50
+ if capture_value
51
+ fail "Captured #{capture_value.to_hex} instead of 0x11662244!"
52
+ else
53
+ fail "Nothing captured instead of 0x11662244!"
54
+ end
50
55
  end
51
- end
52
56
 
53
- ss "Test sync of a register"
54
- dut.cmd.write(0) # Make Origen forget the actual value
55
- dut.cmd.sync
56
- unless dut.cmd.data == 0x2244_6688
57
- fail "CMD register did not sync from simulation"
57
+ ss "Test sync of a register"
58
+ dut.cmd.write(0) # Make Origen forget the actual value
59
+ dut.cmd.sync
60
+ unless dut.cmd.data == 0x2244_6688
61
+ fail "CMD register did not sync from simulation"
62
+ end
58
63
  end
59
64
 
60
65
  ss "Do some operations with the counter, just for fun"
@@ -76,9 +81,16 @@ Pattern.create do
76
81
  dut.pins(:dout).assert!(0x5555_AAAA)
77
82
  dut.pins(:dout).dont_care
78
83
 
79
- ss "Verify that tying off pins works"
84
+ ss "Verify that forcing pins works"
80
85
  dut.p.p1.assert!(0)
81
86
  dut.p.p2.assert!(1)
82
87
  dut.p.p3.assert!(0)
83
- dut.p.p4.assert!(0xF)
88
+ dut.p.p4.assert!(0xA)
89
+
90
+ ss "Test sim_capture"
91
+ tester.sim_capture :cmd55, :dout, :test_bus, :tdo do
92
+ dut.pins(:din_port).drive!(0x1234_5678)
93
+ dut.cmd.write!(0x55)
94
+ 60.cycles
95
+ end
84
96
  end
@@ -0,0 +1,26 @@
1
+ [*]
2
+ [*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI
3
+ [*] Thu Jan 11 09:12:49 2018
4
+ [*]
5
+ [dumpfile] "/home/stephen/Code/github/origen_sim/waves/default/origen.vcd"
6
+ [dumpfile_mtime] "Wed Jan 10 17:49:53 2018"
7
+ [dumpfile_size] 411132
8
+ [savefile] "/home/stephen/Code/github/origen_sim/templates/empty.gtkw"
9
+ [timestart] 0
10
+ [size] 2308 1127
11
+ [pos] -1 -1
12
+ *-25.716982 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
13
+ [treeopen] origen.
14
+ [treeopen] origen.debug.
15
+ [treeopen] origen.dut.
16
+ [sst_width] 225
17
+ [signals_width] 158
18
+ [sst_expanded] 1
19
+ [sst_vpaned_height] 337
20
+ @820
21
+ origen.debug.pattern[1023:0]
22
+ origen.debug.comments[1023:0]
23
+ @22
24
+ origen.debug.errors[31:0]
25
+ [pattern_trace] 1
26
+ [pattern_trace] 0
@@ -63,18 +63,14 @@ module pin_driver(error, pin, sync);
63
63
 
64
64
  endmodule
65
65
 
66
- module pin_drivers(errors, <%= dut.rtl_pins.map { |n, p, o| "#{p.id}_o" unless p.tie_off }.compact.join(', ') %>);
66
+ module pin_drivers(errors, <%= dut.rtl_pins.map { |n, p, o| "#{p.id}_o" }.join(', ') %>);
67
67
 
68
68
  % dut.rtl_pins.each do |name, pin, options|
69
- % unless pin.tie_off
70
69
  output <%= pin.id %>_o;
71
- % end
72
70
  % end
73
71
 
74
72
  % dut.rtl_pins.each do |name, pin, options|
75
- % unless pin.tie_off
76
73
  wire <%= pin.id %>_err;
77
- % end
78
74
  % end
79
75
 
80
76
  output reg [31:0] errors = 0;
@@ -83,12 +79,10 @@ module pin_drivers(errors, <%= dut.rtl_pins.map { |n, p, o| "#{p.id}_o" unless p
83
79
  always @(
84
80
 
85
81
  % dut.rtl_pins.each_with_index do |(name, pin, options), i|
86
- % unless pin.tie_off
87
- % if i == 0
82
+ % if i == 0
88
83
  posedge <%= pin.id %>_err
89
- % else
84
+ % else
90
85
  or posedge <%= pin.id %>_err
91
- % end
92
86
  % end
93
87
  % end
94
88
  ) begin
@@ -96,9 +90,7 @@ module pin_drivers(errors, <%= dut.rtl_pins.map { |n, p, o| "#{p.id}_o" unless p
96
90
  end
97
91
 
98
92
  % dut.rtl_pins.each do |name, pin, options|
99
- % unless pin.tie_off
100
93
  pin_driver <%= pin.driving? ? "#(#{pin.value}) " : '' %><%= pin.id %>(.pin(<%= pin.id %>_o), .error(<%= pin.id %>_err), .sync(sync));
101
- % end
102
94
  % end
103
95
 
104
96
  endmodule
@@ -120,68 +112,37 @@ module origen;
120
112
  reg finish = 0;
121
113
 
122
114
  % dut.rtl_pins.each do |name, pin, options|
123
- % unless pin.tie_off
124
115
  wire <%= pin.id %>;
125
- % end
126
116
  % end
127
117
 
128
118
  wire [31:0] errors;
129
119
 
130
120
  pin_drivers pins (
131
121
  % dut.rtl_pins.each_with_index do |(name, pin, options), i|
132
- % unless pin.tie_off
133
122
  .<%= pin.id %>_o(<%= pin.id %>),
134
- % end
135
123
  % end
136
124
  .errors(errors)
137
125
  );
138
126
 
139
- // Create wires to tie off DUT signals, initially this was done by hardcoded values when instantiating
140
- // below, however the simulator didn't like that if the target pin was defined as an inout
141
- % dut.rtl_pins.each do |name, pin, options|
142
- % if options[:group]
143
- % if pin.group_index == 0
144
- % if pin.primary_group.tie_off
145
- wire [<%= pin.primary_group.size - 1 %>:0] <%= pin.rtl_name %>;
146
- assign <%= pin.rtl_name %> = <%= "#{pin.primary_group.size}'b#{pin.tie_off.to_s * pin.primary_group.size}" %>;
147
- % end
148
- % end
149
- % else
150
- % if pin.tie_off
151
- wire <%= pin.rtl_name %>;
152
- assign <%= pin.rtl_name %> = 1'b<%= pin.tie_off %>;
153
- % end
154
- % end
155
- % end
156
-
157
-
158
127
  // Instantiate the DUT
159
128
  <%= options[:top].sub(/\..*/, '') %> dut (
160
129
  % dut.power_pins.each do |name, pin, options|
161
- % unless pin.tie_off
162
130
  .<%= pin.id %>(<%= pin.id %>),
163
- % end
164
131
  % end
165
132
  % dut.ground_pins.each do |name, pin, options|
166
- % unless pin.tie_off
167
133
  .<%= pin.id %>(<%= pin.id %>),
168
- % end
169
134
  % end
170
135
  % dut.rtl_pins.each_with_index do |(name, pin, options), i|
171
136
  % if options[:group]
172
137
  % if pin.group_index == 0
173
- % if pin.primary_group.tie_off
174
- .<%= pin.rtl_name %>(<%= pin.rtl_name %>)<%= i == (dut.rtl_pins.size - 1) ? '' : ',' %>
175
- % else
176
- .<%= pin.rtl_name %>({
177
- % pin.primary_group.each_with_index do |pin, i|
138
+ .<%= pin.primary_group.id %>({
139
+ % pin.primary_group.each_with_index do |pin, i|
178
140
  <%= pin.id %><%= i == (pin.primary_group.size - 1) ? '' : ',' %>
179
- % end
180
- })<%= i == (dut.rtl_pins.size - 1) ? '' : ',' %>
181
141
  % end
142
+ })<%= i == (dut.rtl_pins.size - 1) ? '' : ',' %>
182
143
  % end
183
144
  % else
184
- .<%= pin.rtl_name %>(<%= pin.tie_off ? pin.rtl_name : pin.id %>)<%= i == (dut.rtl_pins.size - 1) ? '' : ',' %>
145
+ .<%= pin.rtl_name %>(<%= pin.id %>)<%= i == (dut.rtl_pins.size - 1) ? '' : ',' %>
185
146
  % end
186
147
  % end
187
148
  );
@@ -190,13 +151,13 @@ module origen;
190
151
  .errors(errors)
191
152
  );
192
153
 
193
- % if options[:vendor] == :icarus
154
+ `ifdef ICARUS
194
155
  initial
195
156
  begin
196
- $dumpfile("dut.vcd");
157
+ $dumpfile("origen.vcd");
197
158
  $dumpvars(0,origen);
198
159
  end
199
- % end
160
+ `endif
200
161
 
201
162
  always @(posedge finish) begin
202
163
  $finish(2);
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.5.5
4
+ version: 0.6.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: 2017-12-07 00:00:00.000000000 Z
11
+ date: 2018-01-19 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.12'
19
+ version: '0.29'
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.12'
26
+ version: '0.29'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: origen_testers
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: origen_verilog
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0.3'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0.3'
41
55
  description:
42
56
  email:
43
57
  - stephen.f.mcginty@gmail.com
@@ -48,19 +62,22 @@ files:
48
62
  - config/application.rb
49
63
  - config/boot.rb
50
64
  - config/commands.rb
65
+ - config/global_commands.rb
51
66
  - config/shared_commands.rb
52
67
  - config/version.rb
53
- - ext/README.md
54
68
  - ext/bridge.c
55
69
  - ext/bridge.h
56
70
  - ext/client.c
57
71
  - ext/client.h
58
72
  - ext/common.h
73
+ - ext/defines.h.erb
59
74
  - ext/origen.c
60
75
  - ext/origen.h
61
76
  - ext/vpi_user.h
62
77
  - lib/origen_sim.rb
63
78
  - lib/origen_sim/commands/build.rb
79
+ - lib/origen_sim/commands/ci.rb
80
+ - lib/origen_sim/commands/co.rb
64
81
  - lib/origen_sim/flow.rb
65
82
  - lib/origen_sim/generator.rb
66
83
  - lib/origen_sim/origen/pins/pin.rb
@@ -72,6 +89,7 @@ files:
72
89
  - lib/tasks/origen_sim.rake
73
90
  - pattern/test.rb
74
91
  - program/p1.rb
92
+ - templates/empty.gtkw
75
93
  - templates/empty.svcf
76
94
  - templates/probe.tcl.erb
77
95
  - templates/rtl_v/origen.v.erb
@@ -98,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
116
  version: 1.8.11
99
117
  requirements: []
100
118
  rubyforge_project:
101
- rubygems_version: 2.6.7
119
+ rubygems_version: 2.6.8
102
120
  signing_key:
103
121
  specification_version: 4
104
122
  summary: Plugin that provides a testbench environment to simulate Origen test patterns
@@ -1,2 +0,0 @@
1
- This C library gets included into the Verilog testbench and controls the simulation based on instructions
2
- from Ruby.