HDLRuby 2.4.6 → 2.4.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/HDLRuby/hdr_samples/make_multi_channels_vcd.rb +25 -0
- data/lib/HDLRuby/hdr_samples/mei8_bench.rb +1 -1
- data/lib/HDLRuby/hdr_samples/neg_arith_bench.rb +49 -0
- data/lib/HDLRuby/hdr_samples/with_fixpoint.rb +30 -0
- data/lib/HDLRuby/hdr_samples/with_memory_rom.rb +53 -0
- data/lib/HDLRuby/hdr_samples/with_multi_channels.rb +113 -18
- data/lib/HDLRuby/hruby_bstr.rb +2 -0
- data/lib/HDLRuby/hruby_low2c.rb +8 -3
- data/lib/HDLRuby/sim/hruby_sim.h +3 -2
- data/lib/HDLRuby/sim/hruby_sim_calc.c +20 -5
- data/lib/HDLRuby/std/fixpoint.rb +10 -2
- data/lib/HDLRuby/std/linear.rb +19 -7
- data/lib/HDLRuby/std/memory.rb +186 -33
- data/lib/HDLRuby/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83c18b423b30c97938839cb341f03a35cf41a11ddedf90a2ec9609fe0da1b087
|
4
|
+
data.tar.gz: 39bd0518a77431e8b15dec7631f37bb6f0ff8e95639d107c71569cfe73c6630b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0639d240f7f297771065b7781f3a78cab4628540b9616b2b3b28f64a044698f7030413cecaadeb038f816311bbb247ad7f7be715f12cc1893c0fcc3095bfe5bd'
|
7
|
+
data.tar.gz: d71455388840152cfbd8dc8a07743ed0970f8b319316e929c42576eb50757a70577fbeab737b6f8ea87d7f0bd9c6fbb1a3836dacbaa9dc869394798f2e1189d6
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# Script for generating the vcd files.
|
3
|
+
|
4
|
+
# The configuration scenarii
|
5
|
+
$scenarii = [
|
6
|
+
[:sync, :register], # 00
|
7
|
+
[:sync, :handshake], # 01
|
8
|
+
[:sync, :queue], # 02
|
9
|
+
[:nsync, :register], # 03
|
10
|
+
[:nsync, :handshake], # 04
|
11
|
+
[:nsync, :queue], # 05
|
12
|
+
[:async, :register], # 06
|
13
|
+
[:async, :handshake], # 07
|
14
|
+
[:async, :queue], # 08
|
15
|
+
[:proco, :register], # 09
|
16
|
+
[:proco, :handshake], # 10
|
17
|
+
[:proco, :queue], # 11
|
18
|
+
[:double,:register], # 12
|
19
|
+
[:double,:handshake], # 13
|
20
|
+
[:double,:queue] # 14
|
21
|
+
]
|
22
|
+
(0..11).each do |i|
|
23
|
+
`bundle exec ../hdrcc.rb -S --vcd with_multi_channels.rb WithMultiChannelPaper #{i}`
|
24
|
+
`mv WithMultiChannelPaper/hruby_simulator.vcd WithMultiChannelPaper/#{i.to_s.to_s.rjust(2,"0")}_#{$scenarii[i][0]}_#{$scenarii[i][1]}.vcd`
|
25
|
+
end
|
@@ -5,7 +5,7 @@ include HDLRuby::High::Std
|
|
5
5
|
# A simple implementation of the MEI8 processor.
|
6
6
|
#
|
7
7
|
# In this implementation, the program is hard-coded in an internal ROM
|
8
|
-
system :mei8 do |prog_file = "./
|
8
|
+
system :mei8 do |prog_file = "./prog.obj"|
|
9
9
|
# Clock and reset.
|
10
10
|
input :clk, :rst
|
11
11
|
# Bus.
|
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
# A benchmark for testing the arithmetic with signed values.
|
3
|
+
system :neg_arith_bench do
|
4
|
+
signed[11..0].inner :x,:y,:z
|
5
|
+
|
6
|
+
timed do
|
7
|
+
x <= 10
|
8
|
+
y <= 10
|
9
|
+
z <= 0
|
10
|
+
!10.ns
|
11
|
+
z <= 10 * 10
|
12
|
+
!10.ns
|
13
|
+
z <= x * y
|
14
|
+
!10.ns
|
15
|
+
x <= 10
|
16
|
+
y <= -10
|
17
|
+
!10.ns
|
18
|
+
z <= 10 * (-10)
|
19
|
+
!10.ns
|
20
|
+
z <= x * y
|
21
|
+
!10.ns
|
22
|
+
x <= -10
|
23
|
+
y <= 10
|
24
|
+
!10.ns
|
25
|
+
z <= (-10) * 10
|
26
|
+
!10.ns
|
27
|
+
z <= x * y
|
28
|
+
!10.ns
|
29
|
+
x <= -10
|
30
|
+
y <= -10
|
31
|
+
!10.ns
|
32
|
+
z <= (-10) * (-10)
|
33
|
+
!10.ns
|
34
|
+
z <= x * y
|
35
|
+
!10.ns
|
36
|
+
x <= _000000011010
|
37
|
+
y <= _000011111010
|
38
|
+
z <= 0
|
39
|
+
!10.ns
|
40
|
+
z <= x * y
|
41
|
+
!10.ns
|
42
|
+
x <= _000000011010
|
43
|
+
y <= _111111111010
|
44
|
+
z <= 0
|
45
|
+
!10.ns
|
46
|
+
z <= x * y
|
47
|
+
!10.ns
|
48
|
+
end
|
49
|
+
end
|
@@ -31,5 +31,35 @@ system :fix_test do
|
|
31
31
|
d <= 0
|
32
32
|
!10.ns
|
33
33
|
d <= d + c
|
34
|
+
!10.ns
|
35
|
+
d <= d / c
|
36
|
+
!10.ns
|
37
|
+
d <= d / 3.to_fix(4)
|
38
|
+
!10.ns
|
39
|
+
d <= 1.to_fix(4) - d
|
40
|
+
!10.ns
|
41
|
+
d <= -d
|
42
|
+
!10.ns
|
43
|
+
d <= d * 3.to_fix(4)
|
44
|
+
!10.ns
|
45
|
+
d <= -d
|
46
|
+
!10.ns
|
47
|
+
a <= -0.375.to_fix(4)
|
48
|
+
b <= 1.625.to_fix(4)
|
49
|
+
!10.ns
|
50
|
+
c <= a * b
|
51
|
+
!10.ns
|
52
|
+
# a <= _00010000
|
53
|
+
# b <= _00010101
|
54
|
+
a <= _0000111x
|
55
|
+
b <= _1110011x
|
56
|
+
!10.ns
|
57
|
+
# a <= a & _11111110
|
58
|
+
# b <= b | _00000001
|
59
|
+
a <= a | _00000001
|
60
|
+
b <= b | _00000001
|
61
|
+
!10.ns
|
62
|
+
c <= a * b
|
63
|
+
!10.ns
|
34
64
|
end
|
35
65
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'std/memory.rb'
|
2
|
+
|
3
|
+
include HDLRuby::High::Std
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
# A system testing the rom channel.
|
10
|
+
system :rorm_test do
|
11
|
+
inner :clk,:rst
|
12
|
+
[8].inner :value
|
13
|
+
inner :addr
|
14
|
+
|
15
|
+
# Declares a 8-bit-data and 1 element rom address synchronous memory
|
16
|
+
# on negative edge of clk.
|
17
|
+
# mem_rom([8],2,clk,rst,[_00000110,_00000111], rinc: :rst).(:romI)
|
18
|
+
mem_rom([8],1,clk,rst,[_00000110], rinc: :rst).(:romI)
|
19
|
+
rd = romI.branch(:rinc)
|
20
|
+
|
21
|
+
par(clk.posedge) do
|
22
|
+
hif(rst) { addr <= 0 }
|
23
|
+
helse do
|
24
|
+
rd.read(value)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
timed do
|
29
|
+
clk <= 0
|
30
|
+
rst <= 0
|
31
|
+
!10.ns
|
32
|
+
clk <= 1
|
33
|
+
!10.ns
|
34
|
+
clk <= 0
|
35
|
+
rst <= 1
|
36
|
+
!10.ns
|
37
|
+
clk <= 1
|
38
|
+
!10.ns
|
39
|
+
clk <= 0
|
40
|
+
!10.ns
|
41
|
+
clk <= 1
|
42
|
+
!10.ns
|
43
|
+
clk <= 0
|
44
|
+
rst <= 0
|
45
|
+
!10.ns
|
46
|
+
10.times do
|
47
|
+
clk <= 1
|
48
|
+
!10.ns
|
49
|
+
clk <= 0
|
50
|
+
!10.ns
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -60,12 +60,16 @@ channel(:queue) do |typ,depth,clk,rst|
|
|
60
60
|
top_block.unshift do
|
61
61
|
rcmd <= 0
|
62
62
|
hrack <= 0
|
63
|
-
end
|
64
|
-
seq do
|
65
63
|
hif(rack) do
|
66
64
|
blk.call if blk
|
67
65
|
end
|
68
|
-
|
66
|
+
end
|
67
|
+
seq do
|
68
|
+
# hif(rack) do
|
69
|
+
# blk.call if blk
|
70
|
+
# end
|
71
|
+
# helse do
|
72
|
+
hif(rack==0) do
|
69
73
|
rcmd <= 1
|
70
74
|
target <= rdata
|
71
75
|
end
|
@@ -92,12 +96,16 @@ channel(:queue) do |typ,depth,clk,rst|
|
|
92
96
|
top_block.unshift do
|
93
97
|
wcmd <= 0
|
94
98
|
hwack <= 0
|
95
|
-
end
|
96
|
-
seq do
|
97
99
|
hif(wack) do
|
98
100
|
blk.call if blk
|
99
101
|
end
|
100
|
-
|
102
|
+
end
|
103
|
+
seq do
|
104
|
+
# hif(wack) do
|
105
|
+
# blk.call if blk
|
106
|
+
# end
|
107
|
+
# helse
|
108
|
+
hif(wack==0) { wcmd <= 1 }
|
101
109
|
wdata <= target
|
102
110
|
end
|
103
111
|
end
|
@@ -135,7 +143,7 @@ channel(:handshake) do |typ|
|
|
135
143
|
# The data signal.
|
136
144
|
typ.inner :data
|
137
145
|
# The request and acknowledge.
|
138
|
-
|
146
|
+
inner :req, :ack
|
139
147
|
|
140
148
|
reader_input :ack, :data
|
141
149
|
reader_output :req
|
@@ -173,48 +181,116 @@ channel(:handshake) do |typ|
|
|
173
181
|
end
|
174
182
|
end
|
175
183
|
|
184
|
+
# Channel describing a handshake for transmitting data of +typ+ type, reset
|
185
|
+
# by +rst+
|
186
|
+
channel(:handshake2) do |typ|
|
187
|
+
# The data signal.
|
188
|
+
typ.inner :data
|
189
|
+
# The request and acknowledge.
|
190
|
+
inner :req, :ack
|
191
|
+
# The write flag
|
192
|
+
inner :wf
|
193
|
+
|
194
|
+
reader_input :ack, :data
|
195
|
+
reader_output :req
|
196
|
+
|
197
|
+
# The read primitive.
|
198
|
+
reader do |blk,target|
|
199
|
+
top_block.unshift do
|
200
|
+
req <= 0
|
201
|
+
hif(ack & req == 1) do
|
202
|
+
target <= data
|
203
|
+
req <= 0
|
204
|
+
blk.call if blk
|
205
|
+
end
|
206
|
+
end
|
207
|
+
hif(ack == 0) do
|
208
|
+
req <= 1
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
writer_input :req
|
213
|
+
writer_output :ack, :data
|
214
|
+
writer_inout :wf
|
215
|
+
|
216
|
+
# The read primitive.
|
217
|
+
writer do |blk,target|
|
218
|
+
top_block.unshift do
|
219
|
+
ack <= 0
|
220
|
+
hif(wf & req & ~ack == 1) do
|
221
|
+
data <= target
|
222
|
+
ack <= 1
|
223
|
+
blk.call if blk
|
224
|
+
end
|
225
|
+
hif(~req) { wf <= 0 }
|
226
|
+
end
|
227
|
+
hif(~ack) do
|
228
|
+
wf <= 1
|
229
|
+
end
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
176
233
|
|
177
234
|
# $mode = :sync
|
178
235
|
# $mode = :nsync
|
179
236
|
# $mode = :async
|
180
|
-
# $mode = :proco #
|
237
|
+
# $mode = :proco # Producer / Consummer
|
238
|
+
# $mode = :double # Producer and Consummer with double channels.
|
181
239
|
# $channel = :register
|
182
240
|
# $channel = :handshake
|
183
241
|
# $channel = :queue
|
184
242
|
|
185
243
|
# The configuration scenarii
|
186
|
-
$scenarii = [
|
187
|
-
[:
|
188
|
-
[:
|
189
|
-
[:
|
244
|
+
$scenarii = [
|
245
|
+
[:sync, :register], # 0
|
246
|
+
[:sync, :handshake], # 1
|
247
|
+
[:sync, :queue], # 3
|
248
|
+
[:nsync, :register], # 4
|
249
|
+
[:nsync, :handshake], # 5
|
250
|
+
[:nsync, :queue], # 6
|
251
|
+
[:async, :register], # 7
|
252
|
+
[:async, :handshake], # 8
|
253
|
+
[:async, :queue], # 9
|
254
|
+
[:proco, :register], # 10
|
255
|
+
[:proco, :handshake], # 11
|
256
|
+
[:proco, :queue], # 12
|
257
|
+
[:double,:register], # 13
|
258
|
+
[:double,:handshake], # 14
|
259
|
+
[:double,:queue] # 15
|
260
|
+
]
|
190
261
|
|
191
262
|
# The configuration
|
192
|
-
$mode, $channel = $scenarii[11]
|
263
|
+
# $mode, $channel = $scenarii[11]
|
264
|
+
$mode, $channel = $scenarii[ARGV[-1].to_i]
|
265
|
+
puts "scenario: #{$scenarii[ARGV[-1].to_i]}"
|
193
266
|
|
194
267
|
# Testing the queue channel.
|
195
268
|
system :test_queue do
|
196
269
|
inner :clk, :rst, :clk2, :clk3
|
197
|
-
[8].inner :idata, :odata
|
270
|
+
[8].inner :idata, :odata, :odata2
|
198
271
|
[4].inner :counter
|
199
272
|
|
200
273
|
if $channel == :register then
|
201
274
|
register(bit[8]).(:my_ch)
|
275
|
+
register(bit[8]).(:my_ch2)
|
202
276
|
elsif $channel == :handshake then
|
203
277
|
handshake(bit[8],rst).(:my_ch)
|
278
|
+
handshake(bit[8],rst).(:my_ch2)
|
204
279
|
elsif $channel == :queue then
|
205
280
|
queue(bit[8],5,clk,rst).(:my_ch)
|
281
|
+
queue(bit[8],5,clk,rst).(:my_ch2)
|
206
282
|
end
|
207
283
|
|
208
284
|
ev = $mode == :sync ? clk.posedge :
|
209
285
|
$mode == :nsync ? clk.negedge : clk2.posedge
|
210
286
|
|
211
|
-
if $mode != :proco then
|
287
|
+
if $mode != :proco && $mode != :double then
|
212
288
|
# Sync/Neg sync and async tests mode
|
213
289
|
par(ev) do
|
214
290
|
hif(rst) do
|
215
291
|
counter <= 0
|
216
292
|
idata <= 0
|
217
|
-
odata <= 0
|
293
|
+
# odata <= 0
|
218
294
|
end
|
219
295
|
helse do
|
220
296
|
hif (counter < 4) do
|
@@ -225,7 +301,7 @@ system :test_queue do
|
|
225
301
|
end
|
226
302
|
helsif ((counter > 10) & (counter < 15)) do
|
227
303
|
my_ch.read(odata) do
|
228
|
-
idata <= idata - odata
|
304
|
+
# idata <= idata - odata
|
229
305
|
counter <= counter + 1
|
230
306
|
end
|
231
307
|
end
|
@@ -234,7 +310,7 @@ system :test_queue do
|
|
234
310
|
end
|
235
311
|
end
|
236
312
|
end
|
237
|
-
|
313
|
+
elsif $mode == :proco then
|
238
314
|
# Producter/consumer mode
|
239
315
|
# Producer
|
240
316
|
par(clk2.posedge) do
|
@@ -258,6 +334,25 @@ system :test_queue do
|
|
258
334
|
end
|
259
335
|
end
|
260
336
|
end
|
337
|
+
else
|
338
|
+
# Producer and consumer are commicating through two layers of channels
|
339
|
+
par(ev) do
|
340
|
+
hif(rst) do
|
341
|
+
counter <= 0
|
342
|
+
idata <= 0
|
343
|
+
end
|
344
|
+
helse do
|
345
|
+
my_ch.write(idata) do
|
346
|
+
idata <= idata + 1
|
347
|
+
end
|
348
|
+
my_ch.read(odata) do
|
349
|
+
my_ch2.write(odata)
|
350
|
+
end
|
351
|
+
my_ch2.read(odata2) do
|
352
|
+
counter <= counter + 1
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
261
356
|
end
|
262
357
|
|
263
358
|
timed do
|
data/lib/HDLRuby/hruby_bstr.rb
CHANGED
@@ -32,6 +32,7 @@ module HDLRuby
|
|
32
32
|
# and negative when "1".
|
33
33
|
# * when not present it is assumed to be within str.
|
34
34
|
def initialize(str,sign = nil)
|
35
|
+
# puts "str=#{str}"
|
35
36
|
# Maybe str is an numeric.
|
36
37
|
if str.is_a?(Numeric) then
|
37
38
|
# Yes, convert it to a binary string.
|
@@ -74,6 +75,7 @@ module HDLRuby
|
|
74
75
|
end.reverse.join
|
75
76
|
end
|
76
77
|
@str += str.to_s.downcase
|
78
|
+
# puts "@str=#{@str}"
|
77
79
|
unless @str.match(/^[0-1zx]+$/) then
|
78
80
|
raise "Invalid value for creating a bit string: #{str}"
|
79
81
|
end
|
data/lib/HDLRuby/hruby_low2c.rb
CHANGED
@@ -1450,7 +1450,11 @@ module HDLRuby::Low
|
|
1450
1450
|
if self.content >= 0 then
|
1451
1451
|
str = self.content.to_s(2).rjust(width,"0").upcase
|
1452
1452
|
else
|
1453
|
-
|
1453
|
+
# Compute the extension to the next multiple
|
1454
|
+
# of int_width
|
1455
|
+
ext_width = (((width-1) / Low2C.int_width)+1)*Low2C.int_width
|
1456
|
+
# Convert the string.
|
1457
|
+
str = (2**ext_width+self.content).to_s(2).upcase
|
1454
1458
|
end
|
1455
1459
|
# puts "content=#{self.content} str=#{str}"
|
1456
1460
|
end
|
@@ -1465,13 +1469,14 @@ module HDLRuby::Low
|
|
1465
1469
|
res << " };\n"
|
1466
1470
|
# Create the value.
|
1467
1471
|
res << " " * (level+1)*3
|
1468
|
-
# puts "str=#{str} type width=#{self.type.width}"
|
1472
|
+
# puts "str=#{str} type width=#{self.type.width} signed? #{type.signed?}"
|
1469
1473
|
res << "return make_set_value(#{self.type.to_c(level+1)},1," +
|
1470
1474
|
"data);\n"
|
1471
1475
|
else
|
1472
1476
|
# No, generate a bit string value.
|
1473
1477
|
res << " " * (level+1)*3
|
1474
|
-
res << "static unsigned char data[] = \"#{str}\";\n"
|
1478
|
+
# res << "static unsigned char data[] = \"#{str}\";\n"
|
1479
|
+
res << "static unsigned char data[] = \"#{str.reverse}\";\n"
|
1475
1480
|
# Create the value.
|
1476
1481
|
res << " " * (level+1)*3
|
1477
1482
|
res << "return make_set_value(#{self.type.to_c(level+1)},0," +
|
data/lib/HDLRuby/sim/hruby_sim.h
CHANGED
@@ -50,8 +50,9 @@ typedef enum {
|
|
50
50
|
|
51
51
|
/* The interface to the type engine. */
|
52
52
|
typedef struct FlagsS_ {
|
53
|
-
unsigned int all;
|
54
|
-
unsigned int sign : 1; /* Tells if the type is signed or not. */
|
53
|
+
// unsigned int all;
|
54
|
+
// unsigned int sign : 1; /* Tells if the type is signed or not. */
|
55
|
+
unsigned int sign; /* Tells if the type is signed or not. */
|
55
56
|
} FlagsS;
|
56
57
|
|
57
58
|
/** The type structure. */
|
@@ -70,7 +70,8 @@ static List hash_type[HASH_TYPE_SIZE] = {};
|
|
70
70
|
* @return the resulting type. */
|
71
71
|
static int hash_value(unsigned long long base, unsigned long long number,
|
72
72
|
FlagsS flags) {
|
73
|
-
return ((base+flags.all)^(number)) & 1023;
|
73
|
+
// return ((base+flags.all)^(number)) & 1023;
|
74
|
+
return ((base+flags.sign)^(number)) & 1023;
|
74
75
|
}
|
75
76
|
|
76
77
|
/** Adds a type to the hash of types.
|
@@ -109,7 +110,8 @@ static Type get_hash_type(Type base, unsigned long long number) {
|
|
109
110
|
while(elem) {
|
110
111
|
Type type = elem->data;
|
111
112
|
if ((type->base == bw) && (type->number == number) &&
|
112
|
-
(type->flags.all == flags.all)) {
|
113
|
+
// (type->flags.all == flags.all)) {
|
114
|
+
(type->flags.sign == flags.sign)) {
|
113
115
|
/* The type is found. */
|
114
116
|
return type;
|
115
117
|
}
|
@@ -243,8 +245,10 @@ void resize_value(Value value, int size) {
|
|
243
245
|
void set_value(Value value, int numeric, void* data) {
|
244
246
|
value->numeric = numeric;
|
245
247
|
if (numeric) {
|
248
|
+
// printf("set_value with data=%llx\n",*(unsigned long long*)data);
|
246
249
|
value->data_int = *((unsigned long long*)data);
|
247
250
|
} else {
|
251
|
+
// printf("data=%s\n",(char*)data);
|
248
252
|
memcpy(value->data_str,data,type_width(value->type)*sizeof(char));
|
249
253
|
}
|
250
254
|
}
|
@@ -254,6 +258,7 @@ void set_value(Value value, int numeric, void* data) {
|
|
254
258
|
* @param numeric tell if the value is in numeric form or in bitstring form
|
255
259
|
* @param data the source data */
|
256
260
|
Value make_set_value(Type type, int numeric, void* data) {
|
261
|
+
// printf("make_set_value with type->flags.sign=%x\n",type->flags.sign);
|
257
262
|
Value value = make_value(type,numeric);
|
258
263
|
set_value(value,numeric,data);
|
259
264
|
return value;
|
@@ -307,6 +312,7 @@ Value copy_value(Value src, Value dst) {
|
|
307
312
|
/* Numeric copy. */
|
308
313
|
dst->data_int = fix_numeric_type(dst->type,src->data_int);
|
309
314
|
} else {
|
315
|
+
// printf("copy_value with bit string: %s\n",src->data_str);
|
310
316
|
/* Resize the destination if required. */
|
311
317
|
resize_value(dst,type_width(dst->type));
|
312
318
|
/* Bitstring copy up to the end of dst or src. */
|
@@ -603,12 +609,14 @@ static Value sub_value_bitstring(Value src0, Value src1, Value dst) {
|
|
603
609
|
* @param dst the destination value
|
604
610
|
* @return dst */
|
605
611
|
static Value mul_value_defined_bitstring(Value src0, Value src1, Value dst) {
|
612
|
+
// printf("mul_value_defined_bitstring with src0=%llx src1=%llx\n",value2integer(src0),value2integer(src1));
|
606
613
|
/* Sets state of the destination using the first source. */
|
607
614
|
dst->type = src0->type;
|
608
615
|
dst->numeric = 1;
|
609
616
|
|
610
617
|
/* Perform the multiplication. */
|
611
618
|
dst->data_int = value2integer(src0) * value2integer(src1);
|
619
|
+
// printf("dst->data_int=%llx\n",dst->data_int);
|
612
620
|
return dst;
|
613
621
|
}
|
614
622
|
|
@@ -1172,7 +1180,7 @@ static Value equal_value_bitstring(Value src0, Value src1, Value dst) {
|
|
1172
1180
|
static Value select_value_bitstring(Value cond, Value dst, unsigned int num,
|
1173
1181
|
va_list args)
|
1174
1182
|
{
|
1175
|
-
printf("select_value_bitstring with cond=%s\n",cond->data_str);
|
1183
|
+
// printf("select_value_bitstring with cond=%s\n",cond->data_str);
|
1176
1184
|
/* Get the first alternative for sizing the result. */
|
1177
1185
|
Value src = va_arg(args,Value);
|
1178
1186
|
/* Compute the width of the result in bits. */
|
@@ -1556,6 +1564,7 @@ static Value sub_value_numeric(Value src0, Value src1, Value dst) {
|
|
1556
1564
|
* @param dst the destination value
|
1557
1565
|
* @return dst */
|
1558
1566
|
static Value mul_value_numeric(Value src0, Value src1, Value dst) {
|
1567
|
+
// printf("mul_value_numeric with src0->data_int=%llx src1->data_int=%llx\n",src0->data_int, src1->data_int);
|
1559
1568
|
/* Sets state of the destination using the first source. */
|
1560
1569
|
dst->type = src0->type;
|
1561
1570
|
dst->numeric = 1;
|
@@ -1823,7 +1832,7 @@ static Value concat_value_numeric_array(int num, int dir,
|
|
1823
1832
|
* @param dst the destination value
|
1824
1833
|
* @return dst */
|
1825
1834
|
static Value cast_value_numeric(Value src, Type type, Value dst) {
|
1826
|
-
// printf("cast_value_numeric with src=%llx",src->data_int);
|
1835
|
+
// printf("cast_value_numeric with src=%llx\n",src->data_int);
|
1827
1836
|
/* Copy the source to the destination. */
|
1828
1837
|
dst->data_int = src->data_int;
|
1829
1838
|
/* Update the destination type to the cast. */
|
@@ -2665,6 +2674,7 @@ unsigned long long value2integer(Value value) {
|
|
2665
2674
|
char bit;
|
2666
2675
|
/* Access the bitstring data. */
|
2667
2676
|
char* data_str = value->data_str;
|
2677
|
+
// printf("value2integer with data_str=%s\n",data_str);
|
2668
2678
|
/* Copy the bits. */
|
2669
2679
|
for (i=0; i<width && i<LONG_LONG_BIT; ++i) {
|
2670
2680
|
/* Get the bit. */
|
@@ -2676,12 +2686,17 @@ unsigned long long value2integer(Value value) {
|
|
2676
2686
|
/* Write the bit. */
|
2677
2687
|
res = (res << 1) | bit;
|
2678
2688
|
}
|
2689
|
+
// printf("first res=%llx\n",res);
|
2690
|
+
unsigned long long bit0 = (data_str[width-1]-'0') << i;
|
2679
2691
|
/* Perform the sign extension if required. */
|
2680
2692
|
if (i>=width && value->type->flags.sign) {
|
2681
2693
|
for(; i<LONG_LONG_BIT; ++i) {
|
2682
|
-
res = (res << 1) | bit;
|
2694
|
+
// res = (res << 1) | bit;
|
2695
|
+
res |= bit0;
|
2696
|
+
bit0 <<= 1;
|
2683
2697
|
}
|
2684
2698
|
}
|
2699
|
+
// printf("then res=%llx\n",res);
|
2685
2700
|
return res;
|
2686
2701
|
}
|
2687
2702
|
|
data/lib/HDLRuby/std/fixpoint.rb
CHANGED
@@ -52,10 +52,18 @@ module HDLRuby::High::Std
|
|
52
52
|
end
|
53
53
|
# Redefine the multiplication and division for fixed point.
|
54
54
|
typ.define_operator(:*) do |left,right|
|
55
|
-
(
|
55
|
+
if (typ.signed?) then
|
56
|
+
(left.as(signed[isize+fsize*2])*right) >> fsize
|
57
|
+
else
|
58
|
+
(left.as([isize+fsize*2])*right) >> fsize
|
59
|
+
end
|
56
60
|
end
|
57
61
|
typ.define_operator(:/) do |left,right|
|
58
|
-
(
|
62
|
+
if (typ.signed?) then
|
63
|
+
(left.as(signed[isize+fsize*2]) << fsize) / right
|
64
|
+
else
|
65
|
+
(left.as([isize+fsize*2]) << fsize) / right
|
66
|
+
end
|
59
67
|
end
|
60
68
|
typ
|
61
69
|
end
|
data/lib/HDLRuby/std/linear.rb
CHANGED
@@ -209,6 +209,7 @@ module HDLRuby::High::Std
|
|
209
209
|
# lv and rv are valid.
|
210
210
|
lvoks = lefts.each_with_index.map { |left,i| inner :"lvok#{i}" }
|
211
211
|
inner :rvok
|
212
|
+
woks = lefts.each_with_index.map { |left,i| inner :"wok#{i}" }
|
212
213
|
# Run flag
|
213
214
|
inner :run
|
214
215
|
par(ev) do
|
@@ -218,28 +219,39 @@ module HDLRuby::High::Std
|
|
218
219
|
rvok <= 0
|
219
220
|
lefts.each_with_index do |left,i|
|
220
221
|
lvoks[i] <= 0
|
221
|
-
#
|
222
|
-
|
222
|
+
# avs[i] <= 0
|
223
|
+
woks[i] <= 0
|
223
224
|
end
|
224
225
|
end
|
225
226
|
hif(req | run) do
|
226
227
|
run <= 1
|
227
228
|
# Computation request.
|
228
|
-
right.read(rv) { rvok <= 1 }
|
229
|
+
hif(~rvok) { right.read(rv) { rvok <= 1 } }
|
229
230
|
lefts.each_with_index do |left,i|
|
230
|
-
left.read(lvs[i]) { lvoks[i] <= 1 }
|
231
|
+
hif(~lvoks[i]) { left.read(lvs[i]) { lvoks[i] <= 1 } }
|
231
232
|
# accs[i].read(avs[i])
|
232
|
-
hif(lvoks[i] & rvok) do
|
233
|
+
hif(lvoks[i] & rvok & ~woks[i]) do
|
233
234
|
ack <= 1
|
234
235
|
run <= 0
|
235
|
-
# accs[i].write(add.(avs[i],mul.(lvs[i],rv)))
|
236
236
|
seq do
|
237
237
|
avs[i] <= add.(avs[i],mul.(lvs[i],rv))
|
238
|
-
accs[i].write(avs[i])
|
238
|
+
accs[i].write(avs[i]) do
|
239
|
+
woks[i] <= 1
|
240
|
+
# seq do
|
241
|
+
# lvoks[i] <= 0
|
242
|
+
# rvok <= lvoks.reduce(:|)
|
243
|
+
# end
|
244
|
+
end
|
239
245
|
end
|
240
246
|
end
|
247
|
+
hif (woks.reduce(:&)) do
|
248
|
+
woks.each { |wok| wok <= 0 }
|
249
|
+
lvoks.each { | lvok| lvok <=0 }
|
250
|
+
rvok <= 0
|
251
|
+
end
|
241
252
|
end
|
242
253
|
end
|
254
|
+
helse { avs.each {|av| av <= 0 } }
|
243
255
|
# helse do
|
244
256
|
# rvok <= 0
|
245
257
|
# lefts.each_with_index do |left,i|
|
data/lib/HDLRuby/std/memory.rb
CHANGED
@@ -34,6 +34,7 @@ HDLRuby::High::Std.channel(:mem_sync) do |n,typ,size,clk_e,rst,br_rsts = []|
|
|
34
34
|
size = size.to_i
|
35
35
|
# Compute the address bus width from the size.
|
36
36
|
awidth = (size-1).width
|
37
|
+
awidth = 1 if awidth == 0
|
37
38
|
# Ensure clk_e is an event, if not set it to a positive edge.
|
38
39
|
clk_e = clk_e.posedge unless clk_e.is_a?(Event)
|
39
40
|
|
@@ -209,6 +210,7 @@ HDLRuby::High::Std.channel(:mem_rom) do |typ,size,clk,rst,content,
|
|
209
210
|
size = size.to_i
|
210
211
|
# Compute the address bus width from the size.
|
211
212
|
awidth = (size-1).width
|
213
|
+
awidth = 1 if awidth == 0
|
212
214
|
# Process the table of reset mapping for the branches.
|
213
215
|
# Ensures br_srts is a hash.
|
214
216
|
br_rsts = br_rsts.to_hash
|
@@ -292,17 +294,43 @@ HDLRuby::High::Std.channel(:mem_rom) do |typ,size,clk,rst,content,
|
|
292
294
|
trig_r <= 0
|
293
295
|
end
|
294
296
|
# The read procedure.
|
297
|
+
# par do
|
298
|
+
# hif(rst == 0) do
|
299
|
+
# # No reset, so can perform the read.
|
300
|
+
# hif(trig_r == 1) do
|
301
|
+
# # The trigger was previously set, read ok.
|
302
|
+
# target <= dbus_r
|
303
|
+
# blk.call if blk
|
304
|
+
# end
|
305
|
+
# # Prepare the read.
|
306
|
+
# abus_r <= abus_r + 1
|
307
|
+
# trig_r <= 1
|
308
|
+
# end
|
309
|
+
# end
|
310
|
+
# The read procedure.
|
295
311
|
par do
|
296
312
|
hif(rst == 0) do
|
297
313
|
# No reset, so can perform the read.
|
298
314
|
hif(trig_r == 1) do
|
299
315
|
# The trigger was previously set, read ok.
|
300
|
-
target <= dbus_r
|
301
|
-
blk.call if blk
|
316
|
+
# target <= dbus_r
|
317
|
+
# blk.call if blk
|
318
|
+
seq do
|
319
|
+
# abus_r <= abus_r + 1
|
320
|
+
target <= dbus_r
|
321
|
+
blk.call if blk
|
322
|
+
end
|
323
|
+
end
|
324
|
+
helse do
|
325
|
+
# Prepare the read.
|
326
|
+
# abus_r <= abus_r + 1
|
327
|
+
if 2**size.width != size then
|
328
|
+
abus_r <= mux((abus_r + 1) == size, abus_r + 1, 0)
|
329
|
+
else
|
330
|
+
abus_r <= abus_r + 1
|
331
|
+
end
|
332
|
+
trig_r <= 1
|
302
333
|
end
|
303
|
-
# Prepare the read.
|
304
|
-
abus_r <= abus_r + 1
|
305
|
-
trig_r <= 1
|
306
334
|
end
|
307
335
|
end
|
308
336
|
end
|
@@ -331,18 +359,44 @@ HDLRuby::High::Std.channel(:mem_rom) do |typ,size,clk,rst,content,
|
|
331
359
|
# Reset so switch of the access trigger.
|
332
360
|
trig_r <= 0
|
333
361
|
end
|
362
|
+
# # The read procedure.
|
363
|
+
# par do
|
364
|
+
# hif(rst == 0) do
|
365
|
+
# # No reset, so can perform the read.
|
366
|
+
# hif(trig_r == 1) do
|
367
|
+
# # The trigger was previously set, read ok.
|
368
|
+
# target <= dbus_r
|
369
|
+
# blk.call if blk
|
370
|
+
# end
|
371
|
+
# # Prepare the read.
|
372
|
+
# abus_r <= abus_r - 1
|
373
|
+
# trig_r <= 1
|
374
|
+
# end
|
375
|
+
# end
|
334
376
|
# The read procedure.
|
335
377
|
par do
|
336
378
|
hif(rst == 0) do
|
337
379
|
# No reset, so can perform the read.
|
338
380
|
hif(trig_r == 1) do
|
339
381
|
# The trigger was previously set, read ok.
|
340
|
-
target <= dbus_r
|
341
|
-
blk.call if blk
|
382
|
+
# target <= dbus_r
|
383
|
+
# blk.call if blk
|
384
|
+
seq do
|
385
|
+
# abus_r <= abus_r - 1
|
386
|
+
target <= dbus_r
|
387
|
+
blk.call if blk
|
388
|
+
end
|
389
|
+
end
|
390
|
+
helse do
|
391
|
+
# Prepare the read.
|
392
|
+
# abus_r <= abus_r - 1
|
393
|
+
if 2**size.width != size then
|
394
|
+
abus_r <= mux(abus_r == 0, abus_r - 1, size - 1)
|
395
|
+
else
|
396
|
+
abus_r <= abus_r - 1
|
397
|
+
end
|
398
|
+
trig_r <= 1
|
342
399
|
end
|
343
|
-
# Prepare the read.
|
344
|
-
abus_r <= abus_r - 1
|
345
|
-
trig_r <= 1
|
346
400
|
end
|
347
401
|
end
|
348
402
|
end
|
@@ -392,6 +446,7 @@ HDLRuby::High::Std.channel(:mem_dual) do |typ,size,clk,rst,br_rsts = {}|
|
|
392
446
|
size = size.to_i
|
393
447
|
# Compute the address bus width from the size.
|
394
448
|
awidth = (size-1).width
|
449
|
+
awidth = 1 if awidth == 0
|
395
450
|
# Process the table of reset mapping for the branches.
|
396
451
|
# puts "first br_rsts=#{br_rsts}"
|
397
452
|
# if br_rsts.is_a?(Array) then
|
@@ -541,12 +596,24 @@ HDLRuby::High::Std.channel(:mem_dual) do |typ,size,clk,rst,br_rsts = {}|
|
|
541
596
|
# No reset, so can perform the read.
|
542
597
|
hif(trig_r == 1) do
|
543
598
|
# The trigger was previously set, read ok.
|
544
|
-
target <= dbus_r
|
545
|
-
blk.call if blk
|
599
|
+
# target <= dbus_r
|
600
|
+
# blk.call if blk
|
601
|
+
seq do
|
602
|
+
# abus_r <= abus_r + 1
|
603
|
+
target <= dbus_r
|
604
|
+
blk.call if blk
|
605
|
+
end
|
606
|
+
end
|
607
|
+
helse do
|
608
|
+
# Prepare the read.
|
609
|
+
# abus_r <= abus_r + 1
|
610
|
+
if 2**size.width != size then
|
611
|
+
abus_r <= mux((abus_r + 1) == size, abus_r + 1, 0)
|
612
|
+
else
|
613
|
+
abus_r <= abus_r + 1
|
614
|
+
end
|
615
|
+
trig_r <= 1
|
546
616
|
end
|
547
|
-
# Prepare the read.
|
548
|
-
abus_r <= abus_r + 1
|
549
|
-
trig_r <= 1
|
550
617
|
end
|
551
618
|
end
|
552
619
|
end
|
@@ -581,7 +648,12 @@ HDLRuby::High::Std.channel(:mem_dual) do |typ,size,clk,rst,br_rsts = {}|
|
|
581
648
|
# No reset, so can perform the write.
|
582
649
|
blk.call if blk
|
583
650
|
# Prepare the write.
|
584
|
-
abus_w <= abus_w + 1
|
651
|
+
# abus_w <= abus_w + 1
|
652
|
+
if 2**size.width != size then
|
653
|
+
abus_w <= mux((abus_w + 1) == size, abus_w + 1, 0)
|
654
|
+
else
|
655
|
+
abus_w <= abus_w + 1
|
656
|
+
end
|
585
657
|
trig_w <= 1
|
586
658
|
dbus_w <= target
|
587
659
|
end
|
@@ -613,18 +685,44 @@ HDLRuby::High::Std.channel(:mem_dual) do |typ,size,clk,rst,br_rsts = {}|
|
|
613
685
|
# Reset so switch of the access trigger.
|
614
686
|
trig_r <= 0
|
615
687
|
end
|
688
|
+
# # The read procedure.
|
689
|
+
# par do
|
690
|
+
# hif(rst == 0) do
|
691
|
+
# # No reset, so can perform the read.
|
692
|
+
# hif(trig_r == 1) do
|
693
|
+
# # The trigger was previously set, read ok.
|
694
|
+
# target <= dbus_r
|
695
|
+
# blk.call if blk
|
696
|
+
# end
|
697
|
+
# # Prepare the read.
|
698
|
+
# abus_r <= abus_r - 1
|
699
|
+
# trig_r <= 1
|
700
|
+
# end
|
701
|
+
# end
|
616
702
|
# The read procedure.
|
617
703
|
par do
|
618
704
|
hif(rst == 0) do
|
619
705
|
# No reset, so can perform the read.
|
620
706
|
hif(trig_r == 1) do
|
621
707
|
# The trigger was previously set, read ok.
|
622
|
-
target <= dbus_r
|
623
|
-
blk.call if blk
|
708
|
+
# target <= dbus_r
|
709
|
+
# blk.call if blk
|
710
|
+
seq do
|
711
|
+
# abus_r <= abus_r - 1
|
712
|
+
target <= dbus_r
|
713
|
+
blk.call if blk
|
714
|
+
end
|
715
|
+
end
|
716
|
+
helse do
|
717
|
+
# Prepare the read.
|
718
|
+
# abus_r <= abus_r - 1
|
719
|
+
if 2**size.width != size then
|
720
|
+
abus_r <= mux(abus_r == 0, abus_r - 1, size - 1)
|
721
|
+
else
|
722
|
+
abus_r <= abus_r - 1
|
723
|
+
end
|
724
|
+
trig_r <= 1
|
624
725
|
end
|
625
|
-
# Prepare the read.
|
626
|
-
abus_r <= abus_r - 1
|
627
|
-
trig_r <= 1
|
628
726
|
end
|
629
727
|
end
|
630
728
|
end
|
@@ -659,7 +757,12 @@ HDLRuby::High::Std.channel(:mem_dual) do |typ,size,clk,rst,br_rsts = {}|
|
|
659
757
|
# No reset, so can perform the write.
|
660
758
|
blk.call if blk
|
661
759
|
# Prepare the write.
|
662
|
-
abus_w <= abus_w - 1
|
760
|
+
# abus_w <= abus_w - 1
|
761
|
+
if 2**size.width != size then
|
762
|
+
abus_w <= mux(abus_w == 0, abus_w - 1, size - 1)
|
763
|
+
else
|
764
|
+
abus_w <= abus_w - 1
|
765
|
+
end
|
663
766
|
trig_w <= 1
|
664
767
|
dbus_w <= target
|
665
768
|
end
|
@@ -853,7 +956,9 @@ HDLRuby::High::Std.channel(:mem_file) do |typ,size,clk,rst,br_rsts = {}|
|
|
853
956
|
reader_input rst_name
|
854
957
|
end
|
855
958
|
# Declares the address counter.
|
856
|
-
|
959
|
+
awidth = (size-1).width
|
960
|
+
awidth = 1 if awidth == 0
|
961
|
+
[awidth].inner :abus_r
|
857
962
|
reader_inout :abus_r
|
858
963
|
|
859
964
|
# Defines the read procedure at address +addr+
|
@@ -876,7 +981,12 @@ HDLRuby::High::Std.channel(:mem_file) do |typ,size,clk,rst,br_rsts = {}|
|
|
876
981
|
end
|
877
982
|
blk.call if blk
|
878
983
|
# Prepare the next read.
|
879
|
-
abus_r <= abus_r + 1
|
984
|
+
# abus_r <= abus_r + 1
|
985
|
+
if 2**size.width != size then
|
986
|
+
abus_r <= mux((abus_r + 1) == size, abus_r + 1, 0)
|
987
|
+
else
|
988
|
+
abus_r <= abus_r + 1
|
989
|
+
end
|
880
990
|
end
|
881
991
|
end
|
882
992
|
end
|
@@ -892,7 +1002,9 @@ HDLRuby::High::Std.channel(:mem_file) do |typ,size,clk,rst,br_rsts = {}|
|
|
892
1002
|
writer_input rst_name
|
893
1003
|
end
|
894
1004
|
# Declares the address counter.
|
895
|
-
|
1005
|
+
awidth = (size-1).width
|
1006
|
+
awidth = 1 if awidth == 0
|
1007
|
+
[awidth].inner :abus_w
|
896
1008
|
writer_inout :abus_w
|
897
1009
|
|
898
1010
|
# Defines the write procedure at address +addr+
|
@@ -915,7 +1027,12 @@ HDLRuby::High::Std.channel(:mem_file) do |typ,size,clk,rst,br_rsts = {}|
|
|
915
1027
|
end
|
916
1028
|
blk.call if blk
|
917
1029
|
# Prepare the next write.
|
918
|
-
abus_w <= abus_w + 1
|
1030
|
+
# abus_w <= abus_w + 1
|
1031
|
+
if 2**size.width != size then
|
1032
|
+
abus_w <= mux((abus_w + 1) == size, abus_w + 1, 0)
|
1033
|
+
else
|
1034
|
+
abus_w <= abus_w + 1
|
1035
|
+
end
|
919
1036
|
end
|
920
1037
|
end
|
921
1038
|
end
|
@@ -933,7 +1050,9 @@ HDLRuby::High::Std.channel(:mem_file) do |typ,size,clk,rst,br_rsts = {}|
|
|
933
1050
|
reader_input rst_name
|
934
1051
|
end
|
935
1052
|
# Declares the address counter.
|
936
|
-
|
1053
|
+
awidth = (size-1).width
|
1054
|
+
awidth = 1 if awidth == 0
|
1055
|
+
[awidth].inner :abus_r
|
937
1056
|
reader_inout :abus_r
|
938
1057
|
|
939
1058
|
# Defines the read procedure at address +addr+
|
@@ -956,7 +1075,12 @@ HDLRuby::High::Std.channel(:mem_file) do |typ,size,clk,rst,br_rsts = {}|
|
|
956
1075
|
end
|
957
1076
|
blk.call if blk
|
958
1077
|
# Prepare the next read.
|
959
|
-
abus_r <= abus_r - 1
|
1078
|
+
# abus_r <= abus_r - 1
|
1079
|
+
if 2**size.width != size then
|
1080
|
+
abus_r <= mux(abus_r == 0, abus_r - 1, size - 1)
|
1081
|
+
else
|
1082
|
+
abus_r <= abus_r - 1
|
1083
|
+
end
|
960
1084
|
end
|
961
1085
|
end
|
962
1086
|
end
|
@@ -972,7 +1096,9 @@ HDLRuby::High::Std.channel(:mem_file) do |typ,size,clk,rst,br_rsts = {}|
|
|
972
1096
|
reader_input rst_name
|
973
1097
|
end
|
974
1098
|
# Declares the address counter.
|
975
|
-
|
1099
|
+
awidth = (size-1).width
|
1100
|
+
awidth = 1 if awidth == 0
|
1101
|
+
[awidth].inner :abus_w
|
976
1102
|
reader_inout :abus_w
|
977
1103
|
|
978
1104
|
# Defines the write procedure at address +addr+
|
@@ -995,7 +1121,12 @@ HDLRuby::High::Std.channel(:mem_file) do |typ,size,clk,rst,br_rsts = {}|
|
|
995
1121
|
end
|
996
1122
|
blk.call if blk
|
997
1123
|
# Prepare the next write.
|
998
|
-
abus_w <= abus_w - 1
|
1124
|
+
# abus_w <= abus_w - 1
|
1125
|
+
if 2**size.width != size then
|
1126
|
+
abus_w <= mux(abus_w == 0, abus_w - 1, size - 1)
|
1127
|
+
else
|
1128
|
+
abus_w <= abus_w - 1
|
1129
|
+
end
|
999
1130
|
end
|
1000
1131
|
end
|
1001
1132
|
end
|
@@ -1043,7 +1174,9 @@ HDLRuby::High::Std.channel(:mem_bank) do |typ,nbanks,size,clk,rst,br_rsts = {}|
|
|
1043
1174
|
size = size.to_i
|
1044
1175
|
# Compute the address bus width from the size.
|
1045
1176
|
awidth = (size*nbanks-1).width
|
1177
|
+
awidth = 1 if awidth == 0
|
1046
1178
|
awidth_b = (size-1).width # Bank width
|
1179
|
+
awidth_b = 1 if awidth_b == 0
|
1047
1180
|
# Ensures br_srts is a hash.
|
1048
1181
|
br_rsts = br_rsts.to_hash
|
1049
1182
|
|
@@ -1204,7 +1337,12 @@ HDLRuby::High::Std.channel(:mem_bank) do |typ,nbanks,size,clk,rst,br_rsts = {}|
|
|
1204
1337
|
blk.call if blk
|
1205
1338
|
end
|
1206
1339
|
# Prepare the read.
|
1207
|
-
abus_r <= abus_r + 1
|
1340
|
+
# abus_r <= abus_r + 1
|
1341
|
+
if 2**size.width != size then
|
1342
|
+
abus_r <= mux((abus_r + 1) == size, abus_r + 1, 0)
|
1343
|
+
else
|
1344
|
+
abus_r <= abus_r + 1
|
1345
|
+
end
|
1208
1346
|
trig_r <= 1
|
1209
1347
|
end
|
1210
1348
|
end
|
@@ -1240,7 +1378,12 @@ HDLRuby::High::Std.channel(:mem_bank) do |typ,nbanks,size,clk,rst,br_rsts = {}|
|
|
1240
1378
|
# No reset, so can perform the write.
|
1241
1379
|
blk.call if blk
|
1242
1380
|
# Prepare the write.
|
1243
|
-
abus_w <= abus_w + 1
|
1381
|
+
# abus_w <= abus_w + 1
|
1382
|
+
if 2**size.width != size then
|
1383
|
+
abus_w <= mux((abus_w + 1) == size, abus_w + 1, 0)
|
1384
|
+
else
|
1385
|
+
abus_w <= abus_w + 1
|
1386
|
+
end
|
1244
1387
|
trig_w <= 1
|
1245
1388
|
dbus_w <= target
|
1246
1389
|
end
|
@@ -1281,7 +1424,12 @@ HDLRuby::High::Std.channel(:mem_bank) do |typ,nbanks,size,clk,rst,br_rsts = {}|
|
|
1281
1424
|
blk.call if blk
|
1282
1425
|
end
|
1283
1426
|
# Prepare the read.
|
1284
|
-
abus_r <= abus_r - 1
|
1427
|
+
# abus_r <= abus_r - 1
|
1428
|
+
if 2**size.width != size then
|
1429
|
+
abus_r <= mux(abus_r == 0, abus_r - 1, size - 1)
|
1430
|
+
else
|
1431
|
+
abus_r <= abus_r - 1
|
1432
|
+
end
|
1285
1433
|
trig_r <= 1
|
1286
1434
|
end
|
1287
1435
|
end
|
@@ -1318,6 +1466,11 @@ HDLRuby::High::Std.channel(:mem_bank) do |typ,nbanks,size,clk,rst,br_rsts = {}|
|
|
1318
1466
|
blk.call if blk
|
1319
1467
|
# Prepare the write.
|
1320
1468
|
abus_w <= abus_w - 1
|
1469
|
+
if 2**size.width != size then
|
1470
|
+
abus_w <= mux(abus_w == 0, abus_w - 1, size - 1)
|
1471
|
+
else
|
1472
|
+
abus_w <= abus_w - 1
|
1473
|
+
end
|
1321
1474
|
trig_w <= 1
|
1322
1475
|
dbus_w <= target
|
1323
1476
|
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.12
|
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-10-
|
11
|
+
date: 2020-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -84,11 +84,13 @@ files:
|
|
84
84
|
- lib/HDLRuby/hdr_samples/include.rb
|
85
85
|
- lib/HDLRuby/hdr_samples/instance_open.rb
|
86
86
|
- lib/HDLRuby/hdr_samples/linear_test.rb
|
87
|
+
- lib/HDLRuby/hdr_samples/make_multi_channels_vcd.rb
|
87
88
|
- lib/HDLRuby/hdr_samples/mei8.rb
|
88
89
|
- lib/HDLRuby/hdr_samples/mei8_bench.rb
|
89
90
|
- lib/HDLRuby/hdr_samples/memory_test.rb
|
90
91
|
- lib/HDLRuby/hdr_samples/multer_gen.rb
|
91
92
|
- lib/HDLRuby/hdr_samples/multer_seq.rb
|
93
|
+
- lib/HDLRuby/hdr_samples/neg_arith_bench.rb
|
92
94
|
- lib/HDLRuby/hdr_samples/neural/a.rb
|
93
95
|
- lib/HDLRuby/hdr_samples/neural/a_sub.rb
|
94
96
|
- lib/HDLRuby/hdr_samples/neural/bw.rb
|
@@ -124,6 +126,7 @@ files:
|
|
124
126
|
- lib/HDLRuby/hdr_samples/with_linear.rb
|
125
127
|
- lib/HDLRuby/hdr_samples/with_loop.rb
|
126
128
|
- lib/HDLRuby/hdr_samples/with_memory.rb
|
129
|
+
- lib/HDLRuby/hdr_samples/with_memory_rom.rb
|
127
130
|
- lib/HDLRuby/hdr_samples/with_multi_channels.rb
|
128
131
|
- lib/HDLRuby/hdr_samples/with_reconf.rb
|
129
132
|
- lib/HDLRuby/hdrcc.rb
|