origen_apb 0.2.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/bin/fix_my_workspace +100 -0
- data/config/application.rb +65 -0
- data/config/boot.rb +24 -0
- data/config/commands.rb +75 -0
- data/config/version.rb +8 -0
- data/lib/origen_apb/driver.rb +158 -0
- data/lib/origen_apb.rb +24 -0
- data/lib/tasks/origen_apb.rake +6 -0
- data/pattern/example.rb +18 -0
- data/templates/web/index.md.erb +81 -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 +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ee9b795efd0e01c55816c975a06447bfcf947ef8
|
4
|
+
data.tar.gz: 57322fa85183ddd39446fabf14f7b7d9e6071ae9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a63f44bda893b547aad5d8176bb1cd6d2b65d756b22e6a78d592c2e39dd3482c5a1b8f5b3edcc43ae95472231262efcb0ebdcf366935429880e18c596040c667
|
7
|
+
data.tar.gz: 43c84c88537fb59f3181e4229ba5e6c1968e475a3303d09d736ad38af704b80a3862be22d9cbb91bcb4b74a79b31aa4894bd3e05112ec6601d5496618e68a16a
|
@@ -0,0 +1,100 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$VERBOSE = nil # Don't care about world writable dir warnings and the like
|
3
|
+
|
4
|
+
if $_fix_my_workspace_version_check
|
5
|
+
$_fix_my_workspace_version = '0.7.0'
|
6
|
+
else
|
7
|
+
if File.exist?(File.expand_path('../../lib/origen.rb', __FILE__))
|
8
|
+
# If this script is being run from within an origen-core workspace, use that Origen-core,
|
9
|
+
# not the system-installed origen-core version.
|
10
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
11
|
+
require 'origen'
|
12
|
+
else
|
13
|
+
# Use system-installed Origen (the gem in system Ruby)
|
14
|
+
require 'origen'
|
15
|
+
end
|
16
|
+
|
17
|
+
if !Origen.site_config.gem_manage_bundler
|
18
|
+
puts 'Sorry but you have opted to manage Bundler yourself via your Origen site config, and this means'
|
19
|
+
puts 'that I cannot make certain assumptions about how your workspace is configured.'
|
20
|
+
puts 'You will need to either resolve this problem yourself, or else change the value of'
|
21
|
+
puts 'gem_mange_bundler to true.'
|
22
|
+
puts 'See here for more details on how to do that: http://origen-sdk.org/origen/guides/starting/company/'
|
23
|
+
|
24
|
+
else
|
25
|
+
ENV['BUNDLE_GEMFILE'] = File.join(Origen.root, 'Gemfile')
|
26
|
+
ENV['BUNDLE_PATH'] = File.expand_path(Origen.site_config.gem_install_dir)
|
27
|
+
ENV['BUNDLE_BIN'] = File.join(Origen.root, 'lbin')
|
28
|
+
|
29
|
+
# Force copy system gems to local gems
|
30
|
+
if Origen.site_config.gem_use_from_system
|
31
|
+
local_gem_dir = "#{ENV['BUNDLE_PATH']}/ruby/#{Pathname.new(Gem.dir).basename}"
|
32
|
+
gem_dir = Pathname.new(Gem.dir)
|
33
|
+
|
34
|
+
Origen.site_config.gem_use_from_system.each do |gem, version|
|
35
|
+
begin
|
36
|
+
# This will raise an error if the system doesn't have this gem installed, that
|
37
|
+
# will be rescued below
|
38
|
+
spec = Gem::Specification.find_by_name(gem, version)
|
39
|
+
|
40
|
+
local_dir = File.join(local_gem_dir, Pathname.new(spec.gem_dir).relative_path_from(gem_dir))
|
41
|
+
FileUtils.mkdir_p local_dir
|
42
|
+
FileUtils.cp_r("#{spec.gem_dir}/.", local_dir)
|
43
|
+
|
44
|
+
local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.cache_file).relative_path_from(gem_dir)))
|
45
|
+
FileUtils.mkdir_p local_file.dirname
|
46
|
+
FileUtils.cp(spec.cache_file, local_file)
|
47
|
+
|
48
|
+
if spec.extension_dir && File.exist?(spec.extension_dir)
|
49
|
+
local_dir = File.join(local_gem_dir, Pathname.new(spec.extension_dir).relative_path_from(gem_dir))
|
50
|
+
FileUtils.mkdir_p local_dir
|
51
|
+
FileUtils.cp_r("#{spec.extension_dir}/.", local_dir)
|
52
|
+
end
|
53
|
+
|
54
|
+
local_file = Pathname.new(File.join(local_gem_dir, Pathname.new(spec.spec_file).relative_path_from(gem_dir)))
|
55
|
+
FileUtils.mkdir_p local_file.dirname
|
56
|
+
FileUtils.cp(spec.spec_file, local_file)
|
57
|
+
|
58
|
+
rescue Gem::LoadError
|
59
|
+
# This just means that one of the gems that should be copied from the system
|
60
|
+
# was not actually installed in the system, so nothing we can do about that here
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Delete lbin
|
66
|
+
FileUtils.rm_rf(ENV['BUNDLE_BIN']) if File.exist?(ENV['BUNDLE_BIN'])
|
67
|
+
|
68
|
+
# Run bundler with correct switches
|
69
|
+
cmd = "bundle install --gemfile #{ENV['BUNDLE_GEMFILE']} --binstubs #{ENV['BUNDLE_BIN']} --path #{ENV['BUNDLE_PATH']}"
|
70
|
+
`chmod o-w #{Origen.root}` # Stops some annoying world writable warnings during install
|
71
|
+
`chmod o-w #{Origen.root}/bin` if File.exist?("#{Origen.root}/bin")
|
72
|
+
`chmod o-w #{Origen.root}/.bin` if File.exist?("#{Origen.root}/.bin")
|
73
|
+
|
74
|
+
# Try again, this time updating the bundle
|
75
|
+
if system(cmd)
|
76
|
+
fixed = true
|
77
|
+
elsif system 'bundle update'
|
78
|
+
fixed = true
|
79
|
+
end
|
80
|
+
|
81
|
+
if File.exist?(ENV['BUNDLE_BIN'])
|
82
|
+
`chmod o-w #{ENV['BUNDLE_BIN']}`
|
83
|
+
|
84
|
+
# Make .bat versions of all executables, Bundler should really be doing this when running
|
85
|
+
# on windows
|
86
|
+
if Origen.os.windows?
|
87
|
+
Dir.glob("#{ENV['BUNDLE_BIN']}/*").each do |bin|
|
88
|
+
unless bin =~ /.bat$/
|
89
|
+
bat = "#{bin}.bat"
|
90
|
+
unless File.exist?(bat)
|
91
|
+
File.open(bat, 'w') { |f| f.write('@"ruby.exe" "%~dpn0" %*') }
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
system 'origen -v' if fixed
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'origen'
|
2
|
+
class OrigenApbApplication < 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_apb"
|
10
|
+
self.namespace = "OrigenApb"
|
11
|
+
config.name = "origen_apb"
|
12
|
+
config.initials = "OrigenApb"
|
13
|
+
# Change this to point to the revision control repository for this plugin
|
14
|
+
config.rc_url = "git@github.com:Origen-SDK/origen_apb.git"
|
15
|
+
config.release_externally = true
|
16
|
+
|
17
|
+
# To enable deployment of your documentation to a web server (via the 'origen web'
|
18
|
+
# command) fill in these attributes.
|
19
|
+
config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/origen_apb"
|
20
|
+
config.web_domain = "http://origen-sdk.org/origen_apb"
|
21
|
+
|
22
|
+
# See: http://origen-sdk.org/origen/latest/guides/utilities/lint/
|
23
|
+
config.lint_test = {
|
24
|
+
# Require the lint tests to pass before allowing a release to proceed
|
25
|
+
run_on_tag: true,
|
26
|
+
# Auto correct violations where possible whenever 'origen lint' is run
|
27
|
+
auto_correct: true,
|
28
|
+
# Limit the testing for large legacy applications
|
29
|
+
#level: :easy,
|
30
|
+
# Run on these directories/files by default
|
31
|
+
#files: ["lib", "config/application.rb"],
|
32
|
+
}
|
33
|
+
|
34
|
+
config.semantically_version = true
|
35
|
+
|
36
|
+
# Ensure that all tests pass before allowing a release to continue
|
37
|
+
def validate_release
|
38
|
+
if !system("origen examples") #|| !system("origen specs")
|
39
|
+
puts "Sorry but you can't release with failing tests, please fix them and try again."
|
40
|
+
exit 1
|
41
|
+
else
|
42
|
+
puts "All tests passing, proceeding with release process!"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Run code coverage when deploying the web site
|
47
|
+
def before_deploy_site
|
48
|
+
Dir.chdir Origen.root do
|
49
|
+
system "origen examples -c"
|
50
|
+
dir = "#{Origen.root}/web/output/coverage"
|
51
|
+
FileUtils.remove_dir(dir, true) if File.exists?(dir)
|
52
|
+
system "mv #{Origen.root}/coverage #{dir}"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Deploy the website automatically after a production tag
|
57
|
+
def after_release_email(tag, note, type, selector, options)
|
58
|
+
command = "origen web compile --remote --api"
|
59
|
+
Dir.chdir Origen.root do
|
60
|
+
system command
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
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_apb.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_apb"
|
12
|
+
|
13
|
+
module OrigenApbDev
|
14
|
+
# Example of how to explicitly require a file
|
15
|
+
# require "origen_apb_dev/my_file"
|
16
|
+
|
17
|
+
# Load all files in the lib/origen_apb_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_apb_dev/**/*.rb").sort.each do |file|
|
22
|
+
require file
|
23
|
+
end
|
24
|
+
end
|
data/config/commands.rb
ADDED
@@ -0,0 +1,75 @@
|
|
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
|
+
# (Working) example of how to create an application specific comment, here to generate
|
17
|
+
# a tags file for you application to enable method definition lookup and similar within
|
18
|
+
# editors/IDEs
|
19
|
+
when "tags"
|
20
|
+
# Here the logic is just written in-line, alternatively it could be written in a
|
21
|
+
# dedicated file and required here, e.g.
|
22
|
+
#require "origen_apb/commands/my_command" # Would load file lib/origen_apb/commands/my_command.rb
|
23
|
+
Dir.chdir Origen.root do
|
24
|
+
system("ripper-tags -R")
|
25
|
+
end
|
26
|
+
# You must always exit upon successfully capturing and executing a command to prevent
|
27
|
+
# control flowing back to Origen
|
28
|
+
exit 0
|
29
|
+
|
30
|
+
## Example of how to make a command to run unit tests, this simply invokes RSpec on
|
31
|
+
## the spec directory
|
32
|
+
when "specs"
|
33
|
+
require "rspec"
|
34
|
+
exit RSpec::Core::Runner.run(['spec'])
|
35
|
+
|
36
|
+
when 'examples', 'test'
|
37
|
+
Origen.load_application
|
38
|
+
status = 0
|
39
|
+
|
40
|
+
# Pattern generator tests
|
41
|
+
ARGV = %w(example -t dev -r approved)
|
42
|
+
load "#{Origen.top}/lib/origen/commands/generate.rb"
|
43
|
+
|
44
|
+
if Origen.app.stats.changed_files == 0 &&
|
45
|
+
Origen.app.stats.new_files == 0 &&
|
46
|
+
Origen.app.stats.changed_patterns == 0 &&
|
47
|
+
Origen.app.stats.new_patterns == 0
|
48
|
+
|
49
|
+
Origen.app.stats.report_pass
|
50
|
+
else
|
51
|
+
Origen.app.stats.report_fail
|
52
|
+
status = 1
|
53
|
+
end
|
54
|
+
puts
|
55
|
+
if @command == 'test'
|
56
|
+
Origen.app.unload_target!
|
57
|
+
require 'rspec'
|
58
|
+
result = RSpec::Core::Runner.run(['spec'])
|
59
|
+
status = status == 1 ? 1 : result
|
60
|
+
end
|
61
|
+
exit status # Exit with a 1 on the event of a failure per std unix result codes
|
62
|
+
|
63
|
+
# Always leave an else clause to allow control to fall back through to the
|
64
|
+
# Origen command handler.
|
65
|
+
else
|
66
|
+
# You probably want to also add the your commands to the help shown via
|
67
|
+
# origen -h, you can do this by assigning the required text to @application_commands
|
68
|
+
# before handing control back to Origen.
|
69
|
+
@application_commands = <<-EOT
|
70
|
+
tags Build a tags file for this app
|
71
|
+
examples Run the examples (tests), -c will enable coverage
|
72
|
+
test Run both specs and examples, -c will enable coverage
|
73
|
+
EOT
|
74
|
+
|
75
|
+
end
|
data/config/version.rb
ADDED
@@ -0,0 +1,158 @@
|
|
1
|
+
module OrigenApb
|
2
|
+
class Driver
|
3
|
+
REQUIRED_PINS = [:paddr_pin, :penable_pin, :pwrite_pin, :pwdata_pin, :pstrb_pin, :psel_pin]
|
4
|
+
|
5
|
+
include Origen::Model
|
6
|
+
attr_reader :owner
|
7
|
+
|
8
|
+
# Initialize owner
|
9
|
+
def initialize(owner, options = {})
|
10
|
+
if owner.is_a?(Hash)
|
11
|
+
@owner = parent
|
12
|
+
options = owner
|
13
|
+
else
|
14
|
+
@owner = owner
|
15
|
+
end
|
16
|
+
|
17
|
+
validate_pins(options)
|
18
|
+
|
19
|
+
if defined?(owner.class::APB_CONFIG)
|
20
|
+
options = owner.class::APB_CONFIG.merge(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
options = {
|
24
|
+
verbose: false,
|
25
|
+
init_state: :unknown
|
26
|
+
}.merge(options)
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate_pins(options)
|
30
|
+
@pclk_pin = options[:pclk_pin] if options[:pclk_pin]
|
31
|
+
@paddr_pin = options[:paddr_pin] if options[:paddr_pin]
|
32
|
+
@pprot_pin = options[:pprot_pin] if options[:pprot_pin]
|
33
|
+
@psel_pin = options[:psel_pin] if options[:psel_pin]
|
34
|
+
@penable_pin = options[:penable_pin] if options[:penable_pin]
|
35
|
+
@pwrite_pin = options[:pwrite_pin] if options[:pwrite_pin]
|
36
|
+
@pwdata_pin = options[:pwdata_pin] if options[:pwdata_pin]
|
37
|
+
@pstrb_pin = options[:pstrb_pin] if options[:pstrb_pin]
|
38
|
+
@prdata_pin = options[:prdata_pin] if options[:prdata_pin]
|
39
|
+
@pslverr_pin = options[:pslverr_pin] if options[:pslverr_pin]
|
40
|
+
|
41
|
+
#
|
42
|
+
@pclk_pin = @owner.pin(:pclk) if @pclk_pin.nil?
|
43
|
+
@psel_pin = @owner.pin(:psel0) if @psel_pin.nil?
|
44
|
+
@paddr_pin = @owner.pin(:paddr) if @paddr_pin.nil?
|
45
|
+
@pprot_pin = @owner.pin(:pprot) if @pprot_pin.nil?
|
46
|
+
@penable_pin = @owner.pin(:penable) if @penable_pin.nil?
|
47
|
+
@pwrite_pin = @owner.pin(:pwrite) if @pwrite_pin.nil?
|
48
|
+
@pwdata_pin = @owner.pin(:pwdata) if @pwdata_pin.nil?
|
49
|
+
@pstrb_pin = @owner.pin(:pstrb) if @pstrb_pin.nil?
|
50
|
+
@prdata_pin = @owner.pin(:prdata0) if @prdata_pin.nil?
|
51
|
+
@pslverr_pin = @owner.pin(:pslverr) if @pslverr_pin.nil?
|
52
|
+
rescue
|
53
|
+
puts 'Missing APB pins!'
|
54
|
+
puts "In order to use the APB driver your #{owner.class} class must either define"
|
55
|
+
puts 'the following pins (an alias is fine):'
|
56
|
+
puts REQUIRED_PINS
|
57
|
+
puts '-- or --'
|
58
|
+
puts 'Pass the pins in the initialization options:'
|
59
|
+
puts "sub_block :apb, class_name: 'OrigenApb::Driver', paddr: dut.pin(:paddr), penable: dut.pin(:penable), pwrite: dut.pin(:pwrite), pwdata: dut.pin(:pwdata), pstrb: dut.pin(:pstrb)"
|
60
|
+
raise 'APB driver error!'
|
61
|
+
end
|
62
|
+
|
63
|
+
# Read register. Handles register model as input or data/address pair.
|
64
|
+
# Sets up APB parameters values and passes along to pin-layer apb
|
65
|
+
# transaction method.
|
66
|
+
def read_register(reg_or_val, options = {})
|
67
|
+
options = {
|
68
|
+
paddr: options[:address] || reg_or_val.address,
|
69
|
+
pdata: reg_or_val,
|
70
|
+
pread: 1
|
71
|
+
}.merge(options)
|
72
|
+
# options[:paddr] = options[:paddr].to_hex
|
73
|
+
cc '==== APB Read Transaction ===='
|
74
|
+
if reg_or_val.respond_to?('data')
|
75
|
+
data = reg_or_val.data
|
76
|
+
name_string = 'Reg: ' + reg_or_val.name.to_s + ' '
|
77
|
+
else
|
78
|
+
data = reg_or_val
|
79
|
+
name_string = ''
|
80
|
+
end
|
81
|
+
cc name_string + 'Addr: 0x' + options[:paddr].to_s(16) + ' Data: 0x' + data.to_s(16)
|
82
|
+
apb_read_trans(options)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Read register. Handles register model as input or data/address pair.
|
86
|
+
# Sets up APB parameters values and passes along to pin-layer apb
|
87
|
+
# transaction method.
|
88
|
+
def write_register(reg_or_val, options = {})
|
89
|
+
options = {
|
90
|
+
paddr: options[:address] || reg_or_val.address,
|
91
|
+
pdata: reg_or_val,
|
92
|
+
pwrite: 1
|
93
|
+
}.merge(options)
|
94
|
+
cc '==== APB Write Transaction ===='
|
95
|
+
if reg_or_val.respond_to?('data')
|
96
|
+
data = reg_or_val.data
|
97
|
+
name_string = 'Reg: ' + reg_or_val.name.to_s + ' '
|
98
|
+
else
|
99
|
+
data = reg_or_val
|
100
|
+
name_string = ''
|
101
|
+
end
|
102
|
+
cc name_string + 'Addr: 0x' + options[:paddr].to_s(16) + ' Data: 0x' + data.to_s(16)
|
103
|
+
apb_write_trans(options)
|
104
|
+
end
|
105
|
+
|
106
|
+
def apb_read_trans(options = {})
|
107
|
+
# INITIAL INPUT STAGES TO BE SETUP HERE.
|
108
|
+
@psel_pin.drive(0)
|
109
|
+
@pwrite_pin.drive(0)
|
110
|
+
@penable_pin.drive(0)
|
111
|
+
@pstrb_pin.drive(0)
|
112
|
+
@pwdata_pin.drive(0)
|
113
|
+
tester.cycle
|
114
|
+
# This is the SETUPa
|
115
|
+
@paddr_pin.drive(options[:paddr])
|
116
|
+
@pwrite_pin.drive(0)
|
117
|
+
@psel_pin.drive(1) # User or Test (0 or 1)
|
118
|
+
@pstrb_pin.drive(0)
|
119
|
+
@penable_pin.drive(1)
|
120
|
+
@prdata_pin.assert(options[:pdata])
|
121
|
+
tester.cycle
|
122
|
+
@prdata_pin.dont_care
|
123
|
+
# This is next phase?
|
124
|
+
@pwrite_pin.drive(0)
|
125
|
+
@psel_pin.drive(0)
|
126
|
+
@penable_pin.drive(0)
|
127
|
+
@pstrb_pin.drive(0)
|
128
|
+
@pwdata_pin.drive(0)
|
129
|
+
tester.cycle
|
130
|
+
end
|
131
|
+
|
132
|
+
def apb_write_trans(options = {})
|
133
|
+
# INITIAL INPUT STAGES TO BE SETUP HERE.
|
134
|
+
@psel_pin.drive(0)
|
135
|
+
@pwrite_pin.drive(0)
|
136
|
+
@penable_pin.drive(0)
|
137
|
+
@pstrb_pin.drive(0)
|
138
|
+
@pwdata_pin.drive(0)
|
139
|
+
tester.cycle
|
140
|
+
# This is the SETUPa
|
141
|
+
@paddr_pin.drive(options[:paddr])
|
142
|
+
@pwrite_pin.drive(options[:pwrite])
|
143
|
+
@psel_pin.drive(1) # User or Test (0 or 1)
|
144
|
+
@pstrb_pin.drive(15)
|
145
|
+
@pwdata_pin.drive(options[:pdata])
|
146
|
+
@penable_pin.drive(1)
|
147
|
+
tester.cycle
|
148
|
+
@prdata_pin.dont_care
|
149
|
+
# This is next phase?
|
150
|
+
@pwrite_pin.drive(0)
|
151
|
+
@psel_pin.drive(0)
|
152
|
+
@penable_pin.drive(0)
|
153
|
+
@pstrb_pin.drive(0)
|
154
|
+
@pwdata_pin.drive(0)
|
155
|
+
tester.cycle
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
data/lib/origen_apb.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'origen'
|
2
|
+
require_relative '../config/application.rb'
|
3
|
+
require 'origen_testers'
|
4
|
+
module OrigenApb
|
5
|
+
# THIS FILE SHOULD ONLY BE USED TO LOAD RUNTIME DEPENDENCIES
|
6
|
+
# If this plugin has any development dependencies (e.g. dummy DUT or other models that are only used
|
7
|
+
# for testing), then these should be loaded from config/boot.rb
|
8
|
+
|
9
|
+
# Example of how to explicitly require a file
|
10
|
+
# require "origen_apb/my_file"
|
11
|
+
|
12
|
+
# Load all files in the lib/origen_apb directory.
|
13
|
+
# Note that there is no problem from requiring a file twice (Ruby will ignore
|
14
|
+
# the second require), so if you have a file that must be required first, then
|
15
|
+
# explicitly require it up above and then let this take care of the rest.
|
16
|
+
Dir.glob("#{File.dirname(__FILE__)}/origen_apb/**/*.rb").sort.each do |file|
|
17
|
+
require file
|
18
|
+
end
|
19
|
+
|
20
|
+
# Returns an instance of the OrigenApb::Driver
|
21
|
+
def apb
|
22
|
+
@origen_apb ||= Driver.new(self)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# You can define any Rake tasks to support your application here (or in any file
|
2
|
+
# ending in .rake in this directory).
|
3
|
+
#
|
4
|
+
# Rake (Ruby Make) is very useful for creating build scripts, see this short video
|
5
|
+
# for a quick introduction:
|
6
|
+
# http://railscasts.com/episodes/66-custom-rake-tasks
|
data/pattern/example.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Pattern.create do
|
2
|
+
|
3
|
+
cc 'Write to top-level register using reg model'
|
4
|
+
$dut.reg(:top_reg).write!(0x5555_AAAA)
|
5
|
+
|
6
|
+
cc 'Write to top-level register using data/address'
|
7
|
+
$dut.write_register(0xAAAA_5555, address: 0x20000000)
|
8
|
+
|
9
|
+
cc 'Read from top-level register using data/address'
|
10
|
+
$dut.read_register(0xAAAA_5555, address: 0x20000000)
|
11
|
+
|
12
|
+
cc 'Write to block-level register'
|
13
|
+
$dut.block.reg(:control).write!(0xBA5E_BA11)
|
14
|
+
|
15
|
+
cc 'Read from block-level register'
|
16
|
+
$dut.block.reg(:status).read!(0x0022_0000)
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
% render "layouts/basic.html" do
|
2
|
+
|
3
|
+
%# HTML tags can be embedded in mark down files if you want to do specific custom
|
4
|
+
%# formatting like this, but in most cases that is not required.
|
5
|
+
<h1><%= Origen.app.namespace %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
|
6
|
+
|
7
|
+
### Purpose
|
8
|
+
|
9
|
+
This plugin...
|
10
|
+
|
11
|
+
### How To Install
|
12
|
+
|
13
|
+
In your Gemfile add:
|
14
|
+
|
15
|
+
~~~ruby
|
16
|
+
gem "<%= Origen.app.name %>"
|
17
|
+
~~~
|
18
|
+
|
19
|
+
or if your application is a plugin, then add this to your <code>.gemspec</code>
|
20
|
+
|
21
|
+
~~~ruby
|
22
|
+
spec.add_runtime_dependency "<%= Origen.app.name %>", ">= <%= Origen.app.version %>"
|
23
|
+
~~~
|
24
|
+
|
25
|
+
__NOTE:__ In the case of a plugin, you will also need to <code>require '<%= Origen.app.name %>'</code> somewhere in your environment.
|
26
|
+
|
27
|
+
|
28
|
+
### How To Use
|
29
|
+
|
30
|
+
The driver supports sub_block instantiation and DUTs with multiple APB slaves.
|
31
|
+
|
32
|
+
Here is an example integration:
|
33
|
+
|
34
|
+
~~~ruby
|
35
|
+
class Pioneer
|
36
|
+
|
37
|
+
include Origen::TopLevel
|
38
|
+
|
39
|
+
def initialize
|
40
|
+
add_pin :psel
|
41
|
+
add_pin :paddr
|
42
|
+
add_pin :pwrite
|
43
|
+
add_pin :prdata
|
44
|
+
add_pin :penable
|
45
|
+
add_pin :pstrb
|
46
|
+
|
47
|
+
add_pin :psel1
|
48
|
+
add_pin :paddr1
|
49
|
+
add_pin :pwrite1
|
50
|
+
add_pin :prdata1
|
51
|
+
add_pin :penable1
|
52
|
+
add_pin :pstrb1
|
53
|
+
|
54
|
+
|
55
|
+
sub_block :apb, class_name: 'OrigenApb::Driver',
|
56
|
+
psel_pin: pin(:psel),
|
57
|
+
paddr_pin: pin(:paddr),
|
58
|
+
pwrite_pin: pin(:pwrite),
|
59
|
+
prdata_pin: pin(:prdata)
|
60
|
+
penable_pin: pin(:penable)
|
61
|
+
pstrb_pin: pin(:pstrb)
|
62
|
+
|
63
|
+
# create a driver for a 2nd port like this
|
64
|
+
# note different configuration settings can be used
|
65
|
+
sub_block :apb2, class_name: 'OrigenApb::Driver',
|
66
|
+
psel_pin: pin(:psel1),
|
67
|
+
paddr_pin: pin(:paddr1),
|
68
|
+
pwrite_pin: pin(:pwrite1),
|
69
|
+
prdata_pin: pin(:prdata1)
|
70
|
+
penable_pin: pin(:penable1)
|
71
|
+
pstrb_pin: pin(:pstrb1)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
dut.apb # => apb driver for the first port (psel, paddr, pwrite, prdata, penable, pstrb)
|
77
|
+
dut.apb2 # => apb driver for the second port (psel1, paddr1, pwrite1, prdata1, penable1, pstrb1)
|
78
|
+
~~~
|
79
|
+
|
80
|
+
|
81
|
+
% end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
title: <%= options[:title] || Origen.config.name %>
|
3
|
+
---
|
4
|
+
<%= render "partials/navbar.html", tab: options[:tab] %>
|
5
|
+
|
6
|
+
<div class="row">
|
7
|
+
%# The markdown attribute is important if you are going to include content written
|
8
|
+
%# in markdown, without this is will be included verbatim
|
9
|
+
<div class="span12" markdown="1">
|
10
|
+
<%= yield %>
|
11
|
+
|
12
|
+
</div>
|
13
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<nav class="navbar navbar-inverse navbar-fixed-top">
|
2
|
+
<div class="container">
|
3
|
+
<div class="navbar-header">
|
4
|
+
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
|
5
|
+
<span class="sr-only">Toggle navigation</span>
|
6
|
+
<span class="icon-bar"></span>
|
7
|
+
<span class="icon-bar"></span>
|
8
|
+
<span class="icon-bar"></span>
|
9
|
+
</button>
|
10
|
+
<a class="navbar-brand" href="<%= path "/" %>">Home</a>
|
11
|
+
</div>
|
12
|
+
<div id="navbar" class="collapse navbar-collapse">
|
13
|
+
<ul class="nav navbar-nav">
|
14
|
+
<li class="<%= options[:tab] == :api ? 'active' : '' %>"><a href="<%= path "/api/" %>">API</a></li>
|
15
|
+
<li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
|
16
|
+
</ul>
|
17
|
+
<%= import "origen/web/logo.html" %>
|
18
|
+
</div><!--/.nav-collapse -->
|
19
|
+
</div>
|
20
|
+
</nav>
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: origen_apb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Priyavadan Kumar
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: origen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.33.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.33.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: origen_testers
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- priyavadan.kumar@nxp.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- bin/fix_my_workspace
|
49
|
+
- config/application.rb
|
50
|
+
- config/boot.rb
|
51
|
+
- config/commands.rb
|
52
|
+
- config/version.rb
|
53
|
+
- lib/origen_apb.rb
|
54
|
+
- lib/origen_apb/driver.rb
|
55
|
+
- lib/tasks/origen_apb.rake
|
56
|
+
- pattern/example.rb
|
57
|
+
- templates/web/index.md.erb
|
58
|
+
- templates/web/layouts/_basic.html.erb
|
59
|
+
- templates/web/partials/_navbar.html.erb
|
60
|
+
- templates/web/release_notes.md.erb
|
61
|
+
homepage:
|
62
|
+
licenses: []
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '2'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.8.11
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.6.11
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: Origen APB Protocol Driver
|
84
|
+
test_files: []
|