origen_sim 0.20.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0dc77dd81416662c4ecff9e01c03a7ed7a01cc31d79087ec6c9340cd72e0dd7f
4
- data.tar.gz: 223d8e87547338de2ddf5061c5789b2f09c576e4acb448d666d9f4305db6acbe
3
+ metadata.gz: 00ddb2d142b91e167ae6ad4edddeb93a25aa22ce9ae57d771158329416f0f5b6
4
+ data.tar.gz: 45d794e47570c784b8815ef8c7f8cd095ae93048c27bec8dd05cedec2614e514
5
5
  SHA512:
6
- metadata.gz: f29952826fecf63d1e7c96f96ebee945a0d48685ac21771138ea7c4dca51f0c433e2ea1198c9ea76068fb28528fc3af1320131dca5fb4ef0db8527494f8a7c56
7
- data.tar.gz: 00db5869a5ebb43ae9138011ac0c36a649547fb37a9fb86f1b32bdf96588815fb4a11f78c0535b8ab258117011d001dac6030044dff266c6aaf503e5c4be1d12
6
+ metadata.gz: 44c72049e0a7c9ec50e4862db21dba4b972731afdadf79643c4fe29a11647f14071263498aad30c39e1313aa62f48b8d530c173e8e19ed9fde6a2a23cd5e0231
7
+ data.tar.gz: 18a952cad38daaf3ad78c4d2854f9f848714b26990621ae6999b3e3c7ea213b3bfb606164ee61e1da2813410ea8ba4a5871487b334da1d61347ec26dfe4cb912
data/config/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module OrigenSim
2
2
  MAJOR = 0
3
3
  MINOR = 20
4
- BUGFIX = 0
4
+ BUGFIX = 1
5
5
  DEV = nil
6
6
 
7
7
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
@@ -197,8 +197,14 @@ module OrigenSim
197
197
  # That's all status info done until the simulation process ends, start a thread
198
198
  # to wait for that in case it ends before the VPI starts
199
199
  Thread.new do
200
- @status.gets.chomp # This will block until something is received
201
- abort_connection
200
+ begin
201
+ @status.gets.chomp # This will block until something is received
202
+ rescue Exception => e
203
+ Origen.log.error "Exception occurred while processing the monitor's status!"
204
+ raise e
205
+ ensure
206
+ abort_connection
207
+ end
202
208
  end
203
209
  Origen.log.debug 'Waiting for Origen VPI to start...'
204
210
 
@@ -252,6 +258,7 @@ module OrigenSim
252
258
  File.unlink(socket_id(:stderr)) if File.exist?(socket_id(:stderr))
253
259
  File.unlink(socket_id(:stdout)) if File.exist?(socket_id(:stdout))
254
260
  File.unlink(socket_id(:status)) if File.exist?(socket_id(:status))
261
+ @opened = false
255
262
  end
256
263
 
257
264
  # Returns true if the simulation is running
@@ -14,6 +14,15 @@ module OrigenSim
14
14
  LOG_CODES = { debug: 0, info: 1, warn: 2, warning: 2, success: 3, error: 4, deprecate: 5, deprecated: 5 }
15
15
  LOG_CODES_ = { 0 => :debug, 1 => :info, 2 => :warn, 3 => :success, 4 => :error, 5 => :deprecated }
16
16
 
