Module: OrigenSim

Defined in:
lib/origen_sim.rb,
lib/origen_sim/flow.rb,
lib/origen_sim/tester.rb,
lib/origen_sim/generator.rb,
lib/origen_sim/heartbeat.rb,
lib/origen_sim/simulator.rb,
lib/origen_sim/simulation.rb,
lib/origen_sim/commands/pack.rb,
lib/origen_sim/stderr_reader.rb,
lib/origen_sim/stdout_reader.rb,
lib/origen_sim/simulator/artifacts.rb,
lib/origen_sim/simulator/user_details.rb,
lib/origen_sim/simulator/snapshot_details.rb

Defined Under Namespace

Modules: Artifacts, Commands, Generator Classes: Flow, Heartbeat, Simulation, Simulator, StderrReader, StdoutReader, Tester

Constant Summary collapse

NUMBER_OF_COMMENT_LINES =
10
INIT_PIN_STATE_MAPPING =

Include a mapping for various sematics.

{
  # Drive Low Options
  'drive_lo'       => 0,
  'drive-lo'       => 0,
  'drive_low'      => 0,
  'drive-low'      => 0,
  'lo'             => 0,
  'low'            => 0,
  '0'              => 0,

  # Drive High Options
  'drive_hi'       => 1,
  'drive-hi'       => 1,
  'drive_high'     => 1,
  'drive-high'     => 1,
  'hi'             => 1,
  'high'           => 1,
  '1'              => 1,

  # High Impedance Options
  'z'              => 2,
  'high_z'         => 2,
  'high-z'         => 2,
  'hi_z'           => 2,
  'hi-z'           => 2,
  'high_impedance' => 2,
  'high-impedance' => 2,
  '2'              => 2,

  # Disable Options
  '-1'             => -1,
  'disable'        => -1,
  'disabled'       => -1,
  'no_action'      => -1,
  'no-action'      => -1,

  # Disconnet/No-Connect Options
  '-2'             => -2,
  'no-connect'     => -2,
  'no_connect'     => -2,
  'disconnect'     => -2,
  'disconnected'   => -2
}
FORCE_PIN_TYPES_MAPPING =
{
  'real'    => :analog,
  'ana'     => :analog,
  'analog'  => :analog,

  'dig'     => :digital,
  'digital' => :digital
}

Class Method Summary collapse

Class Method Details

.__instantiate_simulator__Object



76
77
78
# File 'lib/origen_sim.rb', line 76

def self.__instantiate_simulator__
  @simulator ||= Simulator.new
end

.cadence(options = {}, &block) ⇒ Object



89
90
91
# File 'lib/origen_sim.rb', line 89

def self.cadence(options = {}, &block)
  Tester.new(options.merge(vendor: :cadence), &block)
end

.capture_dirObject

Returns where sim_delay and sim_capture records are stored, if not set then Origen.root/pattern/org/<target name> will be used by default



219
220
221
# File 'lib/origen_sim.rb', line 219

def self.capture_dir
  @capture_dir ||= Origen.root.join('pattern', 'org', Origen.target.name)
end

.capture_dir=(val) ⇒ Object

Change where sim_delay and sim_capture records are stored



213
214
215
# File 'lib/origen_sim.rb', line 213

def self.capture_dir=(val)
  @capture_dir = val
end

.error(message) ⇒ Object



208
209
210
# File 'lib/origen_sim.rb', line 208

def self.error(message)
  simulator.error(message)
end

.error_string_exceptionsObject



136
137
138
# File 'lib/origen_sim.rb', line 136

def self.error_string_exceptions
  @error_string_exceptions ||= []
end

.error_string_exceptions=(val) ⇒ Object



140
141
142
143
144
145
# File 'lib/origen_sim.rb', line 140

def self.error_string_exceptions=(val)
  unless val.is_a?(Array)
    fail 'OrigenSim.error_string_exceptions can only be set to an array of string values!'
  end
  @error_string_exceptions = val
end

.error_stringsObject



125
126
127
# File 'lib/origen_sim.rb', line 125

def self.error_strings
  @error_strings ||= ['ERROR']
end

.error_strings=(val) ⇒ Object



129
130
131
132
133
134
# File 'lib/origen_sim.rb', line 129

def self.error_strings=(val)
  unless val.is_a?(Array)
    fail 'OrigenSim.error_strings can only be set to an array of string values!'
  end
  @error_strings = val
end

.fail_on_stderrObject



195
196
197
# File 'lib/origen_sim.rb', line 195

def self.fail_on_stderr
  defined?(@fail_on_stderr) ? @fail_on_stderr : true
end

.fail_on_stderr=(val) ⇒ Object



191
192
193
# File 'lib/origen_sim.rb', line 191

def self.fail_on_stderr=(val)
  @fail_on_stderr = val
end

.flowObject



