HDLRuby 2.5.0 → 2.6.5

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/HDLRuby/hdr_samples/adder.rb +1 -1
  3. data/lib/HDLRuby/hdr_samples/adder_bench.rb +1 -1
  4. data/lib/HDLRuby/hdr_samples/adder_gen.rb +1 -1
  5. data/lib/HDLRuby/hdr_samples/constant_in_function.rb +27 -0
  6. data/lib/HDLRuby/hdr_samples/dff_unit.rb +54 -0
  7. data/lib/HDLRuby/hdr_samples/huge_rom.rb +25 -0
  8. data/lib/HDLRuby/hdr_samples/logic_bench.rb +21 -0
  9. data/lib/HDLRuby/hdr_samples/mei8_bench.rb +1 -1
  10. data/lib/HDLRuby/hdr_samples/multi_timed_bench.rb +54 -0
  11. data/lib/HDLRuby/hdr_samples/music.rb +79 -0
  12. data/lib/HDLRuby/hdr_samples/named_sub.rb +42 -0
  13. data/lib/HDLRuby/hdr_samples/rom.rb +16 -0
  14. data/lib/HDLRuby/hdr_samples/with_function_generator.rb +25 -0
  15. data/lib/HDLRuby/hdrcc.rb +132 -24
  16. data/lib/HDLRuby/hruby_decorator.rb +3 -1
  17. data/lib/HDLRuby/hruby_high.rb +215 -27
  18. data/lib/HDLRuby/hruby_low.rb +402 -45
  19. data/lib/HDLRuby/hruby_low2c.rb +122 -168
  20. data/lib/HDLRuby/hruby_low2hdr.rb +738 -0
  21. data/lib/HDLRuby/hruby_low2high.rb +331 -549
  22. data/lib/HDLRuby/hruby_low2vhd.rb +39 -2
  23. data/lib/HDLRuby/hruby_low_bool2select.rb +29 -0
  24. data/lib/HDLRuby/hruby_low_casts_without_expression.rb +27 -0
  25. data/lib/HDLRuby/hruby_low_fix_types.rb +25 -0
  26. data/lib/HDLRuby/hruby_low_mutable.rb +70 -0
  27. data/lib/HDLRuby/hruby_low_resolve.rb +28 -0
  28. data/lib/HDLRuby/hruby_low_without_connection.rb +6 -3
  29. data/lib/HDLRuby/hruby_low_without_namespace.rb +7 -4
  30. data/lib/HDLRuby/hruby_low_without_select.rb +13 -0
  31. data/lib/HDLRuby/hruby_tools.rb +11 -1
  32. data/lib/HDLRuby/hruby_verilog.rb +1572 -1723
  33. data/lib/HDLRuby/sim/hruby_sim.h +29 -3
  34. data/lib/HDLRuby/sim/hruby_sim_calc.c +63 -6
  35. data/lib/HDLRuby/sim/hruby_sim_core.c +24 -9
  36. data/lib/HDLRuby/sim/hruby_sim_vcd.c +7 -3
  37. data/lib/HDLRuby/sim/hruby_sim_vizualize.c +22 -6
  38. data/lib/HDLRuby/std/fixpoint.rb +9 -0
  39. data/lib/HDLRuby/std/function_generator.rb +139 -0
  40. data/lib/HDLRuby/std/hruby_unit.rb +75 -0
  41. data/lib/HDLRuby/version.rb +1 -1
  42. metadata +16 -5
@@ -0,0 +1,75 @@
1
+ require "HDLRuby/hruby_high"
2
+
3
+
4
+
5
+ ##
6
+ # Library for building unit test systems.
7
+ #
8
+ ########################################################################
9
+ module HDLRuby::Unit
10
+
11
+ ## The HDLRuby unit test error class.
12
+ class UnitError < ::StandardError
13
+ end
14
+
15
+ # The set of the unit systems by name.
16
+ @@unit_systems = {}
17
+
18
+
19
+ # Declares system +name+ for unit testing.
20
+ # The system is built by executing +ruby_block+.
21
+ #
22
+ # NOTE: the name of the system is not registered within the HDLRuby
23
+ # namespace since it is not meant to be used directly.
24
+ def self.system(name,&ruby_block)
25
+ # Ensure name is a symbol.
26
+ name = name.to_s.to_sym unless name.is_a?(Symbol)
27
+ # Check if the name is already used or not.
28
+ if @@unit_systems.key?(name) then
29
+ raise UnitError, "Unit test system #{name} already declared."
30
+ end
31
+ # @@unit_systems[name] = HDLRuby::High.system(&ruby_block)
32
+ @@unit_systems[name] = ruby_block
33
+ end
34
+
35
+
36
+ # Create a system named +test_name+ executing the unit tests given from
37
+ # +names+.
38
+ def self.test(test_name = :test, *names)
39
+ # If there is no name given, use all the test systems.
40
+ names = @@unit_systems.each_key if names.empty?
41
+ # Declare the system.
42
+ HDLRuby::High.system test_name do
43
+
44
+ # The timed block that contains the bench execurtion code.
45
+ @@tester = timed {}
46
+
47
+ # Generate the test code for each selected test units.
48
+ names.each do |name|
49
+ name = name.to_s.to_sym unless name.is_a?(Symbol)
50
+ unless @@unit_systems.key?(name) then
51
+ raise UnitError, "Unit test #{name} does not exist."
52
+ end
53
+ sub(name) do
54
+ @@myself = self
55
+ instance_exec do
56
+ # Define the test command that insert code of
57
+ # the current test unit to the tester timed block.
58
+ def test(&ruby_block)
59
+ @@tester.block.open do
60
+ # Here the signals are to be taken from
61
+ # the test unit and not the timed block.
62
+ set_this(@@myself)
63
+ ruby_block.call
64
+ # Go back to the default current this.
65
+ set_this
66
+ end
67
+ end
68
+ end
69
+ # Process the test unit.
70
+ instance_exec(&@@unit_systems[name])
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,3 +1,3 @@
1
1
  module HDLRuby
