HDLRuby 2.4.17 → 2.4.18
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/lib/HDLRuby/hdr_samples/with_connector.rb +37 -6
- data/lib/HDLRuby/std/connector.rb +42 -1
- data/lib/HDLRuby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84f01afb241f5e5e208e4fc47e12e9f1ae8e63e759181280500c2a591999c28d
|
4
|
+
data.tar.gz: 4ae5e9c2eecc25f26803da8c4b70e0bcfa57e7979759d9a194bb6effd515788d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f721bbbbbddd9328444b446a882623428e638cdacc3d09c41a86b7c7e260e662e43df7747f91c7eeb3e498b335495722268869f151cff64aaf0d953385285d6b
|
7
|
+
data.tar.gz: 48e48595def6334b972eec991ae83a44876e30994101dd336a7036608c7da47799eafa7fdfb955e11d6f12f7b9728cafdea5fde1d933d6d3c165ef1ba1cdd375
|
@@ -125,7 +125,9 @@ end
|
|
125
125
|
# Module for testing the connector.
|
126
126
|
system :with_connectors do
|
127
127
|
inner :clk, :rst
|
128
|
-
|
128
|
+
|
129
|
+
# First tester.
|
130
|
+
[4].inner :counter
|
129
131
|
[4*4].inner :res
|
130
132
|
inner :ack_in, :ack_out
|
131
133
|
|
@@ -146,6 +148,22 @@ system :with_connectors do
|
|
146
148
|
# Connect the middle queues to the output queue.
|
147
149
|
merger([bit[4]]*4,clk.negedge,mid_qus,out_qu)
|
148
150
|
|
151
|
+
|
152
|
+
# Second tester.
|
153
|
+
[4].inner :counterb
|
154
|
+
[4].inner :resb
|
155
|
+
inner :ack_inb0, :ack_inb1, :ack_outb
|
156
|
+
|
157
|
+
# The input queues.
|
158
|
+
queue(bit[4],4,clk,rst).(:in_qub0)
|
159
|
+
queue(bit[4],4,clk,rst).(:in_qub1)
|
160
|
+
|
161
|
+
# The output queue.
|
162
|
+
queue(bit[4],4,clk,rst).(:out_qub)
|
163
|
+
|
164
|
+
# Connect then with a serializer.
|
165
|
+
serializer(bit[4],clk.negedge,[in_qub0,in_qub1],out_qub)
|
166
|
+
|
149
167
|
# # Slow version, always work
|
150
168
|
# par(clk.posedge) do
|
151
169
|
# ack_in <= 0
|
@@ -171,19 +189,32 @@ system :with_connectors do
|
|
171
189
|
# Fast version but assumes connected channels are blocking
|
172
190
|
par(clk.posedge) do
|
173
191
|
ack_in <= 0
|
174
|
-
|
192
|
+
ack_inb0 <= 0
|
193
|
+
ack_inb1 <= 0
|
194
|
+
hif(rst) { counter <= 0; counterb <= 0 }
|
175
195
|
helse do
|
176
196
|
in_qu.write(counter) do
|
177
197
|
ack_in <= 1
|
178
198
|
counter <= counter + 1
|
179
199
|
end
|
180
200
|
hif(ack_in) do
|
181
|
-
# mid_qu0.read(res_0)
|
182
|
-
# mid_qu1.read(res_1)
|
183
|
-
# mid_qu2.read(res_2)
|
184
|
-
# mid_qu3.read(res_3)
|
185
201
|
out_qu.read(res)
|
186
202
|
end
|
203
|
+
hif(~ack_inb0) do
|
204
|
+
in_qub0.write(counterb) do
|
205
|
+
ack_inb0 <= 1
|
206
|
+
counterb <= counterb + 1
|
207
|
+
end
|
208
|
+
end
|
209
|
+
helse do
|
210
|
+
in_qub1.write(counterb) do
|
211
|
+
ack_inb1 <= 1
|
212
|
+
counterb <= counterb + 1
|
213
|
+
end
|
214
|
+
end
|
215
|
+
hif(ack_inb0 | ack_inb1) do
|
216
|
+
out_qub.read(resb)
|
217
|
+
end
|
187
218
|
end
|
188
219
|
end
|
189
220
|
|
@@ -37,7 +37,7 @@ module HDLRuby::High::Std
|
|
37
37
|
|
38
38
|
# Function for generating a connector that merges the output of
|
39
39
|
# channels +in_chs+ and connects the result to channel +out_ch+ with
|
40
|
-
# data of +
|
40
|
+
# data of types from +typs+.
|
41
41
|
# The merge is done according to event +ev+.
|
42
42
|
function :merger do |typs, ev, in_chs, out_ch|
|
43
43
|
ev = ev.posedge unless ev.is_a?(Event)
|
@@ -63,5 +63,46 @@ module HDLRuby::High::Std
|
|
63
63
|
end
|
64
64
|
|
65
65
|
|
66
|
+
# Function for generating a connector that serialize to the output of
|
67
|
+
# channels +in_chs+ and connects the result to channel +out_ch+ with
|
68
|
+
# data of +typ+.
|
69
|
+
# The merge is done according to event +ev+.
|
70
|
+
function :serializer do |typ, ev, in_chs, out_ch|
|
71
|
+
ev = ev.posedge unless ev.is_a?(Event)
|
72
|
+
size = in_chs.size
|
73
|
+
inner :out_ack
|
74
|
+
# in_reqs = size.times.map { |i| inner(:"in_req#{i}") }
|
75
|
+
in_acks = size.times.map { |i| inner(:"in_ack#{i}") }
|
76
|
+
datas = size.times.map { |i| typ.inner(:"data#{i}") }
|
77
|
+
# The inpt channel selector
|
78
|
+
[size.width].inner :idx
|
79
|
+
inner :reading
|
80
|
+
par(ev) do
|
81
|
+
# in_reqs.each { |req| req <= 1 }
|
82
|
+
idx <= 0
|
83
|
+
reading <= 0
|
84
|
+
out_ack <= 0
|
85
|
+
# hif(idx == size) { in_reqs.each { |req| req <= 0 } }
|
86
|
+
# hif((idx == 0) & (in_reqs.reduce(_1) { |sum,req| req & sum })) do
|
87
|
+
hif(idx == 0) do
|
88
|
+
hif(~reading) do
|
89
|
+
size.times { |i| in_acks[i] <= 0 }
|
90
|
+
end
|
91
|
+
reading <= 1
|
92
|
+
in_chs.each_with_index do |ch,i|
|
93
|
+
ch.read(datas[i]) { in_acks[i] <= 1 }
|
94
|
+
end
|
95
|
+
end
|
96
|
+
hif(in_acks.reduce(_1) { |sum,req| req & sum }) do
|
97
|
+
hcase(idx)
|
98
|
+
datas.each_with_index do |data,i|
|
99
|
+
hwhen(i) do
|
100
|
+
out_ch.write(data) { idx <= idx + 1; out_ack <= 1 }
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
66
107
|
|
67
108
|
end
|
data/lib/HDLRuby/version.rb
CHANGED
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.4.
|
4
|
+
version: 2.4.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lovic Gauthier
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|