HDLRuby 3.7.1 → 3.7.3

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.
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "3.7.1"
2
+ VERSION = "3.7.3"
3
3
  end
data/lib/rubyHDL.rb CHANGED
@@ -6,6 +6,32 @@ require 'hruby_sim/hruby_sim'
6
6
  ########################################################################
7
7
  module RubyHDL
8
8
 
9
+ # Wrapper for array signal accesses.
10
+ class ArrayWrapper
11
+ # Create a new memory wrapper for signal +sig+
12
+ def initialize(sig)
13
+ @signal = sig
14
+ end
15
+
16
+ # Read the array.
17
+ def [](idx)
18
+ return RCSim.rcsim_read_index_fixnum(@signal,idx)
19
+ end
20
+
21
+ # Write to the array.
22
+ def []=(idx,val)
23
+ return RCSim.rcsim_write_index_fixnum_seq(@signal,idx,val)
24
+ end
25
+ end
26
+
27
+ # Creates a new array port 'name' assigned to signal 'sig'.
28
+ def self.arrayport(name,sig)
29
+ # Creating the accessing method.
30
+ define_singleton_method(name.to_sym) do
31
+ ArrayWrapper.new(sig)
32
+ end
33
+ end
34
+
9
35
  # Creates a new port 'name' assigned to signal 'sig' for reading.
10
36
  def self.inport(name,sig)
11
37
  # Create the accessing methods.
@@ -131,6 +131,12 @@ To do this, you can use the following command:</p>
131
131
  </code></pre>
132
132
  <p><strong>Note</strong>: for the command above, it is assumed that 'adder.v' contains a simulation benchmark.</p>
133
133
  <p>And that's it! For details about all the actions that can be performed, how to write an input file, and what kind of output can be produced, let us see the remaining of the tutorial.</p>
134
+ <h3>1.4. About the HDLRuby files.</h3>
135
+ <p>The HDLRuby files, that include HDLRuby description of circuits, are text files (the default encoding is UTF-8), is file name's extension is by convension <code>.rb</code>. It is possible to include other HDLRuby file within the current one using the <code>require</code> (for HDLRuby standard files) or <code>require_relative</code> (for local HDLRuby files) methods as follows:</p>
136
+ <pre><code class="language-ruby">require &quot;filename&quot;
137
+ require_relative &quot;path_to_another_filename&quot;
138
+ </code></pre>
139
+ <p>As it will be seen later, software Ruby code can also be used for generic descriptions of circuits. It is also possible to include Ruby code from different files using respectively <code>require_ruby</code> for standard libraries and gems, and <code>require_relative_ruby</code> for local files.</p>
134
140
  <h2>2. How to represent a circuit in HDLRuby</h2>
135
141
  <p>In this section we will see:</p>
136
142
  <ul>
data/tuto/tutorial_sw.md CHANGED
@@ -187,6 +187,18 @@ __Note__: for the command above, it is assumed that 'adder.v' contains a simulat
187
187
 
188
188
  And that's it! For details about all the actions that can be performed, how to write an input file, and what kind of output can be produced, let us see the remaining of the tutorial.
189
189
 
190
+ ### 1.4. About the HDLRuby files.
191
+
192
+ The HDLRuby files, that include HDLRuby description of circuits, are text files (the default encoding is UTF-8), is file name's extension is by convension `.rb`. It is possible to include other HDLRuby file within the current one using the `require` (for HDLRuby standard files) or `require_relative` (for local HDLRuby files) methods as follows:
193
+
194
+ ```ruby
195
+ require "filename"
196
+ require_relative "path_to_another_filename"
197
+ ```
198
+
199
+ As it will be seen later, software Ruby code can also be used for generic descriptions of circuits. It is also possible to include Ruby code from different files using respectively `require_ruby` for standard libraries and gems, and `require_relative_ruby` for local files.
200
+
201
+
190
202
 
191
203
  ## 2. How to represent a circuit in HDLRuby
192
204
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDLRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.1
4
+ version: 3.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-03-16 00:00:00.000000000 Z
10
+ date: 2025-04-14 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bundler
@@ -180,6 +180,7 @@ files:
180
180
  - lib/HDLRuby/hdr_samples/ruby_program/sw_inc_mem.rb
181
181
  - lib/HDLRuby/hdr_samples/ruby_program/sw_log.rb
182
182
  - lib/HDLRuby/hdr_samples/ruby_program/with_sw_hruby.rb
183
+ - lib/HDLRuby/hdr_samples/ruby_program/with_sw_hruby_function.rb
183
184
  - lib/HDLRuby/hdr_samples/ruby_program/with_sw_hruby_hruby_test.rb
184
185
  - lib/HDLRuby/hdr_samples/seqpar_bench.rb
185
186
  - lib/HDLRuby/hdr_samples/simple_counter_bench.rb
@@ -226,9 +227,11 @@ files:
226
227
  - lib/HDLRuby/hdr_samples/with_of.rb
227
228
  - lib/HDLRuby/hdr_samples/with_program_c.rb
228
229
  - lib/HDLRuby/hdr_samples/with_program_ruby.rb
230
+ - lib/HDLRuby/hdr_samples/with_program_ruby_array.rb
229
231
  - lib/HDLRuby/hdr_samples/with_program_ruby_cpu.rb
230
232
  - lib/HDLRuby/hdr_samples/with_program_ruby_io.rb
231
233
  - lib/HDLRuby/hdr_samples/with_program_ruby_mem.rb
234
+ - lib/HDLRuby/hdr_samples/with_program_ruby_sequencer.rb
232
235
  - lib/HDLRuby/hdr_samples/with_program_ruby_threads.rb
233
236
  - lib/HDLRuby/hdr_samples/with_reconf.rb
234
237
  - lib/HDLRuby/hdr_samples/with_reduce.rb