HDLRuby 3.9.0 → 3.9.1
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.
- checksums.yaml +4 -4
- data/README.md +108 -104
- data/lib/HDLRuby/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 024ca7b048785e0c686ee2cc8d715b912ed05d6cb53034051945126097bb2403
|
4
|
+
data.tar.gz: a6aac1d753614fa7a20261f83824d4447bb740b0df6cbd757400cccdfe01bc98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44909ad4b89a125bed21e5df2f8954c23591cc6e780655d87d69a5c2a9be73092b1f08de2a009a0db0085a248c9e116c54d53b0152bf26912353da39da0bf0e6
|
7
|
+
data.tar.gz: 2210a765582bee3a947e3db572667e20d84f92185c5aec0ad76c1cae2c08b3d88d62dcb6d5b712ea7986511bd38a59b88a50f5115af3d65f7eb86c259a02d252
|
data/README.md
CHANGED
@@ -9,48 +9,48 @@ If you want to learn how to describe a circuit with HDLRuby, please jump to the
|
|
9
9
|
|
10
10
|
* [HDLRuby Programming Guide](#hdlruby-programming-guide)
|
11
11
|
|
12
|
-
|
12
|
+
* [Introduction](#introduction)
|
13
13
|
|
14
|
-
|
14
|
+
* [How HDLRuby Works](#how-hdlruby-works)
|
15
15
|
|
16
|
-
|
16
|
+
* [Naming rules](#naming-rules)
|
17
17
|
|
18
|
-
|
18
|
+
* [Systems and Signals](#systems-and-signals)
|
19
19
|
|
20
|
-
|
20
|
+
* [Events](#events)
|
21
21
|
|
22
|
-
|
22
|
+
* [Statements](#statements)
|
23
23
|
|
24
|
-
|
24
|
+
* [Types](#types)
|
25
25
|
|
26
|
-
|
26
|
+
* [Expressions](#expressions)
|
27
27
|
|
28
|
-
|
28
|
+
* [Functions](#functions)
|
29
29
|
|
30
|
-
|
30
|
+
* [Software code](#software-code)
|
31
31
|
|
32
|
-
|
32
|
+
* [Time](#time)
|
33
33
|
|
34
|
-
|
34
|
+
* [High-Level Programming Features](#high-level-programming-features)
|
35
35
|
|
36
|
-
|
36
|
+
* [Extending HDLRuby](#extending-hdlruby)
|
37
37
|
|
38
38
|
Many of HDLRuby's features are available through its standard libraries.
|
39
39
|
We strongly recommend consulting the corresponding section:
|
40
40
|
|
41
41
|
* [Standard Libraries](#standard-libraries)
|
42
42
|
|
43
|
-
|
43
|
+
* [Clocks](#clocks)
|
44
44
|
|
45
|
-
|
45
|
+
* [Decoder](#decoder)
|
46
46
|
|
47
|
-
|
47
|
+
* [FSM](#fsm)
|
48
48
|
|
49
|
-
|
49
|
+
* [Parallel Enumerators](#parallel-enumerators)
|
50
50
|
|
51
|
-
|
51
|
+
* [Sequencer (Software-like Hardware Coding)](#sequencer-software-like-hardware-coding)
|
52
52
|
|
53
|
-
|
53
|
+
* [Fixed-Point](#fixed-point)
|
54
54
|
|
55
55
|
Samples are also available: [Sample HDLRuby descriptions](#sample-hdlruby-descriptions)
|
56
56
|
|
@@ -92,11 +92,11 @@ For HDLRuby version 3.8.3:
|
|
92
92
|
|
93
93
|
* Updated the documentation:
|
94
94
|
|
95
|
-
|
95
|
+
* Rewrote the beginning of the [HDLRuby Programming Guide](#hdlruby-programming-guide).
|
96
96
|
|
97
|
-
|
97
|
+
* Updated the documentation for interactive mode.
|
98
98
|
|
99
|
-
|
99
|
+
* Updated the [High-Level Programming Features](#high-level-programming-features) chapter.
|
100
100
|
|
101
101
|
For HDLRuby version 3.8.0:
|
102
102
|
|
@@ -111,7 +111,7 @@ For HDLRuby version 3.7.9:
|
|
111
111
|
|
112
112
|
* Added Python code generation from software sequencers.
|
113
113
|
|
114
|
-
* Added [Parallel Enumerators](#parallel-enumerators
|
114
|
+
* Added [Parallel Enumerators](#parallel-enumerators).
|
115
115
|
|
116
116
|
For HDLRuby versions 3.7.7/3.7.8:
|
117
117
|
|
@@ -170,7 +170,7 @@ For HDLRuby version 3.4.0:
|
|
170
170
|
|
171
171
|
* Added [v2hdr](#converting-verilog-hdl-to-hdlruby), a standalone tool for converting Verilog HDL files to HDLRuby (experimental).
|
172
172
|
|
173
|
-
* Added a HDLRuby command for [loading a Verilog HDL file from a HDLRuby description](#
|
173
|
+
* Added a HDLRuby command for [loading a Verilog HDL file from a HDLRuby description](#converting-verilog-hdl-to-hdlruby).
|
174
174
|
|
175
175
|
|
176
176
|
For HDLRuby version 3.3.0:
|
@@ -197,7 +197,7 @@ For HDLRuby version 3.2.0:
|
|
197
197
|
|
198
198
|
For HDLRuby version 3.1.0:
|
199
199
|
|
200
|
-
* Added [
|
200
|
+
* Added [functions for sequencers](#sequencer-specific-functions), including support for recursion.
|
201
201
|
|
202
202
|
* Replaced the `function` keyword with `hdef` for consistency with sequencer functions (`sdef`).
|
203
203
|
|
@@ -211,7 +211,7 @@ For HDLRuby version 3.0.0:
|
|
211
211
|
|
212
212
|
* Intruduced this changelog section.
|
213
213
|
|
214
|
-
* Added [Sequencers](#sequencer-software-like-hardware-coding
|
214
|
+
* Added [Sequencers](#sequencer-software-like-hardware-coding) for software-like hardware design.
|
215
215
|
|
216
216
|
* Added a [tutorial](tuto/tutorial_sw.md) for software developers.
|
217
217
|
|
@@ -235,8 +235,9 @@ git clone https://github.com/civol/HDLRuby.git
|
|
235
235
|
|
236
236
|
__Warning__:
|
237
237
|
|
238
|
-
|
239
|
-
|
238
|
+
* HDLRuby is still under active development, and the API may change before a stable release.
|
239
|
+
|
240
|
+
* It is highly recommended that users have a basic understanding of both the Ruby programming language and hardware description languages before using HDLRuby.
|
240
241
|
|
241
242
|
|
242
243
|
# Compiling HDLRuby Descriptions
|
@@ -419,8 +420,8 @@ Another key feature of HDLRuby is its native support for all features of the Rub
|
|
419
420
|
|
420
421
|
__Notes__:
|
421
422
|
|
422
|
-
|
423
|
-
|
423
|
+
* It is possible to extend HDLRuby to support hardware descriptions at a higher level of abstraction than RTL. See [Extending HDLRuby](#extending-hdlruby) for more details.
|
424
|
+
* Throughout this guide, HDLRuby constructs are often compared to their Verilog HDL or VHDL equivalents to aid understanding.
|
424
425
|
|
425
426
|
## Introduction
|
426
427
|
|
@@ -467,7 +468,7 @@ These include:
|
|
467
468
|
|
468
469
|
* `mux`, an expression-level construct for multiplexers, which supports multiple inputs, unlike the ?: ternary operator in Verilog, which only handles two
|
469
470
|
|
470
|
-
__Note__: These statements are also called "parallel conditionals" in HDLRuby, to contrast with the ones used in the `sequencer` constructs (see [Sequencer](
|
471
|
+
__Note__: These statements are also called "parallel conditionals" in HDLRuby, to contrast with the ones used in the `sequencer` constructs (see [Sequencer](#sequencer-software-like-Hardware-coding)).
|
471
472
|
|
472
473
|
For example, we can upgrade the 8-bit adder to an adder-subtractor:
|
473
474
|
|
@@ -714,45 +715,48 @@ Fourth, HDLRuby allows you to extend modules and instances after their declarati
|
|
714
715
|
|
715
716
|
Let us say you want to extend an existing `dff` module to include an inverted output (`qb`). There are three ways to do this:
|
716
717
|
|
717
|
-
|
718
|
-
You can define a new system that inherits from the existing `dff`:
|
718
|
+
1. Inheriting from a Module.
|
719
719
|
|
720
|
-
|
721
|
-
system :dff_full, dff do
|
722
|
-
output :qb
|
723
|
-
qb <= ~q
|
724
|
-
end
|
725
|
-
```
|
720
|
+
You can define a new system that inherits from the existing `dff`:
|
726
721
|
|
727
|
-
|
722
|
+
```ruby
|
723
|
+
system :dff_full, dff do
|
724
|
+
output :qb
|
725
|
+
qb <= ~q
|
726
|
+
end
|
727
|
+
```
|
728
728
|
|
729
|
-
|
730
|
-
You can modify the original `dff` module after its declaration using the open method:
|
729
|
+
This creates a new module `dff_full` that includes all the functionality of `dff`, with the additional inverted output.
|
731
730
|
|
732
|
-
|
733
|
-
dff.open do
|
734
|
-
output :qb
|
735
|
-
qb <= ~q
|
736
|
-
end
|
737
|
-
```
|
731
|
+
2. Reopening a Module.
|
738
732
|
|
739
|
-
|
733
|
+
You can modify the original `dff` module after its declaration using the open method:
|
740
734
|
|
741
|
-
|
742
|
-
|
735
|
+
```ruby
|
736
|
+
dff.open do
|
737
|
+
output :qb
|
738
|
+
qb <= ~q
|
739
|
+
end
|
740
|
+
```
|
743
741
|
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
742
|
+
This approach modifies `dff` itself, and the added behavior (`qb <= ~q`) will apply to all future instances of `dff`.
|
743
|
+
|
744
|
+
3. Reopening a Specific Instance.
|
745
|
+
|
746
|
+
You can also modify a single instance of a module without affecting the others:
|
747
|
+
|
748
|
+
```ruby
|
749
|
+
# Declare dff0 as an instance of dff
|
750
|
+
dff :dff0
|
751
|
+
|
752
|
+
# Modify it
|
753
|
+
dff0.open do
|
754
|
+
output :qb
|
755
|
+
qb <= ~q
|
756
|
+
end
|
757
|
+
```
|
754
758
|
|
755
|
-
|
759
|
+
In this case, only `dff0` will have the qb inverted output. Other instances of `dff` remain unchanged.
|
756
760
|
|
757
761
|
In summary, HDLRuby supports:
|
758
762
|
|
@@ -1095,19 +1099,19 @@ system(:box) {}
|
|
1095
1099
|
|
1096
1100
|
__Notes__:
|
1097
1101
|
|
1098
|
-
|
1102
|
+
* Since this is Ruby code, the block can also be written using `do...end` syntax. In that case, parentheses around the name are optional:
|
1099
1103
|
|
1100
1104
|
|
1101
|
-
```ruby
|
1102
|
-
system :box do
|
1103
|
-
end
|
1104
|
-
```
|
1105
|
+
```ruby
|
1106
|
+
system :box do
|
1107
|
+
end
|
1108
|
+
```
|
1105
1109
|
|
1106
|
-
|
1110
|
+
* Although HDLRuby internally stores names as Ruby symbols, you can also use strings. For example, the following is equally valid:
|
1107
1111
|
|
1108
|
-
```ruby
|
1109
|
-
system("box") {}
|
1110
|
-
```
|
1112
|
+
```ruby
|
1113
|
+
system("box") {}
|
1114
|
+
```
|
1111
1115
|
|
1112
1116
|
### Declaring a system with an interface
|
1113
1117
|
|
@@ -1307,9 +1311,9 @@ __Notes__:
|
|
1307
1311
|
|
1308
1312
|
* By default:
|
1309
1313
|
|
1310
|
-
|
1314
|
+
* Ruby integers (e.g., `42`) are treated as 64-bit HDLRuby values.
|
1311
1315
|
|
1312
|
-
|
1316
|
+
* HDLRuby literals prefixed with `_` (e.g., `_b1010`, `_h0F`) have a bit-width corresponding to their representation.
|
1313
1317
|
|
1314
1318
|
* When initializing ROM or arrays of values, make sure that the bit-width of the values matches the declared type -- otherwise, misalignments or synthesis issues may occur.
|
1315
1319
|
|
@@ -1582,17 +1586,17 @@ end
|
|
1582
1586
|
|
1583
1587
|
__Notes__:
|
1584
1588
|
|
1585
|
-
|
1589
|
+
* `helse seq` ensures that the block of the hardware `else` is in blocking assignment mode.
|
1586
1590
|
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1591
|
+
* `hif(rst)` could also have been set to blocking assignment mode as follows:
|
1592
|
+
|
1593
|
+
```ruby
|
1594
|
+
hif rst, seq do
|
1595
|
+
reg <= 0
|
1596
|
+
end
|
1597
|
+
```
|
1594
1598
|
|
1595
|
-
|
1599
|
+
* Non-blocking mode can be set the same way using `par`.
|
1596
1600
|
|
1597
1601
|
|
1598
1602
|
### Extra Features for the Description of Processes
|
@@ -2469,21 +2473,21 @@ In this declaration:
|
|
2469
2473
|
|
2470
2474
|
* `programming_language` is a symbol indicating the language used for the software. Currently supported options are:
|
2471
2475
|
|
2472
|
-
|
2476
|
+
* `:ruby` -- for programs written in Ruby.
|
2473
2477
|
|
2474
|
-
|
2478
|
+
* `:c` -- for programs written in C. (In fact, any language that can be compiled into a shared library linkable with C is supported.)
|
2475
2479
|
|
2476
2480
|
* `function_name` is the name of the software function that is executed when an activation event occurs. Only one such function can be specified per program, but multiple programs can be declared within the same module.
|
2477
2481
|
|
2478
2482
|
* `location of the software files and description of its interface` may include the following declarations:
|
2479
2483
|
|
2480
|
-
|
2484
|
+
* `actport <list of events>` -- Declares the events that activate the program (i.e., trigger execution of the program’s start function).
|
2481
2485
|
|
2482
|
-
|
2486
|
+
* `inport <port_name: signal>` -- Declares input ports that can be read by the software.
|
2483
2487
|
|
2484
|
-
|
2488
|
+
* `outport <port_name: signal>` -- Declares output ports that the software can write to.
|
2485
2489
|
|
2486
|
-
|
2490
|
+
* `code <list_of_filenames>` -- Specifies the software source file(s).
|
2487
2491
|
|
2488
2492
|
__Example:__
|
2489
2493
|
|
@@ -2508,9 +2512,9 @@ end
|
|
2508
2512
|
|
2509
2513
|
__Notes:__
|
2510
2514
|
|
2511
|
-
|
2515
|
+
* The bit width of an input or output port matches that of the signal it is connected to. From the software perspective, however, all port values are converted to the C type `long long`.
|
2512
2516
|
|
2513
|
-
|
2517
|
+
* If the language is Ruby, the `code` section can use a Ruby `Proc` objecct in place of a file name.
|
2514
2518
|
|
2515
2519
|
|
2516
2520
|
|
@@ -3369,9 +3373,9 @@ __Warnings__:
|
|
3369
3373
|
|
3370
3374
|
* In the example above, the semantics of some_arrow change depending on the context in which it is called:
|
3371
3375
|
|
3372
|
-
|
3376
|
+
* Within a module: interpreted as a static connection.
|
3373
3377
|
|
3374
|
-
|
3378
|
+
* Within a process: interpreted as a behavioral assignment.
|
3375
3379
|
|
3376
3380
|
* Using Ruby methods to describe hardware can lead to fragile or incorrect code if not used carefully. For example, consider the following:1
|
3377
3381
|
|
@@ -3398,21 +3402,21 @@ __Warnings__:
|
|
3398
3402
|
|
3399
3403
|
In this case:
|
3400
3404
|
|
3401
|
-
|
3405
|
+
* `sys0` works correctly.
|
3402
3406
|
|
3403
|
-
|
3407
|
+
* `sys1` raises an error due to redeclaration of `in0`.
|
3404
3408
|
|
3405
|
-
|
3409
|
+
* `sys2` raises an error because `input` declarations are not allowed inside a process.
|
3406
3410
|
|
3407
3411
|
__Using Ruby Method Features__
|
3408
3412
|
|
3409
3413
|
Ruby methods in HDLRuby support all standard Ruby features, including:
|
3410
3414
|
|
3411
|
-
|
3415
|
+
* Variadic arguments (`*args`)
|
3412
3416
|
|
3413
|
-
|
3417
|
+
* Named (keyword) arguments
|
3414
3418
|
|
3415
|
-
|
3419
|
+
* Block arguments (`&block`)
|
3416
3420
|
|
3417
3421
|
For example, the following method connects a single driver signal to multiple targets:
|
3418
3422
|
|
@@ -3804,11 +3808,11 @@ The available state kinds are:
|
|
3804
3808
|
|
3805
3809
|
* `reset`: The state entered when the FSM is reset.
|
3806
3810
|
|
3807
|
-
|
3811
|
+
* If name is `:sync`, the reset is forced to be synchronous.
|
3808
3812
|
|
3809
|
-
|
3813
|
+
* If name is `:async`, the reset is forced to be asynchronous.
|
3810
3814
|
|
3811
|
-
|
3815
|
+
* If name is omitted, the mode defaults to that of the FSM.
|
3812
3816
|
|
3813
3817
|
* `state`: A regular state that follows the FSM’s default mode.
|
3814
3818
|
|
@@ -4149,7 +4153,7 @@ __Using Enumerators in Sequences__
|
|
4149
4153
|
|
4150
4154
|
Within sequencer blocks, HDLRuby provides enumerator methods similar to Ruby’s `each`. These include:
|
4151
4155
|
|
4152
|
-
* `<object>.seach`: `object` can be any Ruby enumerable or HDLRuby signal. If a block is given, it behaves like sfor; otherwise, it returns an HDLRuby enumerator (see [enumerator](#hdlruby-enumerators-and-enumerable-objects
|
4156
|
+
* `<object>.seach`: `object` can be any Ruby enumerable or HDLRuby signal. If a block is given, it behaves like sfor; otherwise, it returns an HDLRuby enumerator (see [enumerator](#hdlruby-enumerators-and-enumerable-objects) for details).
|
4153
4157
|
|
4154
4158
|
* `<object>.stimes`: Can be used on integers and is equivalent to calling seach on the range `0..object-1`.
|
4155
4159
|
|
@@ -4894,9 +4898,9 @@ When a `sync` command is encountered during execution:
|
|
4894
4898
|
|
4895
4899
|
* The paused sequencer can later be resumed by either:
|
4896
4900
|
|
4897
|
-
|
4901
|
+
* Calling it again using the call operator (`my_seq.()`), or
|
4898
4902
|
|
4899
|
-
|
4903
|
+
* Setting its associated start signal to `1`.
|
4900
4904
|
|
4901
4905
|
__Example: Pausing and Resuming a Sequencer__
|
4902
4906
|
|
data/lib/HDLRuby/version.rb
CHANGED