17
+ # Sending logs over VPI has a maximum size, some of which are collateral, leaving
18
+ # the difference for the actual message.
19
+ LOGGER_COLLATERAL_SIZE = 11
20
+ MULTIPART_LOGGER_TOKEN = '!k+!'
21
+
22
+ # These config attributes are accepted by OrigenSim, but cannot be
23
+ # 'Marshal-ed'.
24
+ NON_DATA_CONFIG_ATTRIBUTES = [:post_process_run_cmd]
25
+
17
26
  TIMESCALES = { -15 => '1fs',
18
27
  -14 => '10fs',
19
28
  -13 => '100fs',
@@ -144,7 +153,11 @@ module OrigenSim
144
153
  fail "Unknown vendor #{options[:vendor]}, valid values are: #{VENDORS.map { |v| ':' + v.to_s }.join(', ')}"
145
154
  end
146
155
  @configuration = {
147
- snapshot_details_options: {}
156
+ snapshot_details_options: {},
157
+
158
+ # The maximum message size the VPI can accept.
159
+ # Have this as a configuration parameter since this is VPI-implementation specific.
160
+ max_log_size: 1024
148
161
  }.merge(options)
149
162
  @tmp_dir = nil
150
163
 
@@ -316,7 +329,8 @@ module OrigenSim
316
329
  check_for_changes: false,
317
330
  quiet: true,
318
331
  options: { dir: wave_dir, wave_file: wave_file_basename, force: config[:force], setup: config[:setup], depth: :all },
319
- output_file_name: "#{wave_file_basename}.tcl"
332
+ output_file_name: "#{wave_file_basename}.tcl",
333
+ preserve_target: true
320
334
  end
321
335
  input_file_fast = "#{tmp_dir}/#{wave_file_basename}_fast.tcl"
322
336
  if !File.exist?(input_file_fast) || config_changed?
@@ -327,7 +341,8 @@ module OrigenSim
327
341
  check_for_changes: false,
328
342
  quiet: true,
329
343
  options: { dir: wave_dir, wave_file: wave_file_basename, force: config[:force], setup: config[:setup], depth: fast_probe_depth },
330
- output_file_name: "#{wave_file_basename}_fast.tcl"
344
+ output_file_name: "#{wave_file_basename}_fast.tcl",
345
+ preserve_target: true
331
346
  end
332
347
  save_config_signature
333
348
  wave_dir # Ensure this exists since it won't be referenced above if the input file is already generated
@@ -621,7 +636,21 @@ module OrigenSim
621
636
  if options[:from_origen_sim]
622
637
  original.call(msg, type, options)
623
638
  else
624
- log(msg, type)
639
+ # If the message would fit without the multi-line collateral, send it as normal.
640
+ # Note: this also avoids the pitfall of a message whose size is exactly
641
+ # config[:max_log_size] - LOGGER_COLLATERAL_SIZE getting stuck until
642
+ # something else is pushed.
643
+ if msg.size > config[:max_log_size] - (LOGGER_COLLATERAL_SIZE - MULTIPART_LOGGER_TOKEN.size)
644
+ msg.chars.each_slice(config[:max_log_size] - LOGGER_COLLATERAL_SIZE) do |m|
645
+ if m.size == config[:max_log_size] - LOGGER_COLLATERAL_SIZE
646
+ log(m.join + MULTIPART_LOGGER_TOKEN, type, multipart: true)
647
+ else
648
+ log(m.join, type, multipart: false)
649
+ end
650
+ end
651
+ else
652
+ log(msg, type, multipart: false)
653
+ end
625
654
  end
626
655
  end
627
656
  end
@@ -745,7 +774,7 @@ module OrigenSim
745
774
  # the simulator. This ensures that the given log messages will be in sync with output from the
746
775
  # simulator rather than potentially being ahead of the simulator if Origen were to output them
747
776
  # immediately.
748
- def log(msg, type = :info)
777
+ def log(msg, type = :info, multipart: false)
749
778
  if dut_version > '0.15.0'
750
779
  put("k^#{LOG_CODES[type]}^#{msg}")
751
780
  else
@@ -1050,13 +1079,13 @@ module OrigenSim
1050
1079
 
1051
1080
  # Returns true if the config has been changed since the last time we called save_config_signature
1052
1081
  def config_changed?
1053
- Origen.app.session.origen_sim["#{id}_config"] != config
1082
+ Origen.app.session.origen_sim["#{id}_config"] != config.except(*NON_DATA_CONFIG_ATTRIBUTES)
1054
1083
  end
1055
1084
 
1056
1085
  # Locally saves a signature for the current config, this will cause config_changed? to return false
1057
1086
  # until its contents change
1058
1087
  def save_config_signature
1059
- Origen.app.session.origen_sim["#{id}_config"] = config
1088
+ Origen.app.session.origen_sim["#{id}_config"] = config.except(*NON_DATA_CONFIG_ATTRIBUTES)
1060
1089
  end
1061
1090
 
1062
1091
  # Returns the version of Origen Sim that the current DUT object was compiled with
@@ -1167,6 +1196,14 @@ module OrigenSim
1167
1196
  get.strip.to_i
1168
1197
  end
1169
1198
 
1199
+ def running?
1200
+ if simulation
1201
+ simulation.running?
1202
+ else
1203
+ false
1204
+ end
1205
+ end
1206
+
1170
1207
  # Returns true if the snapshot has been compiled with WREAL support
1171
1208
  def wreal?
1172
1209
  return @wreal if defined?(@wreal)
@@ -10,8 +10,33 @@ module OrigenSim
10
10
  @last_message_at = Time.now
11
11
  super do
12
12
  begin
13
+ line = ''
13
14
  while @continue
14
- line = @socket.gets
15
+ loop do
16
+ out = @socket.gets
17
+ if out.nil?
18
+ line += ''
19
+ break
20
+ end
21
+
22
+ unless line.empty?
23
+ # If there's already stuff in the current line,
24
+ # remove the VPI cruft and leave just the remainder of the message.
25
+ out = out.split(' ', 2)[-1]
26
+ end
27
+
28
+ if out.chomp.end_with?(OrigenSim::Simulator::MULTIPART_LOGGER_TOKEN)
29
+ # Part of a multipart message. Add this to the current line
30
+ # and grab the next piece.
31
+ line += out.chomp.gsub(OrigenSim::Simulator::MULTIPART_LOGGER_TOKEN, '')
32
+ else
33
+ # Either a single message or a the end of a multi-part message.
34
+ # Add this to the line break to print the output to the console.
35
+ line += out
36
+ break
37
+ end
38
+ end
39
+
15
40
  if line
16
41
  line = line.chomp
17
42
  # If line has been sent from Origen for logging
@@ -46,6 +71,7 @@ module OrigenSim
46
71
  end
47
72
  end
48
73
  end
74
+ line = ''
49
75
  @last_message_at = Time.now
50
76
  end
51
77
  end
data/lib/origen_sim.rb CHANGED
@@ -54,7 +54,14 @@ module OrigenSim
54
54
  'disable' => -1,
55
55
  'disabled' => -1,
56
56
  'no_action' => -1,
57
- 'no-action' => -1
57
+ 'no-action' => -1,
58
+
59
+ # Disconnet/No-Connect Options
60
+ '-2' => -2,
61
+ 'no-connect' => -2,
62
+ 'no_connect' => -2,
63
+ 'disconnect' => -2,
64
+ 'disconnected' => -2
58
65
  }
