HDLRuby 2.0.8
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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +5 -0
- data/.yardopts +1 -0
- data/Gemfile +4 -0
- data/HDLRuby.gemspec +36 -0
- data/LICENSE.txt +21 -0
- data/README.md +2774 -0
- data/README.pdf +0 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/hdrcc +3 -0
- data/lib/HDLRuby/alcc.rb +137 -0
- data/lib/HDLRuby/backend/hruby_allocator.rb +69 -0
- data/lib/HDLRuby/backend/hruby_c_allocator.rb +76 -0
- data/lib/HDLRuby/hdr_samples/adder.rb +7 -0
- data/lib/HDLRuby/hdr_samples/adder_assign_error.rb +11 -0
- data/lib/HDLRuby/hdr_samples/adder_bench.rb +27 -0
- data/lib/HDLRuby/hdr_samples/adder_gen.rb +7 -0
- data/lib/HDLRuby/hdr_samples/adder_nodef_error.rb +7 -0
- data/lib/HDLRuby/hdr_samples/addsub.rb +19 -0
- data/lib/HDLRuby/hdr_samples/addsubz.rb +22 -0
- data/lib/HDLRuby/hdr_samples/alu.rb +47 -0
- data/lib/HDLRuby/hdr_samples/calculator.rb +48 -0
- data/lib/HDLRuby/hdr_samples/counter_bench.rb +83 -0
- data/lib/HDLRuby/hdr_samples/dff.rb +9 -0
- data/lib/HDLRuby/hdr_samples/dff_bench.rb +66 -0
- data/lib/HDLRuby/hdr_samples/dff_counter.rb +20 -0
- data/lib/HDLRuby/hdr_samples/include.rb +14 -0
- data/lib/HDLRuby/hdr_samples/instance_open.rb +23 -0
- data/lib/HDLRuby/hdr_samples/mei8.rb +256 -0
- data/lib/HDLRuby/hdr_samples/mei8_bench.rb +309 -0
- data/lib/HDLRuby/hdr_samples/multer_gen.rb +8 -0
- data/lib/HDLRuby/hdr_samples/multer_seq.rb +29 -0
- data/lib/HDLRuby/hdr_samples/neural/a.rb +9 -0
- data/lib/HDLRuby/hdr_samples/neural/a_sub.rb +5 -0
- data/lib/HDLRuby/hdr_samples/neural/bw.rb +23 -0
- data/lib/HDLRuby/hdr_samples/neural/counter.rb +16 -0
- data/lib/HDLRuby/hdr_samples/neural/dadz.rb +9 -0
- data/lib/HDLRuby/hdr_samples/neural/dadz_sub.rb +4 -0
- data/lib/HDLRuby/hdr_samples/neural/forward.rb +153 -0
- data/lib/HDLRuby/hdr_samples/neural/forward_sub.rb +62 -0
- data/lib/HDLRuby/hdr_samples/neural/forward_sub_rand.rb +41 -0
- data/lib/HDLRuby/hdr_samples/neural/forward_sub_rand_typedef.rb +47 -0
- data/lib/HDLRuby/hdr_samples/neural/mem.rb +30 -0
- data/lib/HDLRuby/hdr_samples/neural/random.rb +23 -0
- data/lib/HDLRuby/hdr_samples/neural/selector.rb +29 -0
- data/lib/HDLRuby/hdr_samples/neural/sigmoid.rb +20 -0
- data/lib/HDLRuby/hdr_samples/neural/z.rb +33 -0
- data/lib/HDLRuby/hdr_samples/prog.obj +256 -0
- data/lib/HDLRuby/hdr_samples/ram.rb +18 -0
- data/lib/HDLRuby/hdr_samples/register_with_code_bench.rb +98 -0
- data/lib/HDLRuby/hdr_samples/rom.rb +10 -0
- data/lib/HDLRuby/hdr_samples/struct.rb +14 -0
- data/lib/HDLRuby/hdr_samples/sumprod.rb +29 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_bench.rb +103 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_cpu_bench.rb +261 -0
- data/lib/HDLRuby/hdr_samples/sw_encrypt_cpusim_bench.rb +302 -0
- data/lib/HDLRuby/hdr_samples/system_open.rb +11 -0
- data/lib/HDLRuby/hdr_samples/tuple.rb +16 -0
- data/lib/HDLRuby/hdr_samples/with_channel.rb +118 -0
- data/lib/HDLRuby/hdr_samples/with_class.rb +199 -0
- data/lib/HDLRuby/hdr_samples/with_decoder.rb +17 -0
- data/lib/HDLRuby/hdr_samples/with_fsm.rb +34 -0
- data/lib/HDLRuby/hdr_samples/with_reconf.rb +103 -0
- data/lib/HDLRuby/hdrcc.rb +623 -0
- data/lib/HDLRuby/high_samples/_adder_fault.rb +23 -0
- data/lib/HDLRuby/high_samples/_generic_transmission2.rb +146 -0
- data/lib/HDLRuby/high_samples/adder.rb +21 -0
- data/lib/HDLRuby/high_samples/adder_common_errors.rb +25 -0
- data/lib/HDLRuby/high_samples/addsub.rb +33 -0
- data/lib/HDLRuby/high_samples/addsubz.rb +37 -0
- data/lib/HDLRuby/high_samples/after.rb +28 -0
- data/lib/HDLRuby/high_samples/all_signals.rb +29 -0
- data/lib/HDLRuby/high_samples/alu.rb +61 -0
- data/lib/HDLRuby/high_samples/anonymous.rb +41 -0
- data/lib/HDLRuby/high_samples/before.rb +28 -0
- data/lib/HDLRuby/high_samples/blockblock.rb +26 -0
- data/lib/HDLRuby/high_samples/bugs/dadz.rb +22 -0
- data/lib/HDLRuby/high_samples/bugs/misample_instan.rb +20 -0
- data/lib/HDLRuby/high_samples/bugs/misample_updown.rb +22 -0
- data/lib/HDLRuby/high_samples/bugs/sample_add.rb +16 -0
- data/lib/HDLRuby/high_samples/bugs/sample_barrel.rb +13 -0
- data/lib/HDLRuby/high_samples/bugs/sample_daice.rb +57 -0
- data/lib/HDLRuby/high_samples/bugs/sample_kumiawase.rb +52 -0
- data/lib/HDLRuby/high_samples/bugs/sample_multi.rb +18 -0
- data/lib/HDLRuby/high_samples/bugs/sample_sub.rb +14 -0
- data/lib/HDLRuby/high_samples/bugs/z2.rb +32 -0
- data/lib/HDLRuby/high_samples/case.rb +32 -0
- data/lib/HDLRuby/high_samples/case2.rb +30 -0
- data/lib/HDLRuby/high_samples/change.rb +23 -0
- data/lib/HDLRuby/high_samples/clocks.rb +35 -0
- data/lib/HDLRuby/high_samples/comparer.rb +21 -0
- data/lib/HDLRuby/high_samples/conditionals.rb +29 -0
- data/lib/HDLRuby/high_samples/dff.rb +23 -0
- data/lib/HDLRuby/high_samples/each.rb +28 -0
- data/lib/HDLRuby/high_samples/exporter.rb +42 -0
- data/lib/HDLRuby/high_samples/functions.rb +60 -0
- data/lib/HDLRuby/high_samples/if_seq.rb +26 -0
- data/lib/HDLRuby/high_samples/inherit_as_dff.rb +32 -0
- data/lib/HDLRuby/high_samples/inherit_dff.rb +36 -0
- data/lib/HDLRuby/high_samples/instance.rb +37 -0
- data/lib/HDLRuby/high_samples/memory.rb +64 -0
- data/lib/HDLRuby/high_samples/multi_file.rb +27 -0
- data/lib/HDLRuby/high_samples/overload.rb +32 -0
- data/lib/HDLRuby/high_samples/paper_after.rb +49 -0
- data/lib/HDLRuby/high_samples/ram.rb +27 -0
- data/lib/HDLRuby/high_samples/registers.rb +139 -0
- data/lib/HDLRuby/high_samples/rom.rb +23 -0
- data/lib/HDLRuby/high_samples/scopeblockname.rb +37 -0
- data/lib/HDLRuby/high_samples/scopescope.rb +26 -0
- data/lib/HDLRuby/high_samples/shift.rb +31 -0
- data/lib/HDLRuby/high_samples/shift2.rb +40 -0
- data/lib/HDLRuby/high_samples/simple_instance.rb +31 -0
- data/lib/HDLRuby/high_samples/test_all.sh +10 -0
- data/lib/HDLRuby/high_samples/typedef.rb +24 -0
- data/lib/HDLRuby/high_samples/values.rb +70 -0
- data/lib/HDLRuby/high_samples/vector.rb +22 -0
- data/lib/HDLRuby/high_samples/with_decoder.rb +30 -0
- data/lib/HDLRuby/high_samples/with_fsm.rb +46 -0
- data/lib/HDLRuby/high_samples/with_pipe.rb +43 -0
- data/lib/HDLRuby/high_samples/with_seq.rb +25 -0
- data/lib/HDLRuby/hruby_bstr.rb +1085 -0
- data/lib/HDLRuby/hruby_check.rb +317 -0
- data/lib/HDLRuby/hruby_db.rb +432 -0
- data/lib/HDLRuby/hruby_error.rb +44 -0
- data/lib/HDLRuby/hruby_high.rb +4103 -0
- data/lib/HDLRuby/hruby_low.rb +4735 -0
- data/lib/HDLRuby/hruby_low2c.rb +1986 -0
- data/lib/HDLRuby/hruby_low2high.rb +738 -0
- data/lib/HDLRuby/hruby_low2seq.rb +248 -0
- data/lib/HDLRuby/hruby_low2sym.rb +126 -0
- data/lib/HDLRuby/hruby_low2vhd.rb +1437 -0
- data/lib/HDLRuby/hruby_low_bool2select.rb +295 -0
- data/lib/HDLRuby/hruby_low_cleanup.rb +193 -0
- data/lib/HDLRuby/hruby_low_fix_types.rb +437 -0
- data/lib/HDLRuby/hruby_low_mutable.rb +1803 -0
- data/lib/HDLRuby/hruby_low_resolve.rb +165 -0
- data/lib/HDLRuby/hruby_low_skeleton.rb +129 -0
- data/lib/HDLRuby/hruby_low_with_bool.rb +141 -0
- data/lib/HDLRuby/hruby_low_with_port.rb +167 -0
- data/lib/HDLRuby/hruby_low_with_var.rb +302 -0
- data/lib/HDLRuby/hruby_low_without_bit2vector.rb +88 -0
- data/lib/HDLRuby/hruby_low_without_concat.rb +162 -0
- data/lib/HDLRuby/hruby_low_without_connection.rb +113 -0
- data/lib/HDLRuby/hruby_low_without_namespace.rb +718 -0
- data/lib/HDLRuby/hruby_low_without_outread.rb +107 -0
- data/lib/HDLRuby/hruby_low_without_select.rb +206 -0
- data/lib/HDLRuby/hruby_serializer.rb +398 -0
- data/lib/HDLRuby/hruby_tools.rb +37 -0
- data/lib/HDLRuby/hruby_types.rb +239 -0
- data/lib/HDLRuby/hruby_values.rb +64 -0
- data/lib/HDLRuby/hruby_verilog.rb +1888 -0
- data/lib/HDLRuby/hruby_verilog_name.rb +52 -0
- data/lib/HDLRuby/low_samples/adder.yaml +97 -0
- data/lib/HDLRuby/low_samples/after.yaml +228 -0
- data/lib/HDLRuby/low_samples/before.yaml +223 -0
- data/lib/HDLRuby/low_samples/blockblock.yaml +48 -0
- data/lib/HDLRuby/low_samples/bugs/sample_add.yaml +97 -0
- data/lib/HDLRuby/low_samples/bugs/sample_daice.yaml +444 -0
- data/lib/HDLRuby/low_samples/bugs/sample_kumiawase.yaml +332 -0
- data/lib/HDLRuby/low_samples/bugs/sample_sub.yaml +97 -0
- data/lib/HDLRuby/low_samples/bugs/seqpar.yaml +184 -0
- data/lib/HDLRuby/low_samples/case.yaml +327 -0
- data/lib/HDLRuby/low_samples/change.yaml +135 -0
- data/lib/HDLRuby/low_samples/clocks.yaml +674 -0
- data/lib/HDLRuby/low_samples/cloner.rb +22 -0
- data/lib/HDLRuby/low_samples/comparer.yaml +85 -0
- data/lib/HDLRuby/low_samples/conditionals.yaml +133 -0
- data/lib/HDLRuby/low_samples/dff.yaml +107 -0
- data/lib/HDLRuby/low_samples/each.yaml +1328 -0
- data/lib/HDLRuby/low_samples/exporter.yaml +226 -0
- data/lib/HDLRuby/low_samples/functions.yaml +298 -0
- data/lib/HDLRuby/low_samples/generic_transmission.yaml +597 -0
- data/lib/HDLRuby/low_samples/inherit_as_dff.yaml +125 -0
- data/lib/HDLRuby/low_samples/inherit_dff.yaml +107 -0
- data/lib/HDLRuby/low_samples/load_yaml.rb +11 -0
- data/lib/HDLRuby/low_samples/memory.yaml +678 -0
- data/lib/HDLRuby/low_samples/namespace_extractor.rb +23 -0
- data/lib/HDLRuby/low_samples/overload.yaml +226 -0
- data/lib/HDLRuby/low_samples/paper_after.yaml +431 -0
- data/lib/HDLRuby/low_samples/port_maker.rb +14 -0
- data/lib/HDLRuby/low_samples/ram.yaml +207 -0
- data/lib/HDLRuby/low_samples/registers.yaml +228 -0
- data/lib/HDLRuby/low_samples/rom.yaml +2950 -0
- data/lib/HDLRuby/low_samples/shift.yaml +230 -0
- data/lib/HDLRuby/low_samples/shift2.yaml +2095 -0
- data/lib/HDLRuby/low_samples/simple_instance.yaml +102 -0
- data/lib/HDLRuby/low_samples/test_all.sh +43 -0
- data/lib/HDLRuby/low_samples/typedef.yaml +115 -0
- data/lib/HDLRuby/low_samples/values.yaml +577 -0
- data/lib/HDLRuby/low_samples/variable_maker.rb +14 -0
- data/lib/HDLRuby/low_samples/vector.yaml +56 -0
- data/lib/HDLRuby/low_samples/with_seq.yaml +188 -0
- data/lib/HDLRuby/low_samples/yaml2hdr.rb +10 -0
- data/lib/HDLRuby/low_samples/yaml2vhd.rb +19 -0
- data/lib/HDLRuby/sim/Makefile +19 -0
- data/lib/HDLRuby/sim/hruby_sim.h +590 -0
- data/lib/HDLRuby/sim/hruby_sim_calc.c +2362 -0
- data/lib/HDLRuby/sim/hruby_sim_core.c +589 -0
- data/lib/HDLRuby/sim/hruby_sim_list.c +93 -0
- data/lib/HDLRuby/sim/hruby_sim_vizualize.c +91 -0
- data/lib/HDLRuby/sim/hruby_value_pool.c +64 -0
- data/lib/HDLRuby/std/channel.rb +354 -0
- data/lib/HDLRuby/std/clocks.rb +165 -0
- data/lib/HDLRuby/std/counters.rb +82 -0
- data/lib/HDLRuby/std/decoder.rb +214 -0
- data/lib/HDLRuby/std/fsm.rb +516 -0
- data/lib/HDLRuby/std/pipeline.rb +220 -0
- data/lib/HDLRuby/std/reconf.rb +309 -0
- data/lib/HDLRuby/test_hruby_bstr.rb +2259 -0
- data/lib/HDLRuby/test_hruby_high.rb +594 -0
- data/lib/HDLRuby/test_hruby_high_low.rb +99 -0
- data/lib/HDLRuby/test_hruby_low.rb +934 -0
- data/lib/HDLRuby/v_samples/adder.v +10 -0
- data/lib/HDLRuby/v_samples/dff.v +12 -0
- data/lib/HDLRuby/v_samples/ram.v +20 -0
- data/lib/HDLRuby/v_samples/rom.v +270 -0
- data/lib/HDLRuby/version.rb +3 -0
- data/lib/HDLRuby.rb +11 -0
- data/makedoc +1 -0
- data/metadata.yaml +4 -0
- metadata +299 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
require "HDLRuby/hruby_base"
|
|
2
|
+
require "HDLRuby/hruby_bstr"
|
|
3
|
+
|
|
4
|
+
# @deprecated hruby_db.rb (former hruby_low.rb) is deprecated.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
warn "hruby_db.rb (former hruby_low.rb) is deprecated."
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
# Low-level libraries for describing digital hardware.
|
|
11
|
+
#######################################################
|
|
12
|
+
module HDLRuby::Low
|
|
13
|
+
|
|
14
|
+
Base = HDLRuby::Base
|
|
15
|
+
|
|
16
|
+
##
|
|
17
|
+
# Describes system type.
|
|
18
|
+
class SystemT < Base::SystemT
|
|
19
|
+
|
|
20
|
+
# Library of the existing system types.
|
|
21
|
+
SystemTs = { }
|
|
22
|
+
private_constant :SystemTs
|
|
23
|
+
|
|
24
|
+
# Get an existing system type by +name+.
|
|
25
|
+
def self.get(name)
|
|
26
|
+
return name if name.is_a?(SystemT)
|
|
27
|
+
return SystemTs[name.to_sym]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Creates a new system type named +name+.
|
|
31
|
+
def initialize(name)
|
|
32
|
+
# Initialize the system type structure.
|
|
33
|
+
super(name)
|
|
34
|
+
# Update the library of existing system types.
|
|
35
|
+
# Note: no check is made so an exisiting system type with a same
|
|
36
|
+
# name is overwritten.
|
|
37
|
+
SystemTs[@name] = self
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
##
|
|
42
|
+
# Module bringing low-level properties to types
|
|
43
|
+
module Ltype
|
|
44
|
+
|
|
45
|
+
# Library of the existing types.
|
|
46
|
+
Types = { }
|
|
47
|
+
private_constant :Types
|
|
48
|
+
|
|
49
|
+
# # Get an existing signal type by +name+.
|
|
50
|
+
# def self.get(name)
|
|
51
|
+
# return name if name.is_a?(Type)
|
|
52
|
+
# return Types[name.to_sym]
|
|
53
|
+
# end
|
|
54
|
+
|
|
55
|
+
# Ensures initialize registers the type name
|
|
56
|
+
# and adds the get methods to the class
|
|
57
|
+
def self.included(base) # built-in Ruby hook for modules
|
|
58
|
+
base.class_eval do
|
|
59
|
+
original_method = instance_method(:initialize)
|
|
60
|
+
define_method(:initialize) do |*args, &block|
|
|
61
|
+
original_method.bind(self).call(*args, &block)
|
|
62
|
+
# Update the library of existing types.
|
|
63
|
+
# Note: no check is made so an exisiting type with a same
|
|
64
|
+
# name is overwritten.
|
|
65
|
+
Types[@name] = self
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# Get an existing signal type by +name+.
|
|
69
|
+
def self.get(name)
|
|
70
|
+
# return name if name.is_a?(Type)
|
|
71
|
+
return name if name.respond_to?(:ltype?)
|
|
72
|
+
return Types[name.to_sym]
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Tells ltype has been included.
|
|
78
|
+
def ltype?
|
|
79
|
+
return true
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# ##
|
|
85
|
+
# # Describes a data type.
|
|
86
|
+
# class Type < Base::Type
|
|
87
|
+
# # The base type
|
|
88
|
+
# attr_reader :base
|
|
89
|
+
|
|
90
|
+
# # The size in bits
|
|
91
|
+
# attr_reader :size
|
|
92
|
+
|
|
93
|
+
# # Library of the existing types.
|
|
94
|
+
# Types = { }
|
|
95
|
+
# private_constant :Types
|
|
96
|
+
|
|
97
|
+
# # Get an existing signal type by +name+.
|
|
98
|
+
# def self.get(name)
|
|
99
|
+
# return name if name.is_a?(Type)
|
|
100
|
+
# return Types[name.to_sym]
|
|
101
|
+
# end
|
|
102
|
+
|
|
103
|
+
# # Creates a new type named +name+ based of +base+ and of +size+ bits.
|
|
104
|
+
# def initialize(name,base,size)
|
|
105
|
+
# # Initialize the structure of the data type.
|
|
106
|
+
# super(name)
|
|
107
|
+
# # Check and set the base.
|
|
108
|
+
# @base = base.to_sym
|
|
109
|
+
# # Check and set the size.
|
|
110
|
+
# @size = size.to_i
|
|
111
|
+
|
|
112
|
+
# # Update the library of existing types.
|
|
113
|
+
# # Note: no check is made so an exisiting type with a same
|
|
114
|
+
# # name is overwritten.
|
|
115
|
+
# Types[@name] = self
|
|
116
|
+
# end
|
|
117
|
+
# end
|
|
118
|
+
|
|
119
|
+
##
|
|
120
|
+
# Describes a data type.
|
|
121
|
+
class Type < Base::Type
|
|
122
|
+
include Ltype
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# ##
|
|
126
|
+
# # Describes a numeric type.
|
|
127
|
+
# class TypeNumeric < Base::TypeNumeric
|
|
128
|
+
# include Ltype
|
|
129
|
+
# end
|
|
130
|
+
|
|
131
|
+
##
|
|
132
|
+
# Describes a vector data type.
|
|
133
|
+
class TypeVector < Base::TypeVector
|
|
134
|
+
|
|
135
|
+
# Creates a new type vector named +name+ from a +base+ type and with
|
|
136
|
+
# +range+
|
|
137
|
+
def initialize(name,base,range)
|
|
138
|
+
# Ensure base si a HDLRuby::Low type.
|
|
139
|
+
base = Type.get(base)
|
|
140
|
+
# Create the type.
|
|
141
|
+
super(name,base,range)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
include Ltype
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
##
|
|
148
|
+
# Describes a signed integer data type.
|
|
149
|
+
class TypeSigned < Base::TypeSigned
|
|
150
|
+
include Ltype
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
##
|
|
154
|
+
# Describes a unsigned integer data type.
|
|
155
|
+
class TypeUnsigned < Base::TypeUnsigned
|
|
156
|
+
include Ltype
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
##
|
|
160
|
+
# Describes a float data type.
|
|
161
|
+
class TypeFloat < Base::TypeFloat
|
|
162
|
+
include Ltype
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Standard vector types.
|
|
166
|
+
Integer = TypeSigned.new(:integer)
|
|
167
|
+
Natural = TypeUnsigned.new(:natural)
|
|
168
|
+
Bignum = TypeSigned.new(:bignum,HDLRuby::Infinity..0)
|
|
169
|
+
Real = TypeFloat.new(:float)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
##
|
|
176
|
+
# Describes a tuple data type.
|
|
177
|
+
class TypeTuple < Base::TypeTuple
|
|
178
|
+
include Ltype
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
##
|
|
182
|
+
# Describes a structure data type.
|
|
183
|
+
class TypeStruct< Base::TypeStruct
|
|
184
|
+
include Ltype
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
##
|
|
189
|
+
# Describes a behavior.
|
|
190
|
+
class Behavior < Base::Behavior
|
|
191
|
+
end
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
##
|
|
195
|
+
# Describes a timed behavior.
|
|
196
|
+
#
|
|
197
|
+
# NOTE:
|
|
198
|
+
# * this is the only kind of behavior that can include time statements.
|
|
199
|
+
# * this kind of behavior is not synthesizable!
|
|
200
|
+
class TimeBehavior < Base::TimeBehavior
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
##
|
|
205
|
+
# Describes an event.
|
|
206
|
+
class Event < Base::Event
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
##
|
|
211
|
+
# Describes a block.
|
|
212
|
+
class Block < Base::Block
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
# Describes a timed block.
|
|
216
|
+
#
|
|
217
|
+
# NOTE:
|
|
218
|
+
# * this is the only kind of block that can include time statements.
|
|
219
|
+
# * this kind of block is not synthesizable!
|
|
220
|
+
class TimeBlock < Base::TimeBlock
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
##
|
|
225
|
+
# Decribes a piece of software code.
|
|
226
|
+
class Code < Base::Code
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
##
|
|
231
|
+
# Describes a signal.
|
|
232
|
+
class SignalI < Base::SignalI
|
|
233
|
+
# Creates a new signal named +name+ typed as +type+.
|
|
234
|
+
def initialize(name,type)
|
|
235
|
+
# Ensures type is from Low::Type
|
|
236
|
+
type = Type.get(type)
|
|
237
|
+
# Initialize the signal structure.
|
|
238
|
+
super(name,type)
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
##
|
|
244
|
+
# Describes a system instance.
|
|
245
|
+
class SystemI < Base::SystemI
|
|
246
|
+
|
|
247
|
+
# Creates a new system instance of system type +systemT+ named +name+.
|
|
248
|
+
def initialize(name, systemT)
|
|
249
|
+
# Ensures systemT is from Low::SystemT
|
|
250
|
+
systemT = SystemT.get(systemT)
|
|
251
|
+
# Initialize the system instance structure.
|
|
252
|
+
super(name,systemT)
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
##
|
|
259
|
+
# Describes a statement.
|
|
260
|
+
#
|
|
261
|
+
# NOTE: this is an abstract class which is not to be used directly.
|
|
262
|
+
class Statement < Base::Statement
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
# ##
|
|
267
|
+
# # Describes a declare statement.
|
|
268
|
+
# class Declare < Base::Declare
|
|
269
|
+
# end
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
##
|
|
273
|
+
# Decribes a transmission statement.
|
|
274
|
+
class Transmit < Base::Transmit
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
##
|
|
279
|
+
# Describes an if statement.
|
|
280
|
+
class If < Base::If
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
##
|
|
285
|
+
# Describes a case statement.
|
|
286
|
+
class Case < Base::Case
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
##
|
|
291
|
+
# Describes a delay: not synthesizable.
|
|
292
|
+
class Delay < Base::Delay
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
##
|
|
296
|
+
# Describes a wait delay statement: not synthesizable!
|
|
297
|
+
class TimeWait < Base::TimeWait
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
##
|
|
301
|
+
# Describes a timed loop statement: not synthesizable!
|
|
302
|
+
class TimeRepeat < Base::TimeRepeat
|
|
303
|
+
end
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
##
|
|
307
|
+
# Describes a connection.
|
|
308
|
+
#
|
|
309
|
+
# NOTE: eventhough a connection is semantically different from a
|
|
310
|
+
# transmission, it has a common structure. Therefore, it is described
|
|
311
|
+
# as a subclass of a transmit.
|
|
312
|
+
class Connection < Base::Connection
|
|
313
|
+
end
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
##
|
|
318
|
+
# Describes an expression.
|
|
319
|
+
#
|
|
320
|
+
# NOTE: this is an abstract class which is not to be used directly.
|
|
321
|
+
class Expression < Base::Expression
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
##
|
|
326
|
+
# Describes a value.
|
|
327
|
+
class Value < Base::Value
|
|
328
|
+
# Creates a new value typed as +type+ and containing numeric +content+.
|
|
329
|
+
def initialize(type,content)
|
|
330
|
+
# Ensures type is from Low::Type
|
|
331
|
+
type = Type.get(type)
|
|
332
|
+
# # Ensures the content is valid for low-level hardware.
|
|
333
|
+
# unless content.is_a?(Numeric) or
|
|
334
|
+
# content.is_a?(HDLRuby::BitString) then
|
|
335
|
+
# raise "Invalid type for a value content: #{content.class}."
|
|
336
|
+
# end # NOW CHECKED BY BASE
|
|
337
|
+
# Initialize the value structure.
|
|
338
|
+
super(type,content)
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
##
|
|
344
|
+
# Describes an operation.
|
|
345
|
+
#
|
|
346
|
+
# NOTE: this is an abstract class which is not to be used directly.
|
|
347
|
+
class Operation < Base::Operation
|
|
348
|
+
end
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
##
|
|
352
|
+
# Describes an unary operation.
|
|
353
|
+
class Unary < Base::Unary
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
##
|
|
358
|
+
# Describes an binary operation.
|
|
359
|
+
class Binary < Base::Binary
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
# ##
|
|
364
|
+
# # Describes a ternary operation.
|
|
365
|
+
# class Ternary < Base::Ternary
|
|
366
|
+
# end
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
##
|
|
370
|
+
# Describes a section operation (generalization of the ternary operator).
|
|
371
|
+
#
|
|
372
|
+
# NOTE: choice is using the value of +select+ as an index.
|
|
373
|
+
class Select < Base::Select
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
##
|
|
378
|
+
# Describes a concatenation expression.
|
|
379
|
+
class Concat < Base::Concat
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
##
|
|
384
|
+
# Describes a reference expression.
|
|
385
|
+
#
|
|
386
|
+
# NOTE: this is an abstract class which is not to be used directly.
|
|
387
|
+
class Ref < Base::Ref
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
##
|
|
392
|
+
# Describes reference concatenation.
|
|
393
|
+
class RefConcat < Base::RefConcat
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
##
|
|
398
|
+
# Describes an index reference.
|
|
399
|
+
class RefIndex < Base::RefIndex
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
##
|
|
404
|
+
# Describes a range reference.
|
|
405
|
+
class RefRange < Base::RefRange
|
|
406
|
+
end
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
##
|
|
410
|
+
# Describes a name reference.
|
|
411
|
+
class RefName < Base::RefName
|
|
412
|
+
end
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
##
|
|
416
|
+
# Describe a this reference.
|
|
417
|
+
#
|
|
418
|
+
# This is the current system.
|
|
419
|
+
class RefThis < Base::RefThis
|
|
420
|
+
end
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
# # Ensures constants defined is this module are prioritary.
|
|
424
|
+
# # @!visibility private
|
|
425
|
+
# def self.included(base) # :nodoc:
|
|
426
|
+
# if base.const_defined?(:SignalI) then
|
|
427
|
+
# base.send(:remove_const,:SignalI)
|
|
428
|
+
# base.const_set(:SignalI,HDLRuby::Low::Signal)
|
|
429
|
+
# end
|
|
430
|
+
# end
|
|
431
|
+
|
|
432
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
module HDLRuby
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## The HDLRuby general error class.
|
|
5
|
+
class AnyError < ::StandardError
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
module High
|
|
9
|
+
## The HDLRuby::High error class.
|
|
10
|
+
class AnyError < HDLRuby::AnyError
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
## The HDLRuby error class replacing the standard Ruby NoMethodError
|
|
14
|
+
class NotDefinedError < AnyError
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
module Low
|
|
19
|
+
## The HDLRuby::Low error class.
|
|
20
|
+
class AnyError < HDLRuby::AnyError
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
## Execution context for processing error messages in +code+.
|
|
25
|
+
# The relevant error message to are assumed to be the ones whose file
|
|
26
|
+
# name is one given in +files+.
|
|
27
|
+
def error_manager(files,&code)
|
|
28
|
+
begin
|
|
29
|
+
code.call
|
|
30
|
+
rescue ::StandardError => e
|
|
31
|
+
# pp e.backtrace
|
|
32
|
+
# Keep the relevant
|
|
33
|
+
e.backtrace.select! do |mess|
|
|
34
|
+
files.find {|file| mess.include?(File.basename(file))}
|
|
35
|
+
end
|
|
36
|
+
puts "#{e.backtrace[0]}: #{e.message}"
|
|
37
|
+
e.backtrace[1..-1].each { |mess| puts " from #{mess}"}
|
|
38
|
+
exit
|
|
39
|
+
rescue
|
|
40
|
+
raise "Big Bad Bug"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|