origen_memory_image 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,164 +1,179 @@
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
- This plugin provides a common API for easily reading memory image files in any format
10
- so that their contained data can then be used in Origen:
11
-
12
- ~~~ruby
13
- # Read in an s-record
14
- srec = OrigenMemoryImage.new("srecs/test_atd.abs.S19")
15
-
16
- # Write it to the DUT, or otherwise work with it, however you like
17
- srec.to_a.each do |addr, data|
18
- $dut.write_memory data, address: addr
19
- end
20
- ~~~
21
-
22
- ### How To Import
23
-
24
- ##### To use in an application:
25
-
26
- Add the following to your application's <code>Gemfile</code>:
27
-
28
- ~~~ruby
29
- gem 'origen_memory_image', '<%= Origen.app.version %>'
30
- ~~~
31
-
32
- ##### To use in a plugin:
33
-
34
- Add the following to your plugin's gemspec:
35
-
36
- ~~~ruby
37
- spec.add_runtime_dependency 'origen_memory_image', '~> <%= Origen.app.version.major %>', '>= <%= Origen.app.version %>'
38
- ~~~
39
-
40
- and require the gem in your code:
41
-
42
- ~~~ruby
43
- require 'origen_memory_image'
44
- ~~~
45
-
46
-
47
- ### How To Use
48
-
49
- Create a memory map object that points to a specific source file, note that
50
- you do not need to supply the format.
51
- Also note that the format is detected by looking at the file content and the naming
52
- and extension of the file has no relevance (so it can be called anything).
53
-
54
- The path to the file can be absolute or relative to <code>Origen.root</code>:
55
-
56
- ~~~ruby
57
- my_srec = OrigenMemoryImage.new("source_files/test_atd.abs.S19")
58
- my_hex = OrigenMemoryImage.new("source_files/math.hex")
59
- ~~~
60
-
61
- Memory images can also be created directly from a string:
62
-
63
- ~~~ruby
64
- str = <<-END
65
- @2D100E00
66
- 0D 15 0F 13 0E 14 10 12
67
- 00 00 04 17 04 03 05 06
68
- END
69
-
70
- my_hex = OrigenMemoryImage.new(str, source: String)
71
- ~~~
72
-
73
- Every memory image object then supports a common API.
74
-
75
- The <code>start_address</code> method returns the start (execution start) address:
76
-
77
- ~~~ruby
78
- my_srec.start_address # => 0x3000_F000
79
- ~~~
80
-
81
- The <code>to_a</code> method returns the file content as an array of address/data pairs,
82
- this method supports options to set the data width, flip the data endianness, and crop the data
83
- between starting and ending address:
84
-
85
- ~~~ruby
86
- my_srec.to_a # => [[0x3000_F000, 0x11223344], [0x3000_F004, 0x55667788], [0x3000_F008, 0x99AABBCC], ...]
87
-
88
- my_srec.to_a(flip_endianness: true) # => [[0x3000_F000, 0x44332211], [0x3000_F004, 0x88776655], [0x3000_F008, 0x99AABBCC], ...]
89
-
90
- my_srec.to_a(data_width_in_bytes: 2) # => [[0x3000_F000, 0x1122], [0x3000_F002, 0x3344], [0x3000_F004, 0x5566], ...]
91
-
92
- my_srec.to_a(crop: [0x3000_F004]) # => [[0x3000_F004, 0x55667788], [0x3000_F008, 0x99AABBCC], ...]
93
-
94
- my_srec.to_a(crop: [0x3000_F000, 0x3000_F004]) # => [[0x3000_F000, 0x11223344], [0x3000_F004, 0x55667788]]
95
-
96
- ~~~
97
-
98
- Such an array can be iterated on like this to separate the address and data:
99
-
100
- ~~~ruby
101
- my_srec.to_a.each do |address, data|
102
- # Process as required
103
- end
104
- ~~~
105
-
106
- ### Currently Supported Formats
107
-
108
- #### S-Records
109
-
110
- Any valid S-record:
111
-
112
- ~~~text
113
- S017000068656C6C6F5F776F726C645F6576622E73726563D6
114
- S3153F00002018F09FE518F09FE518F09FE518F09FE55B
115
- S3153F00003018F09FE500F020E314F09FE514F09FE5EC
116
- S3113F000270F406003F102100407800003FDC
117
- S3153F0005B05FF0FF301B4908605FF0FF301A49086063
118
- S3093F0006F0704700000A
119
- S7053F000410A7
120
- ~~~
121
-
122
- #### Hex Files
123
-
124
- The data lines can be grouped into any size:
125
-
126
- ~~~text
127
- @18000000
128
- 1E E0 02 1C 22 40 1B E0 02 1C 22 43 18 E0 02 1C
129
- 5A 78 0A 43 03 E0 03 4B F7 21 5A 78 0A 40 00 20
130
- 22 E0 84 42 22 D3 1F E0 84 42 1F D9 1C E0 84 42
131
- @180000E0
132
- 002B20D1 03E0012A 01D1002B 1BD00223
133
- 2340022A 02D1002B 15D103E0 032A01D1
134
- @180001F0
135
- 780000187C0000188200001888000018
136
- ~~~
137
-
138
- #### Binary Files
139
-
140
- A binary file:
141
-
142
- ~~~text
143
- 00001101000101010000111100010011
144
- 00001110000101000001000000010010
145
- 00000000000000000000010000010111
146
- 00000100000000110000010100000110
147
- ~~~
148
-
149
- ### How To Setup a Development Environment
150
-
151
- [Clone the repository from Github](https://github.com/Origen-SDK/origen_memory_image).
152
-
153
- Follow the instructions here if you want to make a 3rd party app
154
- workspace use your development copy of the <%= Origen.app.config.initials %> plugin:
155
- [Setting up a Plugin Development Environment](http://origen-sdk.org/origen/latest/guides/plugins)
156
-
157
- This plugin also contains a test suite, makes sure this passes before committing
158
- any changes!
159
-
160
- ~~~text
161
- origen specs
162
- ~~~
163
-
164
- % end
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
+ This plugin provides a common API for easily reading memory image files in any format
10
+ so that their contained data can then be used in Origen:
11
+
12
+ ~~~ruby
13
+ # Read in an s-record
14
+ srec = OrigenMemoryImage.new("srecs/test_atd.abs.S19")
15
+
16
+ # Write it to the DUT, or otherwise work with it, however you like
17
+ srec.to_a.each do |addr, data|
18
+ $dut.write_memory data, address: addr
19
+ end
20
+ ~~~
21
+
22
+ ### How To Import
23
+
24
+ ##### To use in an application:
25
+
26
+ Add the following to your application's <code>Gemfile</code>:
27
+
28
+ ~~~ruby
29
+ gem 'origen_memory_image', '<%= Origen.app.version %>'
30
+ ~~~
31
+
32
+ ##### To use in a plugin:
33
+
34
+ Add the following to your plugin's gemspec:
35
+
36
+ ~~~ruby
37
+ spec.add_runtime_dependency 'origen_memory_image', '~> <%= Origen.app.version.major %>', '>= <%= Origen.app.version %>'
38
+ ~~~
39
+
40
+ and require the gem in your code:
41
+
42
+ ~~~ruby
43
+ require 'origen_memory_image'
44
+ ~~~
45
+
46
+
47
+ ### How To Use
48
+
49
+ Create a memory map object that points to a specific source file, note that
50
+ you do not need to supply the format.
51
+ Also note that the format is detected by looking at the file content and the naming
52
+ and extension of the file has no relevance (so it can be called anything).
53
+
54
+ The path to the file can be absolute or relative to <code>Origen.root</code>:
55
+
56
+ ~~~ruby
57
+ my_srec = OrigenMemoryImage.new("source_files/test_atd.abs.S19")
58
+ my_hex = OrigenMemoryImage.new("source_files/math.hex")
59
+ ~~~
60
+
61
+ Memory images can also be created directly from a string:
62
+
63
+ ~~~ruby
64
+ str = <<-END
65
+ @2D100E00
66
+ 0D 15 0F 13 0E 14 10 12
67
+ 00 00 04 17 04 03 05 06
68
+ END
69
+
70
+ my_hex = OrigenMemoryImage.new(str, source: String)
71
+ ~~~
72
+
73
+ Every memory image object then supports a common API.
74
+
75
+ The <code>start_address</code> method returns the start (execution start) address:
76
+
77
+ ~~~ruby
78
+ my_srec.start_address # => 0x3000_F000
79
+ ~~~
80
+
81
+ The <code>to_a</code> method returns the file content as an array of address/data pairs,
82
+ this method supports options to set the data width, flip the data endianness, and crop the data
83
+ between starting and ending address:
84
+
85
+ ~~~ruby
86
+ my_srec.to_a # => [[0x3000_F000, 0x11223344], [0x3000_F004, 0x55667788], [0x3000_F008, 0x99AABBCC], ...]
87
+
88
+ my_srec.to_a(flip_endianness: true) # => [[0x3000_F000, 0x44332211], [0x3000_F004, 0x88776655], [0x3000_F008, 0x99AABBCC], ...]
89
+
90
+ my_srec.to_a(data_width_in_bytes: 2) # => [[0x3000_F000, 0x1122], [0x3000_F002, 0x3344], [0x3000_F004, 0x5566], ...]
91
+
92
+ my_srec.to_a(crop: [0x3000_F004]) # => [[0x3000_F004, 0x55667788], [0x3000_F008, 0x99AABBCC], ...]
93
+
94
+ my_srec.to_a(crop: [0x3000_F000, 0x3000_F004]) # => [[0x3000_F000, 0x11223344], [0x3000_F004, 0x55667788]]
95
+
96
+ ~~~
97
+
98
+ Such an array can be iterated on like this to separate the address and data:
99
+
100
+ ~~~ruby
101
+ my_srec.to_a.each do |address, data|
102
+ # Process as required
103
+ end
104
+ ~~~
105
+
106
+ ### Currently Supported Formats
107
+
108
+ #### S-Records
109
+
110
+ Any valid S-record:
111
+
112
+ ~~~text
113
+ S017000068656C6C6F5F776F726C645F6576622E73726563D6
114
+ S3153F00002018F09FE518F09FE518F09FE518F09FE55B
115
+ S3153F00003018F09FE500F020E314F09FE514F09FE5EC
116
+ S3113F000270F406003F102100407800003FDC
117
+ S3153F0005B05FF0FF301B4908605FF0FF301A49086063
118
+ S3093F0006F0704700000A
119
+ S7053F000410A7
120
+ ~~~
121
+
122
+ #### Hex Files
123
+
124
+ The data lines can be grouped into any size:
125
+
126
+ ~~~text
127
+ @18000000
128
+ 1E E0 02 1C 22 40 1B E0 02 1C 22 43 18 E0 02 1C
129
+ 5A 78 0A 43 03 E0 03 4B F7 21 5A 78 0A 40 00 20
130
+ 22 E0 84 42 22 D3 1F E0 84 42 1F D9 1C E0 84 42
131
+ @180000E0
132
+ 002B20D1 03E0012A 01D1002B 1BD00223
133
+ 2340022A 02D1002B 15D103E0 032A01D1
134
+ @180001F0
135
+ 780000187C0000188200001888000018
136
+ ~~~
137
+
138
+ #### Binary Files
139
+
140
+ A binary file:
141
+
142
+ ~~~text
143
+ 00001101000101010000111100010011
144
+ 00001110000101000001000000010010
145
+ 00000000000000000000010000010111
146
+ 00000100000000110000010100000110
147
+ ~~~
148
+
149
+ #### Intel Hex
150
+
151
+ Any valid Intel Hex file:
152
+
153
+ ~~~text
154
+ :020000040022D8
155
+ :10010000214601360121470136007EFE09D2190140
156
+ :100110002146017E17C20001FF5F16002148011928
157
+ :020000040023D7
158
+ :10012000194E79234623965778239EDA3F01B2CAA7
159
+ :100130003F0156702B5E712B722B732146013421C7
160
+ :0400000500000000F7
161
+ :00000001FF
162
+ ~~~
163
+
164
+ ### How To Setup a Development Environment
165
+
166
+ [Clone the repository from Github](https://github.com/Origen-SDK/origen_memory_image).
167
+
168
+ Follow the instructions here if you want to make a 3rd party app
169
+ workspace use your development copy of the <%= Origen.app.config.initials %> plugin:
170
+ [Setting up a Plugin Development Environment](http://origen-sdk.org/origen/latest/guides/plugins)
171
+
172
+ This plugin also contains a test suite, makes sure this passes before committing
173
+ any changes!
174
+
175
+ ~~~text
176
+ origen specs
177
+ ~~~
178
+
179
+ % end
@@ -1,16 +1,16 @@
1
- ---
2
- title: <%= options[:title] || Origen.config.name %>
3
- analytics: UA-64455560-1
4
- ---
5
- <%= render "templates/web/partials/navbar.html", tab: options[:tab] %>
6
-
7
- <div class="row">
8
- %# The markdown attribute is important if you are going to include content written
9
- %# in markdown, without this is will be included verbatim
10
- <div class="span12" markdown="1">
11
- <%= yield %>
12
-
13
- <%= disqus_comments %>
14
-
15
- </div>
16
- </div>
1
+ ---
2
+ title: <%= options[:title] || Origen.config.name %>
3
+ analytics: UA-64455560-1
4
+ ---
5
+ <%= render "templates/web/partials/navbar.html", tab: options[:tab] %>
6
+
7
+ <div class="row">
8
+ %# The markdown attribute is important if you are going to include content written
9
+ %# in markdown, without this is will be included verbatim
10
+ <div class="span12" markdown="1">
11
+ <%= yield %>
12
+
13
+ <%= disqus_comments %>
14
+
15
+ </div>
16
+ </div>
@@ -1,22 +1,22 @@
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] == :coverage ? 'active' : '' %>"><a href="<%= path "/coverage" %>">Coverage</a></li>
16
- <li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
17
- <li><a href="https://github.com/Origen-SDK/origen_memory_image">Github</a></li>
18
- </ul>
19
- <%= import "origen/web/logo.html" %>
20
- </div><!--/.nav-collapse -->
21
- </div>
22
- </nav>
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] == :coverage ? 'active' : '' %>"><a href="<%= path "/coverage" %>">Coverage</a></li>
16
+ <li class="<%= options[:tab] == :release ? 'active' : '' %>"><a href="<%= path "/release_notes" %>">Release Notes</a></li>
17
+ <li><a href="https://github.com/Origen-SDK/origen_memory_image">Github</a></li>
18
+ </ul>
19
+ <%= import "origen/web/logo.html" %>
20
+ </div><!--/.nav-collapse -->
21
+ </div>
22
+ </nav>
@@ -1,5 +1,5 @@
1
- % render "layouts/basic.html", tab: :release do
2
-
3
- <%= render "#{Origen.root}/doc/history" %>
4
-
5
- % end
1
+ % render "layouts/basic.html", tab: :release do
2
+
3
+ <%= render "#{Origen.root}/doc/history" %>
4
+
5
+ % end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_memory_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen McGinty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-29 00:00:00.000000000 Z
11
+ date: 2018-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -53,6 +53,7 @@ files:
53
53
  - lib/origen_memory_image/base.rb
54
54
  - lib/origen_memory_image/binary.rb
55
55
  - lib/origen_memory_image/hex.rb
56
+ - lib/origen_memory_image/intel_hex.rb
56
57
  - lib/origen_memory_image/s_record.rb
57
58
  - templates/web/index.md.erb
58
59
  - templates/web/layouts/_basic.html.erb
@@ -77,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
78
  version: 1.8.11
78
79
  requirements: []
79
80
  rubyforge_project:
80
- rubygems_version: 2.6.7
81
+ rubygems_version: 2.7.7
81
82
  signing_key:
82
83
  specification_version: 4
83
84
  summary: Provides a standard API for consuming memory image files in any format e.g.