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
}

Class Method Summary collapse

Class Method Details

.__instantiate_simulator__Object



67
68
69
# File 'lib/origen_sim.rb', line 67

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

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



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

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



210
211
212
# File 'lib/origen_sim.rb', line 210

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



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

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

.error(message) ⇒ Object



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

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

.error_string_exceptionsObject



127
128
129
# File 'lib/origen_sim.rb', line 127

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

.error_string_exceptions=(val) ⇒ Object



131
132
133
134
135
136
# File 'lib/origen_sim.rb', line 131

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



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

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

.error_strings=(val) ⇒ Object



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

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



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

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

.fail_on_stderr=(val) ⇒ Object



182
183
184
# File 'lib/origen_sim.rb', line 182

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

.flowObject



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

def self.flow
  @flow
end

.flow=(val) ⇒ Object



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

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

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

Provide some shortcut methods to set the vendor



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

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

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



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

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

.log_stringsObject



171
172
173
# File 'lib/origen_sim.rb', line 171

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

.log_strings=(val) ⇒ Object



175
176
177
178
179
180
# File 'lib/origen_sim.rb', line 175

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



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

def self.max_errors
  @max_errors
end

.max_errors=(val) ⇒ Object

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



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

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

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



214
215
216
217
218
219
220
221
222
223
224
# File 'lib/origen_sim.rb', line 214

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

  # 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



226
227
228
229
230
# File 'lib/origen_sim.rb', line 226

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

.simulatorObject



71
72
73
# File 'lib/origen_sim.rb', line 71

def self.simulator
  @simulator
end

.socket_dirObject



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

def self.socket_dir
  @socket_dir
end

.socket_dir=(val) ⇒ Object



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

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

.stderr_string_exceptionsObject



138
139
140
# File 'lib/origen_sim.rb', line 138

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

.stderr_string_exceptions=(val) ⇒ Object



142
143
144
145
146
147
# File 'lib/origen_sim.rb', line 142

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



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

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

.verbose=(val) ⇒ Object



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

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

.verbose?Boolean

Returns:

  • (Boolean)


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

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

.warning_string_exceptionsObject



160
161
162
# File 'lib/origen_sim.rb', line 160

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

.warning_string_exceptions=(val) ⇒ Object



164
165
166
167
168
169
# File 'lib/origen_sim.rb', line 164

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



149
150
151
# File 'lib/origen_sim.rb', line 149

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

.warning_strings=(val) ⇒ Object



153
154
155
156
157
158
# File 'lib/origen_sim.rb', line 153

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