59
66
 
60
67
  def self.__instantiate_simulator__
data/pattern/test.rb CHANGED
@@ -360,4 +360,8 @@ Pattern.create do
360
360
  if (tester.cycle_count - e) < 1400
361
361
  OrigenSim.error "sim_delay padding was not applied!"
362
362
  end
363
+
364
+ Origen.log.info("Testing that OrigenSim can send exceedingly long messages through the simulator...")
365
+ Origen.log.debug('OrigenSim'*1024)
366
+ Origen.log.success("If you see this, it worked!")
363
367
  end
@@ -156,14 +156,16 @@ module pin_drivers(<%= dut.rtl_pins.map { |n, p, o| "#{p.id}_o" }.join(', ') %>)
156
156
  reg sync = 0;
157
157
 
158
158
  % dut.rtl_pins.each do |name, pin, options|
159
- % if pin.type == :analog
159
+ % unless pin.meta[:origen_sim_init_pin_state] == -2
160
+ % if pin.type == :analog
160
161
  `ifdef ORIGEN_WREAL
161
162
  ana_pin_driver <%= pin.id %>(.pin(<%= pin.id %>_o));
162
163
  `else
163
164
  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));
164
165
  `endif
165
- % else
166
+ % else
166
167
  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));
168
+ % end
167
169
  % end
168
170
  % end
169
171
 
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.20.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-27 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen