origen_sim 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/config/application.rb +109 -0
- data/config/boot.rb +24 -0
- data/config/commands.rb +74 -0
- data/config/shared_commands.rb +12 -0
- data/config/version.rb +8 -0
- data/lib/origen_sim/commands/build.rb +105 -0
- data/lib/origen_sim/flow.rb +13 -0
- data/lib/origen_sim/generator.rb +35 -0
- data/lib/origen_sim/origen/pins/pin.rb +93 -0
- data/lib/origen_sim/origen/top_level.rb +22 -0
- data/lib/origen_sim/origen_testers/api.rb +11 -0
- data/lib/origen_sim/simulator.rb +589 -0
- data/lib/origen_sim/tester.rb +113 -0
- data/lib/origen_sim.rb +27 -0
- data/lib/origen_sim_dev/dut.rb +101 -0
- data/lib/tasks/origen_sim.rake +6 -0
- data/pattern/test.rb +84 -0
- data/program/p1.rb +10 -0
- data/templates/empty.svcf +100 -0
- data/templates/probe.tcl.erb +15 -0
- data/templates/rtl_v/origen.v.erb +194 -0
- data/templates/web/index.md.erb +37 -0
- data/templates/web/layouts/_basic.html.erb +13 -0
- data/templates/web/partials/_navbar.html.erb +20 -0
- data/templates/web/release_notes.md.erb +5 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3fa5d90e78e17efb1942f6da11e1af57944e4ae1
|
4
|
+
data.tar.gz: 5ef919794ccbe8c54762dc87b1f461821ecdb031
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ba5ee81d6b23bc3ca5c910cf12c491938e87fb7cd1140142744cc4610f1058ac09c7196e9161291c852aaa3eb7e5516fdf5940463b4e7fb6a839e580bf1df022
|
7
|
+
data.tar.gz: 8fccdf6043048f57802489a64631bb1e8c6b757cba3c909690dd4e96582b71cca2b96a85f87f168f63c9aceff60ae62dfab5976af42ae4543b890b809dbed2e1
|
@@ -0,0 +1,109 @@
|
|
1
|
+
require 'origen'
|
2
|
+
class OrigenSimApplication < Origen::Application
|
3
|
+
|
4
|
+
# See http://origen-sdk.org/origen/api/Origen/Application/Configuration.html
|
5
|
+
# for a full list of the configuration options available
|
6
|
+
|
7
|
+
# These attributes should never be changed, the duplication here will be resolved in future
|
8
|
+
# by condensing these attributes that do similar things
|
9
|
+
self.name = "origen_sim"
|
10
|
+
self.namespace = "OrigenSim"
|
11
|
+
config.name = "origen_sim"
|
12
|
+
config.initials = "OrigenSim"
|
13
|
+
config.rc_url = "git@github.com:Origen-SDK/origen_sim.git"
|
14
|
+
config.release_externally = true
|
15
|
+
|
16
|
+
# To enable deployment of your documentation to a web server (via the 'origen web'
|
17
|
+
# command) fill in these attributes.
|
18
|
+
config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/sim"
|
19
|
+
config.web_domain = "http://origen-sdk.org/sim"
|
20
|
+
|
21
|
+
# When false Origen will be less strict about checking for some common coding errors,
|
22
|
+
# it is recommended that you leave this to true for better feedback and easier debug.
|
23
|
+
# This will be the default setting in Origen v3.
|
24
|
+
config.strict_errors = true
|
25
|
+
|
26
|
+
config.shared = {
|
27
|
+
#:patterns => "pattern",
|
28
|
+
#:templates => "templates",
|
29
|
+
#:programs => "program",
|
30
|
+
:command_launcher => "config/shared_commands.rb"
|
31
|
+
}
|
32
|
+
|
33
|
+
# See: http://origen-sdk.org/origen/latest/guides/utilities/lint/
|
34
|
+
config.lint_test = {
|
35
|
+
# Require the lint tests to pass before allowing a release to proceed
|
36
|
+
run_on_tag: true,
|
37
|
+
# Auto correct violations where possible whenever 'origen lint' is run
|
38
|
+
auto_correct: true,
|
39
|
+
# Limit the testing for large legacy applications
|
40
|
+
#level: :easy,
|
41
|
+
# Run on these directories/files by default
|
42
|
+
#files: ["lib", "config/application.rb"],
|
43
|
+
}
|
44
|
+
|
45
|
+
config.semantically_version = true
|
46
|
+
|
47
|
+
# An example of how to set application specific LSF parameters
|
48
|
+
#config.lsf.project = "msg.te"
|
49
|
+
|
50
|
+
# An example of how to specify a prefix to add to all generated patterns
|
51
|
+
#config.pattern_prefix = "nvm"
|
52
|
+
|
53
|
+
# An example of how to add header comments to all generated patterns
|
54
|
+
#config.pattern_header do
|
55
|
+
# cc "This is a pattern created by the example origen application"
|
56
|
+
#end
|
57
|
+
|
58
|
+
# By default all generated output will end up in ./output.
|
59
|
+
# Here you can specify an alternative directory entirely, or make it dynamic such that
|
60
|
+
# the output ends up in a setup specific directory.
|
61
|
+
#config.output_directory do
|
62
|
+
# "#{Origen.root}/output/#{$dut.class}"
|
63
|
+
#end
|
64
|
+
|
65
|
+
# Similarly for the reference files, generally you want to setup the reference directory
|
66
|
+
# structure to mirror that of your output directory structure.
|
67
|
+
#config.reference_directory do
|
68
|
+
# "#{Origen.root}/.ref/#{$dut.class}"
|
69
|
+
#end
|
70
|
+
|
71
|
+
# This will automatically deploy your documentation after every tag
|
72
|
+
#def after_release_email(tag, note, type, selector, options)
|
73
|
+
# command = "origen web compile --remote --api"
|
74
|
+
# Dir.chdir Origen.root do
|
75
|
+
# system command
|
76
|
+
# end
|
77
|
+
#end
|
78
|
+
|
79
|
+
# Ensure that all tests pass before allowing a release to continue
|
80
|
+
#def validate_release
|
81
|
+
# if !system("origen specs") || !system("origen examples")
|
82
|
+
# puts "Sorry but you can't release with failing tests, please fix them and try again."
|
83
|
+
# exit 1
|
84
|
+
# else
|
85
|
+
# puts "All tests passing, proceeding with release process!"
|
86
|
+
# end
|
87
|
+
#end
|
88
|
+
|
89
|
+
# To enabled source-less pattern generation create a class (for example PatternDispatcher)
|
90
|
+
# to generate the pattern. This should return false if the requested pattern has been
|
91
|
+
# dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
|
92
|
+
#def before_pattern_lookup(requested_pattern)
|
93
|
+
# PatternDispatcher.new.dispatch_or_return(requested_pattern)
|
94
|
+
#end
|
95
|
+
|
96
|
+
# If you use pattern iterators you may come across the case where you request a pattern
|
97
|
+
# like this:
|
98
|
+
# origen g example_pat_b0.atp
|
99
|
+
#
|
100
|
+
# However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
|
101
|
+
# In the case where the pattern cannot be found Origen will pass the name to this translator
|
102
|
+
# if it exists, and here you can make any substitutions to help Origen find the file you
|
103
|
+
# want. In this example any instances of _b\d, where \d means a number, are replaced by
|
104
|
+
# _bx.
|
105
|
+
#config.pattern_name_translator do |name|
|
106
|
+
# name.gsub(/_b\d/, "_bx")
|
107
|
+
#end
|
108
|
+
|
109
|
+
end
|
data/config/boot.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file is used to boot your plugin when it is running in standalone mode
|
2
|
+
# from its own workspace - i.e. when the plugin is being developed.
|
3
|
+
#
|
4
|
+
# It will not be loaded when the plugin is imported by a 3rd party app - in that
|
5
|
+
# case only lib/origen_sim.rb is loaded.
|
6
|
+
#
|
7
|
+
# Therefore this file can be used to load anything extra that you need to boot
|
8
|
+
# the development environment for this app. For example, this is typically used
|
9
|
+
# to load some additional test classes to use your plugin APIs so that they can
|
10
|
+
# be tested and/or interacted with in the console.
|
11
|
+
require "origen_sim"
|
12
|
+
|
13
|
+
module OrigenSimDev
|
14
|
+
# Example of how to explicitly require a file
|
15
|
+
# require "origen_sim_dev/my_file"
|
16
|
+
|
17
|
+
# Load all files in the lib/origen_sim_dev directory.
|
18
|
+
# Note that there is no problem from requiring a file twice (Ruby will ignore
|
19
|
+
# the second require), so if you have a file that must be required first, then
|
20
|
+
# explicitly require it up above and then let this take care of the rest.
|
21
|
+
Dir.glob("#{File.dirname(__FILE__)}/../lib/origen_sim_dev/**/*.rb").sort.each do |file|
|
22
|
+
require file
|
23
|
+
end
|
24
|
+
end
|
data/config/commands.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# This file should be used to extend the origen with application specific commands
|
2
|
+
|
3
|
+
# Map any command aliases here, for example to allow 'origen ex' to refer to a
|
4
|
+
# command called execute you would add a reference as shown below:
|
5
|
+
aliases ={
|
6
|
+
# "ex" => "execute",
|
7
|
+
}
|
8
|
+
|
9
|
+
# The requested command is passed in here as @command, this checks it against
|
10
|
+
# the above alias table and should not be removed.
|
11
|
+
@command = aliases[@command] || @command
|
12
|
+
|
13
|
+
# Now branch to the specific task code
|
14
|
+
case @command
|
15
|
+
|
16
|
+
# Here is an example of how to implement a command, the logic can go straight
|
17
|
+
# in here or you can require an external file if preferred.
|
18
|
+
when "my_command"
|
19
|
+
puts "Doing something..."
|
20
|
+
#require "commands/my_command" # Would load file lib/commands/my_command.rb
|
21
|
+
# You must always exit upon successfully capturing a command to prevent
|
22
|
+
# control flowing back to Origen
|
23
|
+
exit 0
|
24
|
+
|
25
|
+
## Example of how to make a command to run unit tests, this simply invokes RSpec on
|
26
|
+
## the spec directory
|
27
|
+
#when "specs"
|
28
|
+
# require "rspec"
|
29
|
+
# exit RSpec::Core::Runner.run(['spec'])
|
30
|
+
|
31
|
+
## Example of how to make a command to run diff-based tests
|
32
|
+
#when "examples", "test"
|
33
|
+
# Origen.load_application
|
34
|
+
# status = 0
|
35
|
+
#
|
36
|
+
# # Compiler tests
|
37
|
+
# ARGV = %w(templates/example.txt.erb -t debug -r approved)
|
38
|
+
# load "origen/commands/compile.rb"
|
39
|
+
# # Pattern generator tests
|
40
|
+
# #ARGV = %w(some_pattern -t debug -r approved)
|
41
|
+
# #load "#{Origen.top}/lib/origen/commands/generate.rb"
|
42
|
+
#
|
43
|
+
# if Origen.app.stats.changed_files == 0 &&
|
44
|
+
# Origen.app.stats.new_files == 0 &&
|
45
|
+
# Origen.app.stats.changed_patterns == 0 &&
|
46
|
+
# Origen.app.stats.new_patterns == 0
|
47
|
+
#
|
48
|
+
# Origen.app.stats.report_pass
|
49
|
+
# else
|
50
|
+
# Origen.app.stats.report_fail
|
51
|
+
# status = 1
|
52
|
+
# end
|
53
|
+
# puts
|
54
|
+
# if @command == "test"
|
55
|
+
# Origen.app.unload_target!
|
56
|
+
# require "rspec"
|
57
|
+
# result = RSpec::Core::Runner.run(['spec'])
|
58
|
+
# status = status == 1 ? 1 : result
|
59
|
+
# end
|
60
|
+
# exit status # Exit with a 1 on the event of a failure per std unix result codes
|
61
|
+
|
62
|
+
# Always leave an else clause to allow control to fall back through to the
|
63
|
+
# Origen command handler.
|
64
|
+
else
|
65
|
+
# You probably want to also add the your commands to the help shown via
|
66
|
+
# origen -h, you can do this be assigning the required text to @application_commands
|
67
|
+
# before handing control back to Origen. Un-comment the example below to get started.
|
68
|
+
# @application_commands = <<-EOT
|
69
|
+
# specs Run the specs (tests), -c will enable coverage
|
70
|
+
# examples Run the examples (tests), -c will enable coverage
|
71
|
+
# test Run both specs and examples, -c will enable coverage
|
72
|
+
# EOT
|
73
|
+
|
74
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# The requested command is passed in here as @command
|
2
|
+
case @command
|
3
|
+
|
4
|
+
when "origen_sim:build", "sim:build"
|
5
|
+
require "origen_sim/commands/build"
|
6
|
+
exit 0
|
7
|
+
else
|
8
|
+
@plugin_commands << <<-EOT
|
9
|
+
sim:build Build the simulation object for the current/given target
|
10
|
+
EOT
|
11
|
+
|
12
|
+
end
|
data/config/version.rb
ADDED
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'origen_sim'
|
3
|
+
|
4
|
+
options = {}
|
5
|
+
|
6
|
+
# App options are options that the application can supply to extend this command
|
7
|
+
app_options = @application_options || []
|
8
|
+
opt_parser = OptionParser.new do |opts|
|
9
|
+
opts.banner = <<-EOT
|
10
|
+
Compile an RTL design into an object that Origen can simulate.
|
11
|
+
|
12
|
+
All configuration apart from target selection should be done when instantiating the
|
13
|
+
OrigenSim::Tester in an environment file. This encourages the configuration to be
|
14
|
+
checked in, enabling repeatable builds in future.
|
15
|
+
|
16
|
+
Usage: origen origen_sim:build [options]
|
17
|
+
EOT
|
18
|
+
opts.on('-e', '--environment NAME', String, 'Override the default environment, NAME can be a full path or a fragment of an environment file name') { |e| options[:environment] = e }
|
19
|
+
opts.on('-t', '--target NAME', String, 'Override the default target, NAME can be a full path or a fragment of a target file name') { |t| options[:target] = t }
|
20
|
+
opts.on('-pl', '--plugin PLUGIN_NAME', String, 'Set current plugin') { |pl_n| options[:current_plugin] = pl_n }
|
21
|
+
opts.on('--testrun', 'Displays the commands that will be generated but does not execute them') { options[:testrun] = true }
|
22
|
+
opts.on('-i', '--incremental', 'Preserve existing compiled files to do an incremental build instead of starting from scratch') { options[:incremental] = true }
|
23
|
+
opts.on('-d', '--debugger', 'Enable the debugger') { options[:debugger] = true }
|
24
|
+
app_options.each do |app_option|
|
25
|
+
opts.on(*app_option) {}
|
26
|
+
end
|
27
|
+
opts.separator ''
|
28
|
+
opts.on('-h', '--help', 'Show this message') { puts opts; exit 0 }
|
29
|
+
end
|
30
|
+
|
31
|
+
opt_parser.parse! ARGV
|
32
|
+
Origen.app.plugins.temporary = options[:current_plugin] if options[:current_plugin]
|
33
|
+
Origen.environment.temporary = options[:environment] if options[:environment]
|
34
|
+
Origen.target.temporary = options[:target] if options[:target]
|
35
|
+
Origen.app.load_target!
|
36
|
+
|
37
|
+
unless tester.is_a?(OrigenSim::Tester)
|
38
|
+
puts 'The target/environment does not instantiate an OrigenSim::Tester instance!'
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
simulator = OrigenSim.simulator
|
43
|
+
config = simulator.configuration
|
44
|
+
tmp_dir = simulator.tmp_dir
|
45
|
+
|
46
|
+
unless options[:testrun]
|
47
|
+
FileUtils.rm_rf(tmp_dir) unless options[:incremental]
|
48
|
+
FileUtils.mkdir_p(tmp_dir)
|
49
|
+
FileUtils.rm_rf(simulator.compiled_dir) unless options[:incremental]
|
50
|
+
FileUtils.mkdir_p(simulator.compiled_dir)
|
51
|
+
FileUtils.rm_rf(simulator.artifacts_dir)
|
52
|
+
FileUtils.mkdir_p(simulator.artifacts_dir)
|
53
|
+
Array(config[:artifacts] || config[:artifact]).each do |f|
|
54
|
+
FileUtils.cp(f, simulator.artifacts_dir)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Create the testbench for the current Origen target and simulator vendor
|
58
|
+
Origen.app.runner.launch action: :compile,
|
59
|
+
files: "#{Origen.root!}/templates/rtl_v/origen.v.erb",
|
60
|
+
output: tmp_dir,
|
61
|
+
check_for_changes: false,
|
62
|
+
options: { vendor: config[:vendor], top: config[:rtl_top] }
|
63
|
+
end
|
64
|
+
|
65
|
+
case config[:vendor]
|
66
|
+
when :icarus
|
67
|
+
# Compile the VPI extension first
|
68
|
+
Dir.chdir tmp_dir do
|
69
|
+
system "iverilog-vpi #{Origen.root!}/ext/*.c -DICARUS --name=origen"
|
70
|
+
system "mv origen.vpi #{simulator.compiled_dir}"
|
71
|
+
end
|
72
|
+
# Build the object containing the DUT and testbench
|
73
|
+
cmd = "iverilog -o #{simulator.compiled_dir}/dut.vvp"
|
74
|
+
Array(config[:rtl_dir] || config[:rtl_dirs]).each do |dir|
|
75
|
+
cmd += " -I #{dir}"
|
76
|
+
end
|
77
|
+
Array(config[:rtl_file] || config[:rtl_files]).each do |f|
|
78
|
+
cmd += " #{f}"
|
79
|
+
end
|
80
|
+
cmd += " #{tmp_dir}/origen.v"
|
81
|
+
|
82
|
+
when :cadence
|
83
|
+
cmd = config[:irun] || 'irun'
|
84
|
+
Array(config[:rtl_file] || config[:rtl_files]).each do |f|
|
85
|
+
cmd += " #{f}"
|
86
|
+
end
|
87
|
+
Array(config[:lib_file] || config[:lib_files]).each do |f|
|
88
|
+
cmd += " -v #{f}"
|
89
|
+
end
|
90
|
+
Array(config[:rtl_dir] || config[:rtl_dirs]).each do |dir|
|
91
|
+
cmd += " -incdir #{dir}"
|
92
|
+
end
|
93
|
+
cmd += " #{tmp_dir}/origen.v -top origen -timescale 1ns/1ns"
|
94
|
+
cmd += " -nclibdirpath #{simulator.compiled_dir}"
|
95
|
+
cmd += " #{Origen.root!}/ext/*.c -ccargs \"-std=gnu99\""
|
96
|
+
cmd += ' -elaborate -snapshot origen -access +rw'
|
97
|
+
cmd += " #{config[:explicit].strip.gsub(/\s+/, ' ')}" if config[:explicit]
|
98
|
+
end
|
99
|
+
|
100
|
+
puts cmd
|
101
|
+
unless options[:testrun]
|
102
|
+
Dir.chdir tmp_dir do
|
103
|
+
system cmd
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module OrigenSim
|
2
|
+
class Flow
|
3
|
+
include OrigenTesters::Flow
|
4
|
+
|
5
|
+
def test(name, options = {})
|
6
|
+
pattern = (options[:pattern] || name.try(:pattern) || name).to_s
|
7
|
+
|
8
|
+
Origen.interface.referenced_patterns << pattern
|
9
|
+
|
10
|
+
Origen.app.runner.launch action: :generate, files: pattern
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'origen_sim/flow'
|
2
|
+
module OrigenSim
|
3
|
+
module Generator
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
include OrigenTesters::Interface # adds the interface helpers/Origen hook-up
|
8
|
+
end
|
9
|
+
|
10
|
+
def flow(filename = nil)
|
11
|
+
if filename || Origen.file_handler.current_file
|
12
|
+
filename ||= Origen.file_handler.current_file.basename('.rb').to_s
|
13
|
+
# DH here need to reset the flow!!
|
14
|
+
f = filename.to_sym
|
15
|
+
return flow_sheets[f] if flow_sheets[f] # will return flow if already existing
|
16
|
+
p = OrigenSim::Flow.new
|
17
|
+
p.inhibit_output if Origen.interface.resources_mode?
|
18
|
+
p.filename = f
|
19
|
+
flow_sheets[f] = p
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def flow_sheets
|
24
|
+
@@flow_sheets ||= {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def reset_globals
|
28
|
+
@@flow_sheets = nil
|
29
|
+
end
|
30
|
+
|
31
|
+
def sheet_generators
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'origen/pins/pin'
|
2
|
+
module Origen
|
3
|
+
module Pins
|
4
|
+
# Override the Origen pin model so we can hook into all changes to pin states
|
5
|
+
class Pin
|
6
|
+
# The index number that is used to refer to the pin within the simulation
|
7
|
+
attr_accessor :simulation_index
|
8
|
+
# When generating a testbench the top-level signal will be tied off to the given
|
9
|
+
# logic level if this is set to 0 or 1
|
10
|
+
attr_accessor :tie_off
|
11
|
+
|
12
|
+
alias_method :_orig_initialize, :initialize
|
13
|
+
def initialize(id, owner, options = {})
|
14
|
+
@tie_off = options[:tie_off]
|
15
|
+
_orig_initialize(id, owner, options)
|
16
|
+
end
|
17
|
+
|
18
|
+
def rtl_name
|
19
|
+
if primary_group
|
20
|
+
(@rtl_name || primary_group.id).to_s
|
21
|
+
else
|
22
|
+
(@rtl_name || id).to_s
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
alias_method :_orig_set_value, :set_value
|
27
|
+
def set_value(val)
|
28
|
+
ret = _orig_set_value(val)
|
29
|
+
update_simulation if simulation_running?
|
30
|
+
ret
|
31
|
+
end
|
32
|
+
|
33
|
+
alias_method :_orig_set_state, :set_state
|
34
|
+
def set_state(val)
|
35
|
+
ret = _orig_set_state(val)
|
36
|
+
update_simulation if simulation_running?
|
37
|
+
ret
|
38
|
+
end
|
39
|
+
|
40
|
+
alias_method :_orig_state=, :state=
|
41
|
+
def state=(val)
|
42
|
+
ret = _orig_state = (val)
|
43
|
+
update_simulation if simulation_running?
|
44
|
+
ret
|
45
|
+
end
|
46
|
+
|
47
|
+
def simulation_running?
|
48
|
+
tester && tester.is_a?(OrigenSim::Tester)
|
49
|
+
end
|
50
|
+
|
51
|
+
def simulator
|
52
|
+
OrigenSim.simulator
|
53
|
+
end
|
54
|
+
|
55
|
+
# Returns true if the current pin state is different to that last given to the simulator
|
56
|
+
def simulator_needs_update?
|
57
|
+
return false if state == :dont_care && @simulator_state == :dont_care
|
58
|
+
state != @simulator_state || value != @simulator_value
|
59
|
+
end
|
60
|
+
|
61
|
+
def reset_simulator_state
|
62
|
+
@simulator_state = nil
|
63
|
+
@simulator_value = nil
|
64
|
+
end
|
65
|
+
|
66
|
+
# Applies the current pin state to the simulation, this is triggered everytime
|
67
|
+
# the pin state or value changes
|
68
|
+
def update_simulation
|
69
|
+
return if tie_off || !simulation_index || !tester.timeset || !simulator_needs_update?
|
70
|
+
case state
|
71
|
+
when :drive
|
72
|
+
@simulator_state = :drive
|
73
|
+
@simulator_value = value
|
74
|
+
simulator.put("2^#{simulation_index}^#{value}")
|
75
|
+
when :compare
|
76
|
+
@simulator_state = :compare
|
77
|
+
@simulator_value = value
|
78
|
+
simulator.put("4^#{simulation_index}^#{value}")
|
79
|
+
when :dont_care
|
80
|
+
@simulator_state = :dont_care
|
81
|
+
simulator.put("5^#{simulation_index}")
|
82
|
+
when :capture
|
83
|
+
@simulator_state = :capture
|
84
|
+
simulator.put("e^#{simulation_index}")
|
85
|
+
when :drive_very_high, :drive_mem, :expect_mem, :compare_midband
|
86
|
+
fail "Simulation of pin state #{state} is not implemented yet!"
|
87
|
+
else
|
88
|
+
fail "Simulation of pin state #{state} is not implemented yet!"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'origen/top_level'
|
2
|
+
module Origen
|
3
|
+
module TopLevel
|
4
|
+
# Like pins, except removes any pins which have their rtl_name
|
5
|
+
# attribute set to 'nc'
|
6
|
+
def rtl_pins
|
7
|
+
@rtl_pins ||= begin
|
8
|
+
p = []
|
9
|
+
pins.each do |name, pin|
|
10
|
+
options = {}
|
11
|
+
unless pin.rtl_name.to_s.downcase == 'nc'
|
12
|
+
if pin.primary_group
|
13
|
+
options[:group] = true
|
14
|
+
end
|
15
|
+
p << [name, pin, options]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
p
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|