2
- VERSION = "2.5.0"
2
+ VERSION = "2.6.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HDLRuby
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovic Gauthier
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,14 +83,18 @@ files:
83
83
  - lib/HDLRuby/hdr_samples/alu.rb
84
84
  - lib/HDLRuby/hdr_samples/bstr_bench.rb
85
85
  - lib/HDLRuby/hdr_samples/calculator.rb
86
+ - lib/HDLRuby/hdr_samples/constant_in_function.rb
86
87
  - lib/HDLRuby/hdr_samples/counter_bench.rb
87
88
  - lib/HDLRuby/hdr_samples/dff.rb
88
89
  - lib/HDLRuby/hdr_samples/dff_bench.rb
89
90
  - lib/HDLRuby/hdr_samples/dff_counter.rb
90
91
  - lib/HDLRuby/hdr_samples/dff_properties.rb
92
+ - lib/HDLRuby/hdr_samples/dff_unit.rb
93
+ - lib/HDLRuby/hdr_samples/huge_rom.rb
91
94
  - lib/HDLRuby/hdr_samples/include.rb
92
95
  - lib/HDLRuby/hdr_samples/instance_open.rb
93
96
  - lib/HDLRuby/hdr_samples/linear_test.rb
97
+ - lib/HDLRuby/hdr_samples/logic_bench.rb
94
98
  - lib/HDLRuby/hdr_samples/make_multi_channels_v.rb
95
99
  - lib/HDLRuby/hdr_samples/make_multi_channels_vcd.rb
96
100
  - lib/HDLRuby/hdr_samples/mei8.rb
@@ -98,6 +102,9 @@ files:
98
102
  - lib/HDLRuby/hdr_samples/memory_test.rb
99
103
  - lib/HDLRuby/hdr_samples/multer_gen.rb
100
104
  - lib/HDLRuby/hdr_samples/multer_seq.rb
105
+ - lib/HDLRuby/hdr_samples/multi_timed_bench.rb
106
+ - lib/HDLRuby/hdr_samples/music.rb
107
+ - lib/HDLRuby/hdr_samples/named_sub.rb
101
108
  - lib/HDLRuby/hdr_samples/neg_arith_bench.rb
102
109
  - lib/HDLRuby/hdr_samples/neural/a.rb
103
110
  - lib/HDLRuby/hdr_samples/neural/a_sub.rb
@@ -134,6 +141,7 @@ files:
134
141
  - lib/HDLRuby/hdr_samples/with_decoder.rb
135
142
  - lib/HDLRuby/hdr_samples/with_fixpoint.rb
136
143
  - lib/HDLRuby/hdr_samples/with_fsm.rb
144
+ - lib/HDLRuby/hdr_samples/with_function_generator.rb
137
145
  - lib/HDLRuby/hdr_samples/with_linear.rb
138
146
  - lib/HDLRuby/hdr_samples/with_loop.rb
139
147
  - lib/HDLRuby/hdr_samples/with_memory.rb
@@ -207,6 +215,7 @@ files:
207
215
  - lib/HDLRuby/hruby_high.rb
208
216
  - lib/HDLRuby/hruby_low.rb
209
217
  - lib/HDLRuby/hruby_low2c.rb
218
+ - lib/HDLRuby/hruby_low2hdr.rb
210
219
  - lib/HDLRuby/hruby_low2high.rb
211
220
  - lib/HDLRuby/hruby_low2seq.rb
212
221
  - lib/HDLRuby/hruby_low2sym.rb
@@ -291,6 +300,8 @@ files:
291
300
  - lib/HDLRuby/std/decoder.rb
292
301
  - lib/HDLRuby/std/fixpoint.rb
293
302
  - lib/HDLRuby/std/fsm.rb
303
+ - lib/HDLRuby/std/function_generator.rb
304
+ - lib/HDLRuby/std/hruby_unit.rb
294
305
  - lib/HDLRuby/std/linear.rb
295
306
  - lib/HDLRuby/std/loop.rb
296
307
  - lib/HDLRuby/std/memory.rb
@@ -313,7 +324,7 @@ homepage: https://github.com/civol/HDLRuby
313
324
  licenses:
314
325
  - MIT
315
326
  metadata: {}
316
- post_install_message:
327
+ post_install_message:
317
328
  rdoc_options: []
318
329
  require_paths:
319
330
  - lib
@@ -330,7 +341,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
330
341
  version: '0'
331
342
  requirements: []
332
343
  rubygems_version: 3.0.8
333
- signing_key:
344
+ signing_key:
334
345
  specification_version: 4
335
346
  summary: HDLRuby is a library for describing and simulating digital electronic systems.
336
347
  test_files: []