HDLRuby 3.3.4 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HDLRuby.gemspec +1 -0
- data/README.md +78 -7
- data/exe/v2hdr +3 -0
- data/ext/hruby_sim/hruby_rcsim_build.c +1 -0
- data/lib/HDLRuby/hdr_samples/adder8.v +6 -0
- data/lib/HDLRuby/hdr_samples/hard_to_route.rb +30 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_bench.rb +2 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_cpu_bench.rb +2 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_cpusim_bench.rb +2 -0
- data/lib/HDLRuby/hdr_samples/verilog_parser_bench.rb +36 -0
- data/lib/HDLRuby/hdr_samples/with_generic_in_generic.rb +31 -0
- data/lib/HDLRuby/hdr_samples/with_handshake.rb +2 -0
- data/lib/HDLRuby/hdr_samples/with_memory.rb +2 -0
- data/lib/HDLRuby/hdr_samples/with_nand_board.rb +1 -1
- data/lib/HDLRuby/hdr_samples/with_reconf.rb +1 -0
- data/lib/HDLRuby/hdr_samples/with_seq_case.rb +28 -0
- data/lib/HDLRuby/hdr_samples/with_seq_if.rb +25 -0
- data/lib/HDLRuby/hdr_samples/with_seq_if_succ.rb +27 -0
- data/lib/HDLRuby/hdr_samples/with_verilog.rb +24 -0
- data/lib/HDLRuby/hdrcc.rb +84 -27
- data/lib/HDLRuby/hruby_bstr.rb +2 -2
- data/lib/HDLRuby/hruby_high.rb +80 -24
- data/lib/HDLRuby/hruby_low.rb +4 -0
- data/lib/HDLRuby/hruby_tools.rb +0 -1
- data/lib/HDLRuby/hruby_viz.rb +5060 -0
- data/lib/HDLRuby/std/sequencer.rb +28 -13
- data/lib/HDLRuby/v2hdr.rb +39 -0
- data/lib/HDLRuby/verilog_hruby.rb +1153 -0
- data/lib/HDLRuby/verilog_parser.rb +7293 -0
- data/lib/HDLRuby/version.rb +1 -1
- data/tuto/tutorial_sw.html +2772 -4079
- data/tuto/tutorial_sw.md +89 -5
- metadata +17 -6
data/tuto/tutorial_sw.md
CHANGED
@@ -10,7 +10,7 @@ In this tutorial, you will learn the basics about the description of digital cir
|
|
10
10
|
|
11
11
|
4. [How to add parallelism to your algorithms.](#4-how-to-add-parallelism-to-your-algorithms)
|
12
12
|
|
13
|
-
Then, the following section will introduce advanced concepts about hardware design and
|
13
|
+
Then, the following section will introduce advanced concepts about hardware design and HDLRuby:
|
14
14
|
|
15
15
|
5. [Toward lower level hardware design: the processes.](#5-toward-lower-level-hardware-design-the-processes)
|
16
16
|
|
@@ -20,6 +20,8 @@ Then, the following section will introduce advanced concepts about hardware desi
|
|
20
20
|
|
21
21
|
8. [How to interact with the simulator.](#8-how-to-interact-with-the-simulator)
|
22
22
|
|
23
|
+
9. [What about using Verilog HDL instead?](#9-what-about-using-Verilog-hdl-instead)
|
24
|
+
|
23
25
|
Within these topics, you will also have an explanation of how the following high-level concepts can be used in HDLRuby:
|
24
26
|
|
25
27
|
* Object-oriented programming
|
@@ -46,7 +48,7 @@ To use HDLRuby the following software is required:
|
|
46
48
|
|
47
49
|
The following software is also recommended:
|
48
50
|
|
49
|
-
* A wave viewer supporting *vcd* files (e.g., [GTKWave](https://gtkwave.sourceforge.net/).)
|
51
|
+
* A wave viewer supporting *vcd* files (e.g., [GTKWave](https://gtkwave.sourceforge.net/), or, [HTMLWave](https://civol.github.io/htmlwave/htmlwave.html))
|
50
52
|
|
51
53
|
## 1. What is HDLRuby and how to use its framework
|
52
54
|
|
@@ -129,10 +131,10 @@ Up to now, we said that HDLRuby is a language, it is in truth a complete framewo
|
|
129
131
|
Basically, `hdrcc` is used as follows:
|
130
132
|
|
131
133
|
```bash
|
132
|
-
hdrcc <options> <input file> <output directory>
|
134
|
+
hdrcc <options> <input file> <output/working directory>
|
133
135
|
```
|
134
136
|
|
135
|
-
Where `options` specifies the action to be performed, `input file` specifies the input HDLRuby file, and `output directory` specifies the directory where the command results will be saved. As a general rule, when an input file is specified, an output directory must also be specified.
|
137
|
+
Where `options` specifies the action to be performed, `input file` specifies the input HDLRuby file, and `output/working directory` specifies the directory where the command results will be saved. As a general rule, when an input file is specified, an output directory must also be specified.
|
136
138
|
|
137
139
|
Several actions are possible using `hdrcc`, the main ones being the following:
|
138
140
|
|
@@ -142,6 +144,11 @@ Several actions are possible using `hdrcc`, the main ones being the following:
|
|
142
144
|
hdrcc --sim <input file> <output directory>
|
143
145
|
```
|
144
146
|
|
147
|
+
* Generate a graphical representation of the RTL code in SVG format:
|
148
|
+
|
149
|
+
```bash
|
150
|
+
hdrcc --svg <input file> <output directory>
|
151
|
+
|
145
152
|
* Generate the equivalent Verilog HDL code:
|
146
153
|
|
147
154
|
```bash
|
@@ -156,6 +163,28 @@ __Note__: VHDL generation is also possible using the following command.
|
|
156
163
|
hdrcc --vhdl <input file> <output directory>
|
157
164
|
```
|
158
165
|
|
166
|
+
While being able to convert HDLRuby to Verilog HDL may usually be enough to design a cricuits, it may also sometimes be useful to be able to do the reverse: converting a Verilog HDL file to HDLRuby.
|
167
|
+
To do this, you can use the following command:
|
168
|
+
|
169
|
+
```bash
|
170
|
+
v2hdr <input Verilog HDL file> <output HDLRuby file>
|
171
|
+
```
|
172
|
+
|
173
|
+
For example, assuming that you have a Verilog ddHDL named 'adder.v' describing and adder circuit, you can convert it to HDLRuby as follows:
|
174
|
+
|
175
|
+
```bash
|
176
|
+
v2hdr adder.v adder.rb
|
177
|
+
```
|
178
|
+
|
179
|
+
It is also possible to directly use a Verilog file as input to 'hdrcc', but its top module must be specified. For example, to directly simulate the previous 'adder.v', and assuming its top module is 'adder' you can do as follows:
|
180
|
+
|
181
|
+
```bash
|
182
|
+
hdrcc --sim -t adder adder.v adder
|
183
|
+
```
|
184
|
+
|
185
|
+
__Note__: for the command above, it is assumed that 'adder.v' contains a simulation benchmark.
|
186
|
+
|
187
|
+
|
159
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.
|
160
189
|
|
161
190
|
|
@@ -3776,7 +3805,62 @@ A more complete example can be found among the HDLRuby samples: `with_board.rb`,
|
|
3776
3805
|
</p>
|
3777
3806
|
|
3778
3807
|
|
3779
|
-
## 9. What
|
3808
|
+
## 9. What about using Verilog HDL instead?
|
3809
|
+
|
3810
|
+
I won’t claim how good HDLRuby is, but it’s clear that Verilog HDL (/ SystemVerilog) and VHDL are currently the leading languages in hardware design, and it would be unrealistic to expect this to change anytime soon. This means that for HDLRuby to offer any real benefit, the framework must be able to support one or both of these languages in some way. This is no easy task, but as a starting point, we now provide a tool for converting Verilog HDL files into HDLRuby files.
|
3811
|
+
For that please use the following command:
|
3812
|
+
|
3813
|
+
```bash
|
3814
|
+
v2hdr <input Verilog HDL file> <output HDLRuby file>
|
3815
|
+
```
|
3816
|
+
|
3817
|
+
For example, assuming that you have a Verilog ddHDL named 'adder.v' describing and adder circuit, you can convert it to HDLRuby as follows:
|
3818
|
+
|
3819
|
+
```bash
|
3820
|
+
v2hdr adder.v adder.v.rb
|
3821
|
+
```
|
3822
|
+
|
3823
|
+
|
3824
|
+
Another possibility is to directly load the Verilog HDL file from a HDLRuby description using the command `require_verilog`.
|
3825
|
+
For example, assuming `adder.v` contains the following code:
|
3826
|
+
|
3827
|
+
```verilog
|
3828
|
+
module adder(x,y,z);
|
3829
|
+
input[7:0] x,y;
|
3830
|
+
output[7:0] z;
|
3831
|
+
|
3832
|
+
assign z = x + y;
|
3833
|
+
endmodule
|
3834
|
+
```
|
3835
|
+
|
3836
|
+
It can be loaded the be instantiated like any other module in HDLRuby as follows:
|
3837
|
+
|
3838
|
+
```ruby
|
3839
|
+
require_verilog "adder.v"
|
3840
|
+
|
3841
|
+
system :my_IC do
|
3842
|
+
[8].inner :a, :b, :c
|
3843
|
+
|
3844
|
+
adder(:my_adder).(a,b,c)
|
3845
|
+
|
3846
|
+
...
|
3847
|
+
end
|
3848
|
+
```
|
3849
|
+
|
3850
|
+
|
3851
|
+
__Notes__:
|
3852
|
+
|
3853
|
+
* Verilog HDL accepts signal and module names in any letter case, while HDLRuby reserves identifiers starting with a capital letter for constants. To avoid conflicts, Verilog HDL names that begin with a capital letter are prefixed with an underscore (`_`) in HDLRuby. For example, if the Verilog HDL module name in the previous example were `ADDER`, it would be renamed to `_ADDER` in HDLRuby. Instantiating such a module would be done as follows:
|
3854
|
+
|
3855
|
+
```ruby
|
3856
|
+
_ADDER(:my_add).(a,b,c)
|
3857
|
+
```
|
3858
|
+
|
3859
|
+
* With the current version of HDLRuby, the Verilog HDL files are first converted to HDLRuby before being loaded using the standalone `v2hdr` tool.
|
3860
|
+
|
3861
|
+
|
3862
|
+
|
3863
|
+
## 10. What next?
|
3780
3864
|
|
3781
3865
|
There are still many aspects of HDLRuby that have not been addressed in this tutorial. For example, finite state machines (FSM) and decoders are crucial hardware components that you should learn about, and HDLRuby provides specific constructs for easier design. So from now on, please consult the main documentation of HDLRuby, and have a look at the code samples provided in the HDLRuby distribution. They can be copied to your working directory using the following command:
|
3782
3866
|
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: HDLRuby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date: 2024-
|
10
|
+
date: 2024-12-23 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: bundler
|
@@ -60,6 +59,7 @@ email:
|
|
60
59
|
- lovic@ariake-nct.ac.jp
|
61
60
|
executables:
|
62
61
|
- hdrcc
|
62
|
+
- v2hdr
|
63
63
|
extensions:
|
64
64
|
- ext/hruby_sim/extconf.rb
|
65
65
|
extra_rdoc_files:
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- bin/console
|
78
78
|
- bin/setup
|
79
79
|
- exe/hdrcc
|
80
|
+
- exe/v2hdr
|
80
81
|
- ext/hruby_sim/Makefile_csim
|
81
82
|
- ext/hruby_sim/extconf.rb
|
82
83
|
- ext/hruby_sim/hruby_rcsim_build.c
|
@@ -102,6 +103,7 @@ files:
|
|
102
103
|
- lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_qu_222.v
|
103
104
|
- lib/HDLRuby/hdr_samples/WithMultiChannelExpVerilog/with_multi_channels_rg_23.v
|
104
105
|
- lib/HDLRuby/hdr_samples/adder.rb
|
106
|
+
- lib/HDLRuby/hdr_samples/adder8.v
|
105
107
|
- lib/HDLRuby/hdr_samples/adder_assign_error.rb
|
106
108
|
- lib/HDLRuby/hdr_samples/adder_bench.rb
|
107
109
|
- lib/HDLRuby/hdr_samples/adder_gen.rb
|
@@ -128,6 +130,7 @@ files:
|
|
128
130
|
- lib/HDLRuby/hdr_samples/dff_properties.rb
|
129
131
|
- lib/HDLRuby/hdr_samples/dff_unit.rb
|
130
132
|
- lib/HDLRuby/hdr_samples/enum_as_param.rb
|
133
|
+
- lib/HDLRuby/hdr_samples/hard_to_route.rb
|
131
134
|
- lib/HDLRuby/hdr_samples/huge_rom.rb
|
132
135
|
- lib/HDLRuby/hdr_samples/if_bench.rb
|
133
136
|
- lib/HDLRuby/hdr_samples/include.rb
|
@@ -185,6 +188,7 @@ files:
|
|
185
188
|
- lib/HDLRuby/hdr_samples/system_open.rb
|
186
189
|
- lib/HDLRuby/hdr_samples/tuple.rb
|
187
190
|
- lib/HDLRuby/hdr_samples/type_minmax_bench.rb
|
191
|
+
- lib/HDLRuby/hdr_samples/verilog_parser_bench.rb
|
188
192
|
- lib/HDLRuby/hdr_samples/with_board.rb
|
189
193
|
- lib/HDLRuby/hdr_samples/with_board_sequencer.rb
|
190
194
|
- lib/HDLRuby/hdr_samples/with_bram.rb
|
@@ -206,6 +210,7 @@ files:
|
|
206
210
|
- lib/HDLRuby/hdr_samples/with_fixpoint_adv.rb
|
207
211
|
- lib/HDLRuby/hdr_samples/with_fsm.rb
|
208
212
|
- lib/HDLRuby/hdr_samples/with_function_generator.rb
|
213
|
+
- lib/HDLRuby/hdr_samples/with_generic_in_generic.rb
|
209
214
|
- lib/HDLRuby/hdr_samples/with_handshake.rb
|
210
215
|
- lib/HDLRuby/hdr_samples/with_init.rb
|
211
216
|
- lib/HDLRuby/hdr_samples/with_instance.rb
|
@@ -227,6 +232,9 @@ files:
|
|
227
232
|
- lib/HDLRuby/hdr_samples/with_reduce.rb
|
228
233
|
- lib/HDLRuby/hdr_samples/with_ref_array.rb
|
229
234
|
- lib/HDLRuby/hdr_samples/with_ref_expr.rb
|
235
|
+
- lib/HDLRuby/hdr_samples/with_seq_case.rb
|
236
|
+
- lib/HDLRuby/hdr_samples/with_seq_if.rb
|
237
|
+
- lib/HDLRuby/hdr_samples/with_seq_if_succ.rb
|
230
238
|
- lib/HDLRuby/hdr_samples/with_sequencer.rb
|
231
239
|
- lib/HDLRuby/hdr_samples/with_sequencer_channel.rb
|
232
240
|
- lib/HDLRuby/hdr_samples/with_sequencer_deep.rb
|
@@ -240,6 +248,7 @@ files:
|
|
240
248
|
- lib/HDLRuby/hdr_samples/with_to_a.rb
|
241
249
|
- lib/HDLRuby/hdr_samples/with_to_array.rb
|
242
250
|
- lib/HDLRuby/hdr_samples/with_values.rb
|
251
|
+
- lib/HDLRuby/hdr_samples/with_verilog.rb
|
243
252
|
- lib/HDLRuby/hdrcc.rb
|
244
253
|
- lib/HDLRuby/hdrlib.rb
|
245
254
|
- lib/HDLRuby/high_samples/_adder_fault.rb
|
@@ -343,6 +352,7 @@ files:
|
|
343
352
|
- lib/HDLRuby/hruby_values.rb
|
344
353
|
- lib/HDLRuby/hruby_verilog.rb
|
345
354
|
- lib/HDLRuby/hruby_verilog_name.rb
|
355
|
+
- lib/HDLRuby/hruby_viz.rb
|
346
356
|
- lib/HDLRuby/low_samples/adder.yaml
|
347
357
|
- lib/HDLRuby/low_samples/after.yaml
|
348
358
|
- lib/HDLRuby/low_samples/before.yaml
|
@@ -415,10 +425,13 @@ files:
|
|
415
425
|
- lib/HDLRuby/test_hruby_high_low.rb
|
416
426
|
- lib/HDLRuby/test_hruby_low.rb
|
417
427
|
- lib/HDLRuby/ui/hruby_board.rb
|
428
|
+
- lib/HDLRuby/v2hdr.rb
|
418
429
|
- lib/HDLRuby/v_samples/adder.v
|
419
430
|
- lib/HDLRuby/v_samples/dff.v
|
420
431
|
- lib/HDLRuby/v_samples/ram.v
|
421
432
|
- lib/HDLRuby/v_samples/rom.v
|
433
|
+
- lib/HDLRuby/verilog_hruby.rb
|
434
|
+
- lib/HDLRuby/verilog_parser.rb
|
422
435
|
- lib/HDLRuby/version.rb
|
423
436
|
- lib/c/Rakefile
|
424
437
|
- lib/c/cHDL.h
|
@@ -460,7 +473,6 @@ homepage: https://github.com/civol/HDLRuby
|
|
460
473
|
licenses:
|
461
474
|
- MIT
|
462
475
|
metadata: {}
|
463
|
-
post_install_message:
|
464
476
|
rdoc_options: []
|
465
477
|
require_paths:
|
466
478
|
- lib
|
@@ -476,8 +488,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
476
488
|
- !ruby/object:Gem::Version
|
477
489
|
version: '0'
|
478
490
|
requirements: []
|
479
|
-
rubygems_version: 3.
|
480
|
-
signing_key:
|
491
|
+
rubygems_version: 3.6.0
|
481
492
|
specification_version: 4
|
482
493
|
summary: HDLRuby is a library for describing and simulating digital electronic systems.
|
483
494
|
test_files: []
|