113
114
115
# File 'lib/origen_sim.rb', line 113

def self.flow
  @flow
end

.flow=(val) ⇒ Object



109
110
111
# File 'lib/origen_sim.rb', line 109

def self.flow=(val)
  @flow = val
end

.generic(options = {}, &block) ⇒ Object

Provide some shortcut methods to set the vendor



85
86
87
# File 'lib/origen_sim.rb', line 85

def self.generic(options = {}, &block)
  Tester.new(options.merge(vendor: :generic), &block)
end

.icarus(options = {}, &block) ⇒ Object



97
98
99
# File 'lib/origen_sim.rb', line 97

def self.icarus(options = {}, &block)
  Tester.new(options.merge(vendor: :icarus), &block)
end

.log_stringsObject



180
181
182
# File 'lib/origen_sim.rb', line 180

def self.log_strings
  @log_strings ||= []
end

.log_strings=(val) ⇒ Object



184
185
186
187
188
189
# File 'lib/origen_sim.rb', line 184

def self.log_strings=(val)
  unless val.is_a?(Array)
    fail 'OrigenSim.log_strings can only be set to an array of string values!'
  end
  @log_strings = val
end

.max_errorsObject



204
205
206
# File 'lib/origen_sim.rb', line 204

def self.max_errors
  @max_errors
end

.max_errors=(val) ⇒ Object

Setting the max_errors here will override the value in the simulator environment



200
201
202
# File 'lib/origen_sim.rb', line 200

def self.max_errors=(val)
  @max_errors = val
end

.run(name, options = {}, &block) ⇒ Object



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/origen_sim.rb', line 223

def self.run(name, options = {}, &block)
  # Load up the application and target
  Origen.load_application
  Origen.app.load_target!

  unless tester.simulator?
    Origen.app!.fail!(message: 'OrigenSim.run cannot be used when the simulator is not the current tester!')
  end

  # Start up the simulator and run whatever's in the target block.
  # After the block completes, shutdown the simulator
  tester.simulator.setup_simulation(name)
  yield
  tester.simulator.complete_simulation(name)
end

.run_source(source, options = {}) ⇒ Object



239
240
241
242
243
# File 'lib/origen_sim.rb', line 239

def self.run_source(source, options = {})
  OrigenSim.run(source) do
    OrigenTesters::Decompiler.decompile(source).execute
  end
end

.simulatorObject



80
81
82
# File 'lib/origen_sim.rb', line 80

def self.simulator
  @simulator
end

.socket_dirObject



121
122
123
# File 'lib/origen_sim.rb', line 121

def self.socket_dir
  @socket_dir
end

.socket_dir=(val) ⇒ Object



117
118
119
# File 'lib/origen_sim.rb', line 117

def self.socket_dir=(val)
  @socket_dir = val
end

.stderr_string_exceptionsObject



147
148
149
# File 'lib/origen_sim.rb', line 147

def self.stderr_string_exceptions
  @stderr_string_exceptions ||= []
end

.stderr_string_exceptions=(val) ⇒ Object



151
152
153
154
155
156
# File 'lib/origen_sim.rb', line 151

def self.stderr_string_exceptions=(val)
  unless val.is_a?(Array)
    fail 'OrigenSim.error_string_exceptions can only be set to an array of string values!'
  end
  @stderr_string_exceptions = val
end

.synopsys(options = {}, &block) ⇒ Object



93
94
95
# File 'lib/origen_sim.rb', line 93

def self.synopsys(options = {}, &block)
  Tester.new(options.merge(vendor: :synopsys), &block)
end

.verbose=(val) ⇒ Object



101
102
103
# File 'lib/origen_sim.rb', line 101

def self.verbose=(val)
  @verbose = val
end

.verbose?Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/origen_sim.rb', line 105

def self.verbose?
  !!(@verbose || Origen.log.log_level == :verbose || Origen.running_remotely?)
end

.warning_string_exceptionsObject



169
170
171
# File 'lib/origen_sim.rb', line 169

def self.warning_string_exceptions
  @warning_string_exceptions ||= []
end

.warning_string_exceptions=(val) ⇒ Object



173
174
175
176
177
178
# File 'lib/origen_sim.rb', line 173

def self.warning_string_exceptions=(val)
  unless val.is_a?(Array)
    fail 'OrigenSim.warning_string_exceptions can only be set to an array of string values!'
  end
  @warning_string_exceptions = val
end

.warning_stringsObject



158
159
160
# File 'lib/origen_sim.rb', line 158

def self.warning_strings
  @warning_strings ||= ['WARNING']
end

.warning_strings=(val) ⇒ Object



162
163
164
165
166
167
# File 'lib/origen_sim.rb', line 162

def self.warning_strings=(val)
  unless val.is_a?(Array)
    fail 'OrigenSim.warning_strings can only be set to an array of string values!'
  end
  @warning_strings = val
end