cross_origen 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,96 @@
1
+ % render "layouts/basic.html", tab: :examples do
2
+
3
+ ## Origen Export
4
+
5
+ This page shows how to create static read-only Ruby files from
6
+ models created by importing 3rd party data (e.g. IP-XACT). The Ruby files can then be
7
+ used for day-day running of your application and this will significantly improve
8
+ the boot up speed vs. re-importing the data every time.
9
+
10
+ The Ruby files can be periodically refreshed as new versions of the master
11
+ data are released.
12
+
13
+ The user only need provide the output path where they want the
14
+ Ruby files to be written.
15
+
16
+ ### Implementation
17
+
18
+ Here is an example of how to create the static Ruby files.
19
+
20
+ ~~~ruby
21
+ $dut.to_origen(path: "#{Origen.root}/output/exported")
22
+ ~~~
23
+
24
+ ### Output
25
+
26
+ At the output path the following files are created:
27
+
28
+ * top_level.rb: The top-level object, this is the one that should be instantiated
29
+
30
+ ~~~ruby
31
+ # This file is created by Origen, CrossOrigen::OrigenFormat#export, and is read-only
32
+ require_relative 'sub_blocks'
33
+ module CrossOrigen
34
+ module Test
35
+ class DUT
36
+ include Origen::Model
37
+
38
+ def initialize(options = {})
39
+ sub_block :atx, base_address: 0xDEADBEEF, class_name: 'ATX'
40
+ sub_block # ...
41
+ end
42
+ end
43
+ end
44
+ end
45
+ ~~~
46
+
47
+ * sub_blocks.rb: include file for the sub_block class files
48
+
49
+ ~~~ruby
50
+ # This file is created by Origen, CrossOrigen::OrigenFormat#export, and is read-only
51
+ require_relative 'import/atx.rb'
52
+ require_relative # ...
53
+ ~~~
54
+
55
+ * import/\<sub_block\>.rb: models the individual sub_block object
56
+
57
+ ~~~ruby
58
+ # -*- encoding : utf-8 -*-
59
+ # This file is created by Origen, CrossOrigen::OrigenFormat#export, and is read-only.
60
+ # If you need to make changes, re-open the class
61
+ module CrossOrigen
62
+ module Test
63
+ class DUT
64
+ class ATX # rubocop:disable ClassLength
65
+ include Origen::Model
66
+
67
+ def initialize(options = {})
68
+ instantiate_registers(options)
69
+ end
70
+
71
+ # rubocop:disable LineLength
72
+ # rubocop:disable StringLiterals
73
+ def instantiate_registers(options = {}) # rubocop:disable MethodLength
74
+ # ** MGATE Clock Divider Register **
75
+ # The MCLKDIV register is used to divide down the frequency of the HBOSCCLK input. If the MCLKDIV
76
+ # register is set to value "N", then the output (beat) frequency of the clock divider is OSCCLK / (N+1). The
77
+ # resulting beats are, in turn, counted by the PTIMER module to control the duration of Flash high-voltage
78
+ # operations.
79
+ reg :mclkdiv, 0x0, size: 16 do |reg|
80
+ # **Oscillator (Hi)** - Firmware FMU clk source selection. (Note that in addition to this firmware-controlled bit, the
81
+ # FMU clock source is also dependent on test and power control discretes).
82
+ #
83
+ # 0 | FMU clock is the externally supplied bus clock ipg_clk
84
+ # 1 | FMU clock is the internal oscillator from the TFS hardblock
85
+ reg.bit 15, :osch, reset: 0b1, access: :rw
86
+ # ...
87
+ end
88
+ # ...
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ ~~~
95
+
96
+ % end
@@ -0,0 +1,18 @@
1
+ % render "layouts/basic.html", tab: :examples do
2
+
3
+ ## RALF Export
4
+
5
+ This page shows RALF (Synopsys) formatted output that has been generated from an Origen
6
+ representation of a module.
7
+
8
+ The code to generate this page was simply:
9
+
10
+ ~~~eruby
11
+ <%= "<" + "%= $dut.to_ralf %" + ">" %>
12
+ ~~~
13
+
14
+ ~~~text
15
+ <%= $dut.to_ralf %>
16
+ ~~~
17
+
18
+ % end
@@ -0,0 +1,13 @@
1
+ % render "layouts/basic.html", tab: :examples do
2
+
3
+ # Examples
4
+
5
+ The following examples are available which are used for testing but
6
+ also provide some code examples of how to use the plugin for the various
7
+ supported formats:
8
+
9
+ * [IP-XACT Export](<%= path "examples/ip_xact_export" %>)
10
+ * [RALF Export](<%= path "examples/ralf_export" %>)
11
+ * [Origen Export](<%= path "examples/origen_export" %>)
12
+
13
+ % end
@@ -0,0 +1,104 @@
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.config.name %> <span style="font-size: 14px">(<%= Origen.app.version %>)</span></h1>
6
+
7
+ ### Purpose
8
+
9
+ In an ideal world everyone would use Origen, but in reality there are many different
10
+ 'standards' used to represent design data. This plugin
11
+ provides APIs and templates to import and export data to formats supported by 3rd
12
+ party tools.
13
+
14
+ ### How To Import
15
+
16
+ In your Gemfile add:
17
+
18
+ ~~~ruby
19
+ gem "<%= Origen.app.name %>", ">= <%= Origen.app.version %>"
20
+ ~~~
21
+
22
+ or if your application is a plugin add this to your .gemspec
23
+
24
+ ~~~ruby
25
+ spec.add_runtime_dependency "<%= Origen.app.name %>", ">= <%= Origen.app.version %>"
26
+ ~~~
27
+
28
+ ### How To Use
29
+
30
+ #### Supported Formats
31
+
32
+ Currently the following formats are supported:
33
+
34
+ * IP-XACT - Import and Export registers and hierarchy
35
+ * RALF (Synopsys format) - Export registers
36
+ * Origen - Export registers and hierarchy
37
+
38
+ See the [examples](<%= path "examples" %>) for format specific documentation, but
39
+ most formats should follow this basic structure...
40
+
41
+ #### Data Import
42
+
43
+ When the <code>CrossOrigen</code> module is included in a class it gets access
44
+ to an <code>cr_import</code> method.
45
+ This will automatically detect the type of the given file and select the appropriate
46
+ import rules.
47
+
48
+ The file to be imported must exist locally or it can be pulled automatically from
49
+ a 3rd party respository in which case the file will be fetched the first time Origen
50
+ is invoked and then cached locally for future invocations.
51
+ Supported repositories are shown in the example below.
52
+
53
+ ~~~ruby
54
+ class D_IP_ANA_TEST_ANNEX_SYN
55
+
56
+ include CrossOrigen
57
+
58
+ def initialize
59
+ # Import from a local file
60
+ cr_import(path: "#{Origen.root}/imports/test-annex-Block-registers.xml")
61
+ # Import from Design Sync
62
+ cr_import(vault: "sync://sync-15040:15040/Projects/nvm_c90tfsn2w/ftf2/rtl_v/kx2_4m/.regs", version: "ftf2_kx2_4096k2_256_128k_64_4k.00.00.01.00")
63
+ end
64
+
65
+ end
66
+ ~~~
67
+
68
+ The plugin will add attribute getter and setter methods to the top-level object and to registers and bits
69
+ to contain any metadata information which does not have a direct equivalent within Origen. Generally
70
+ the name given to such data will be the lower cased and underscored (following std Ruby
71
+ conventions) version of the attribute name.
72
+
73
+ #### Data Export
74
+
75
+ The <code>CrossOrigen</code> module adds some methods to export the given object
76
+ as a string in the given format, for example a <code>to_ip_xact</code> method is available
77
+ to generate an IP-XACT XML representation of an object.
78
+
79
+ To create an actual XML file a simple template would be setup as shown below
80
+ and then compiled through Origen:
81
+
82
+ ~~~eruby
83
+ <%= "<" + "%= $dut.to_ip_xact %" + ">" %>
84
+ ~~~
85
+
86
+ In future support may be added to export directly to a 3rd party tool if
87
+ it provides such an API.
88
+
89
+ ### How To Setup a Development Environment
90
+
91
+ [Clone the repository from Github](https://github.com/Origen-SDK/cross_origen).
92
+
93
+ Follow the instructions here if you want to make a 3rd party app
94
+ workspace use your development copy of the <%= Origen.app.config.initials %> plugin:
95
+ [Setting up a Plugin Development Environment](http://origen-sdk.org/origen/latest/guides/plugins)
96
+
97
+ This plugin also contains a test suite, make sure this passes before committing
98
+ any changes!
99
+
100
+ ~~~text
101
+ origen test
102
+ ~~~
103
+
104
+ % end
@@ -0,0 +1,13 @@
1
+ ---
2
+ title: <%= options[:title] || Origen.config.name %>
3
+ ---
4
+ <%= render "templates/web/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,61 @@
1
+ ---
2
+ title: <%= options[:title] || Origen.config.name %>
3
+ ---
4
+ <%= render "templates/web/partials/navbar.html", tab: :docs %>
5
+
6
+ %# Add/edit sections here, the code below will expand this with the correct markup,
7
+ %# pass in the topic you want selected via the :tab option.
8
+ % s = {}
9
+ % s["Environment"] = {
10
+ % environment_introduction: "Introduction",
11
+ % environment_installation: "Installation",
12
+ % environment_definitions: "Definitions and Acronyms",
13
+ % }
14
+ % s["Targets"] = {
15
+ % targets_introduction: "Introduction",
16
+ % targets_supported: "Supported",
17
+ % }
18
+ % s["Developers"] = {
19
+ % developers_branching: "Making Branches",
20
+ % }
21
+
22
+
23
+
24
+ <div class="row">
25
+ <div class="span3">
26
+ <div class="well sidebar-nav">
27
+ <div class="accordion" id="sidebar-accordion">
28
+
29
+ % s.each_with_index do |(subject, sections), i|
30
+ <div class="accordion-group">
31
+ <div class="accordion-heading">
32
+ <a class="accordion-toggle" data-toggle="collapse" data-parent="#sidebar-accordion" href="#sidebar-collapse-<%= i %>">
33
+ <%= subject %>
34
+ </a>
35
+ </div>
36
+ <div id="sidebar-collapse-<%= i %>" class="accordion-body collapse <%= sections.has_key?(options[:tab]) ? 'in' : '' %>">
37
+ <div class="accordion-inner">
38
+ <ul class="nav nav-list">
39
+ % sections.each do |tab, section|
40
+ % paths = tab.to_s.split("_")
41
+ <li class="<%= tab == options[:tab] ? 'active' : '' %>"><a href="<%= path "/docs/#{paths[0]}/#{paths[1]}" %>"><%= section %></a></li>
42
+ % end
43
+ </ul>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ % end
48
+
49
+ </div>
50
+
51
+ </div>
52
+ </div>
53
+
54
+ %# The markdown attribute is important if you are going to include content written
55
+ %# in markdown, without this is will be included verbatim
56
+ <div class="span9" markdown="1">
57
+ <%= yield %>
58
+ %# Also important to avoid indentation on return here, since otherwise it could be interpreted
59
+ %# as mardown code
60
+ </div>
61
+ </div>
@@ -0,0 +1,23 @@
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] == :examples ? 'active' : '' %>"><a href="<%= path "/examples" %>">Examples</a></li>
15
+ <li class="<%= options[:tab] == :api ? 'active' : '' %>"><a href="<%= path "/api/" %>">API</a></li>
16
+ <li class="<%= options[:tab] == :coverage ? 'active' : '' %>"><a href="<%= path "/coverage" %>">Coverage</a></li>
17
+ <li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
18
+ <li><a href="https://github.com/Origen-SDK/origen_jtag">Github</a></li>
19
+ </ul>
20
+ <%= import "origen/web/logo.html" %>
21
+ </div><!--/.nav-collapse -->
22
+ </div>
23
+ </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,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cross_origen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Stephen McGinty
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-08-06 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.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.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sanitize
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: origen_doc_helpers
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.2.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.2.0
55
+ description:
56
+ email:
57
+ - stephen.f.mcginty@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - config/application.rb
63
+ - config/commands.rb
64
+ - config/development.rb
65
+ - config/environment.rb
66
+ - config/users.rb
67
+ - config/version.rb
68
+ - lib/cross_origen.rb
69
+ - lib/cross_origen/design_sync.rb
70
+ - lib/cross_origen/headers.rb
71
+ - lib/cross_origen/ip_xact.rb
72
+ - lib/cross_origen/origen_format.rb
73
+ - lib/cross_origen/ralf.rb
74
+ - lib/cross_origen/test/dut.rb
75
+ - lib/cross_origen/xml_doc.rb
76
+ - templates/headers/default.h.erb
77
+ - templates/ralf/_register.ralf.erb
78
+ - templates/ralf/default.ralf.erb
79
+ - templates/test/default.ralf.erb
80
+ - templates/test/headers_default.h.erb
81
+ - templates/test/ip_xact.xml.erb
82
+ - templates/web/_history.md
83
+ - templates/web/example.md.erb
84
+ - templates/web/examples.md.erb
85
+ - templates/web/examples/ip_xact_export.md.erb
86
+ - templates/web/examples/origen_export.md.erb
87
+ - templates/web/examples/ralf_export.md.erb
88
+ - templates/web/index.md.erb
89
+ - templates/web/layouts/_basic.html.erb
90
+ - templates/web/layouts/_doc.html.erb
91
+ - templates/web/partials/_navbar.html.erb
92
+ - templates/web/release_notes.md.erb
93
+ homepage: http://origen-sdk.org/cross_origen
94
+ licenses: []
95
+ metadata: {}
96
+ post_install_message:
97
+ rdoc_options: []
98
+ require_paths:
99
+ - lib
100
+ required_ruby_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: 1.9.3
105
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - ">="
108
+ - !ruby/object:Gem::Version
109
+ version: 1.8.11
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 2.2.2
113
+ signing_key:
114
+ specification_version: 4
115
+ summary: Translators for importing and exporting Origen data to/from 3rd party formats
116
+ test_files: []
117
+ has_rdoc: