origen_standard_subblocks 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ceb70165c121842f71b42652b909105622390bcf753df908b514a91cb7490686
4
+ data.tar.gz: ed0759a994c88e9a12d48103442ac4dc229a6674e67bcb5e1bbe314588b58dd7
5
+ SHA512:
6
+ metadata.gz: bc3f9f243b91f9318898528bb3a7b86984cbd9047dc3ad442b6b139dab830d66b2587cd686f79ef6ab055bee0432a5326373515cb2b5bf951d546a08677204c1
7
+ data.tar.gz: 1bb270eb04677c3a3f652ef051506e4648520e2edb8e68f07c393975c7616eb158e803f65aebcaf74a24a7e81a53410d37e85b4f3957cd3d0de849ad0eec8735
@@ -0,0 +1,104 @@
1
+ require 'origen'
2
+ class OrigenStandardSubblocksApplication < 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_standard_subblocks"
10
+ self.namespace = "OrigenStandardSubblocks"
11
+ config.name = "origen_standard_subblocks"
12
+ config.initials = "OrigenStandardSubblocks"
13
+ config.rc_url = "git@github.com:Origen-SDK/origen_standard_subblocks.git"
14
+ config.release_externally = true
15
+ config.gem_name = "origen_standard_subblocks"
16
+
17
+
18
+ # To enable deployment of your documentation to a web server (via the 'origen web'
19
+ # command) fill in these attributes.
20
+ config.web_directory = "git@github.com:Origen-SDK/Origen-SDK.github.io.git/standard_subblocks"
21
+ config.web_domain = "http://origen-sdk.org/standard_subblocks"
22
+
23
+ # When false Origen will be less strict about checking for some common coding errors,
24
+ # it is recommended that you leave this to true for better feedback and easier debug.
25
+ # This will be the default setting in Origen v3.
26
+ config.strict_errors = true
27
+
28
+ # See: http://origen-sdk.org/origen/latest/guides/utilities/lint/
29
+ config.lint_test = {
30
+ # Require the lint tests to pass before allowing a release to proceed
31
+ run_on_tag: true,
32
+ # Auto correct violations where possible whenever 'origen lint' is run
33
+ auto_correct: true,
34
+ # Limit the testing for large legacy applications
35
+ #level: :easy,
36
+ # Run on these directories/files by default
37
+ #files: ["lib", "config/application.rb"],
38
+ }
39
+
40
+ config.semantically_version = true
41
+
42
+ # An example of how to set application specific LSF parameters
43
+ #config.lsf.project = "msg.te"
44
+
45
+ # An example of how to specify a prefix to add to all generated patterns
46
+ #config.pattern_prefix = "nvm"
47
+
48
+ # An example of how to add header comments to all generated patterns
49
+ #config.pattern_header do
50
+ # cc "This is a pattern created by the example origen application"
51
+ #end
52
+
53
+ # By default all generated output will end up in ./output.
54
+ # Here you can specify an alternative directory entirely, or make it dynamic such that
55
+ # the output ends up in a setup specific directory.
56
+ #config.output_directory do
57
+ # "#{Origen.root}/output/#{$dut.class}"
58
+ #end
59
+
60
+ # Similarly for the reference files, generally you want to setup the reference directory
61
+ # structure to mirror that of your output directory structure.
62
+ #config.reference_directory do
63
+ # "#{Origen.root}/.ref/#{$dut.class}"
64
+ #end
65
+
66
+ # This will automatically deploy your documentation after every tag
67
+ #def after_release_email(tag, note, type, selector, options)
68
+ # command = "origen web compile --remote --api"
69
+ # Dir.chdir Origen.root do
70
+ # system command
71
+ # end
72
+ #end
73
+
74
+ # Ensure that all tests pass before allowing a release to continue
75
+ #def validate_release
76
+ # if !system("origen specs") || !system("origen examples")
77
+ # puts "Sorry but you can't release with failing tests, please fix them and try again."
78
+ # exit 1
79
+ # else
80
+ # puts "All tests passing, proceeding with release process!"
81
+ # end
82
+ #end
83
+
84
+ # To enabled source-less pattern generation create a class (for example PatternDispatcher)
85
+ # to generate the pattern. This should return false if the requested pattern has been
86
+ # dispatched, otherwise Origen will proceed with looking up a pattern source as normal.
87
+ #def before_pattern_lookup(requested_pattern)
88
+ # PatternDispatcher.new.dispatch_or_return(requested_pattern)
89
+ #end
90
+
91
+ # If you use pattern iterators you may come across the case where you request a pattern
92
+ # like this:
93
+ # origen g example_pat_b0.atp
94
+ #
95
+ # However it cannot be found by Origen since the pattern name is actually example_pat_bx.atp
96
+ # In the case where the pattern cannot be found Origen will pass the name to this translator
97
+ # if it exists, and here you can make any substitutions to help Origen find the file you
98
+ # want. In this example any instances of _b\d, where \d means a number, are replaced by
99
+ # _bx.
100
+ #config.pattern_name_translator do |name|
101
+ # name.gsub(/_b\d/, "_bx")
102
+ #end
103
+
104
+ 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_standard_subblocks.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_standard_subblocks"
12
+
13
+ module OrigenStandardSubblocksDev
14
+ # Example of how to explicitly require a file
15
+ # require "origen_standard_subblocks_dev/my_file"
16
+
17
+ # Load all files in the lib/origen_standard_subblocks_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_standard_subblocks_dev/**/*.rb").sort.each do |file|
22
+ require file
23
+ end
24
+ end
@@ -0,0 +1,79 @@
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_standard_subblocks/commands/my_command" # Would load file lib/origen_standard_subblocks/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
+ ## Example of how to make a command to run diff-based tests
37
+ #when "examples", "test"
38
+ # Origen.load_application
39
+ # status = 0
40
+ #
41
+ # # Compiler tests
42
+ # ARGV = %w(templates/example.txt.erb -t debug -r approved)
43
+ # load "origen/commands/compile.rb"
44
+ # # Pattern generator tests
45
+ # #ARGV = %w(some_pattern -t debug -r approved)
46
+ # #load "#{Origen.top}/lib/origen/commands/generate.rb"
47
+ #
48
+ # if Origen.app.stats.changed_files == 0 &&
49
+ # Origen.app.stats.new_files == 0 &&
50
+ # Origen.app.stats.changed_patterns == 0 &&
51
+ # Origen.app.stats.new_patterns == 0
52
+ #
53
+ # Origen.app.stats.report_pass
54
+ # else
55
+ # Origen.app.stats.report_fail
56
+ # status = 1
57
+ # end
58
+ # puts
59
+ # if @command == "test"
60
+ # Origen.app.unload_target!
61
+ # require "rspec"
62
+ # result = RSpec::Core::Runner.run(['spec'])
63
+ # status = status == 1 ? 1 : result
64
+ # end
65
+ # exit status # Exit with a 1 on the event of a failure per std unix result codes
66
+
67
+ # Always leave an else clause to allow control to fall back through to the
68
+ # Origen command handler.
69
+ else
70
+ # You probably want to also add the your commands to the help shown via
71
+ # origen -h, you can do this by assigning the required text to @application_commands
72
+ # before handing control back to Origen.
73
+ @application_commands = <<-EOT
74
+ tags Build a tags file for this app
75
+ EOT
76
+ # specs Run the specs (tests), -c will enable coverage
77
+ # examples Run the examples (tests), -c will enable coverage
78
+ # test Run both specs and examples, -c will enable coverage
79
+ end
data/config/version.rb ADDED
@@ -0,0 +1,8 @@
1
+ module OrigenStandardSubblocks
2
+ MAJOR = 0
3
+ MINOR = 1
4
+ BUGFIX = 0
5
+ DEV = nil
6
+
7
+ VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
+ end
@@ -0,0 +1,10 @@
1
+ require 'origen_testers'
2
+ require 'origen'
3
+ require_relative '../config/application.rb'
4
+
5
+ module OrigenStandardSubblocks
6
+ # Load the subblocks.
7
+ Dir.glob("#{File.dirname(__FILE__)}/origen_standard_subblocks/**/*.rb").sort.each do |file|
8
+ require file
9
+ end
10
+ end
@@ -0,0 +1,59 @@
1
+ module OrigenStandardSubblocks
2
+ # Simple subblock for modeling RAM.
3
+ # @note This currently assumes 32-bit addresses.
4
+ # @note This currently assumes Big-Endian address space (e.g., the RAM grows upwards).
5
+ class RAM
6
+ include Origen::Model
7
+
8
+ # Create a new <code>OrigenStandardSubblocks::RAM</code> object.
9
+ # @param [Hash] options Initializaton options.
10
+ # @option options [Fixnum] :length The length of the RAM, in bytes.
11
+ # @note The <code>length</code> option is a required option.
12
+ # @raise [Origen::Error] When <code>length</code> is not given as an option.
13
+ def initialize(options = {})
14
+ @length = options[:length]
15
+
16
+ if @length.nil?
17
+ Origen.app.fail(message: 'RAM subblock requires a :length option to be given!')
18
+ end
19
+ end
20
+
21
+ # Returns the start address (frst usable address) in the RAM.
22
+ # @return [Fixnum] Indicating the start address of the RAM.
23
+ def start_addr
24
+ base_address
25
+ end
26
+ alias_method :start_address, :start_addr
27
+ alias_method :start, :start_addr
28
+ alias_method :first_addr, :start_addr
29
+ alias_method :first_address, :start_addr
30
+ alias_method :first, :start_addr
31
+
32
+ # Returns the length of the RAM
33
+ # @return [Fixnum] Indicating the length of the RAM.
34
+ def length
35
+ @length
36
+ end
37
+ alias_method :size, :length
38
+
39
+ # Returns the total number of RAM addresses available.
40
+ # @note This assumes 32-bit addresses
41
+ # @note This also functions as the number of 32-bit words.
42
+ # @return [Fixnum] Indicating the number of RAM addresses available.
43
+ def size
44
+ @length / 4
45
+ end
46
+
47
+ # Returns the end address: i.e., the last usable address (not the length).
48
+ # @note This assume 32-bit addresses
49
+ # @return [Fixnum] Indicating the last usable address.
50
+ def end_addr
51
+ start_addr + length - 4
52
+ end
53
+ alias_method :end_address, :end_addr
54
+ alias_method :end, :end_addr
55
+ alias_method :last_addr, :end_addr
56
+ alias_method :last_address, :end_addr
57
+ alias_method :last, :end_addr
58
+ end
59
+ end
@@ -0,0 +1,38 @@
1
+ module OrigenStandardSubblocks
2
+ class RAMController
3
+ include Origen::Controller
4
+
5
+ # Shortcut for <code>mem</code>, where the base address is added to the index.
6
+ # @param [Fixnum] index Offset index in the RAM. Note that standard index notation is used.
7
+ # I.e., an index of 0 corresponds to the first usable address and an
8
+ # index of 1 corresponds to the second usable address.
9
+ # @return [Origen:Registers::Reg]
10
+ # @example Get a <code>Origen::Registers::Reg</code> object for the first usable memory location (indexes start at 0)
11
+ # r = dut.ram[0]
12
+ # r.class #=> Origen::Registers::Reg
13
+ # r.address.to_hex #=> '0x100'
14
+ # @example Get a <code>Origen::Registers::Reg</code> object for the second usable memory location (indexes start at 0)
15
+ # # Assume base address is 0x100 and the length is 0x10
16
+ # r = dut.ram[1]
17
+ # r.class #=> Origen::Registers::Reg
18
+ # r.address.to_hex #=> '0x104'
19
+ # @todo Add support for negative index notation & ranges.
20
+ # @todo Add support for bounds checking.
21
+ def [](index)
22
+ dut.mem(start_addr + (4 * index))
23
+ end
24
+
25
+ # Shortcut for <code>mem.write!</code>, where the base address is added to the index.
26
+ # @param [Fixnum] index Offset index in the RAM. Note that standard index notation is used.
27
+ # I.e., an index of 0 corresponds to the first usable address and an
28
+ # index of 1 corresponds to the second usable address.
29
+ # @param [Fixnum] data Data to write to the RAM location indicated by the index.
30
+ # Or: <code>RAM[index] <= data</code>
31
+ # @return [Origen::Registers::BitCollection]
32
+ # @todo Add support for negative index notation & ranges.
33
+ # @todo Add support for bounds checking.
34
+ def []=(index, data)
35
+ self[index].write!(data)
36
+ end
37
+ end
38
+ 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
@@ -0,0 +1,5 @@
1
+ Pattern.create do
2
+ # Registers should never be written directly from here, always call API methods
3
+ # that are defined by your controllers
4
+ dut.ram.do_something
5
+ end
@@ -0,0 +1,37 @@
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
+ Add quickstart documentation here...
31
+
32
+
33
+ ### How To Setup a Development Environment
34
+
35
+ Describe how a developer would setup a new workspace for this plugin...
36
+
37
+ % 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>
@@ -0,0 +1,5 @@
1
+ % render "layouts/basic.html", tab: :release do
2
+
3
+ <%= render "#{Origen.root}/doc/history" %>
4
+
5
+ % end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: origen_standard_subblocks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Corey Engelken
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-01-16 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.41.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.41.2
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.6.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.1
41
+ description:
42
+ email:
43
+ - coreyengelken@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - config/application.rb
49
+ - config/boot.rb
50
+ - config/commands.rb
51
+ - config/version.rb
52
+ - lib/origen_standard_subblocks.rb
53
+ - lib/origen_standard_subblocks/RAM/ram.rb
54
+ - lib/origen_standard_subblocks/RAM/ram_controller.rb
55
+ - lib/tasks/origen_standard_subblocks.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: https://origen-sdk.org/arm/standard_subblocks
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '2'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: 1.8.11
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.7.7
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Simple, elementary, pre-defined subblocks to easily model common SoC blocks.
85
+ test_files: []