Skip to content

Commit f62b76d

Browse files
committed
Merge branch '1.2.3-rc'
2 parents e80245f + 739c4cf commit f62b76d

File tree

6 files changed

+23
-17
lines changed

6 files changed

+23
-17
lines changed

tests/extension/thread_/axi_dma_long_narrow/thread_axi_dma_long_narrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def body(size, offset):
8484
all_ok.value = False
8585

8686
th = vthread.Thread(m, 'th_blink', clk, rst, blink)
87-
fsm = th.start(256 + 256 + 64)
87+
fsm = th.start(256 + 256 + 66 + 1)
8888

8989
return m
9090

tests/extension/thread_/axi_dma_long_wide/thread_axi_dma_long_wide.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def blink(size):
2828
all_ok.value = True
2929

3030
# Test for 4KB boundary check
31-
offset = myaxi.boundary_size - 16
31+
offset = myaxi.boundary_size - memory_datawidth // 8
3232
body(size, offset)
3333

3434
if all_ok:
@@ -84,7 +84,7 @@ def body(size, offset):
8484
all_ok.value = False
8585

8686
th = vthread.Thread(m, 'th_blink', clk, rst, blink)
87-
fsm = th.start(256 + 256 + 64)
87+
fsm = th.start(256 + 256 + 64 + 1)
8888

8989
return m
9090

tests/extension/thread_/axi_dma_narrow/thread_axi_dma_narrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def body(size, offset):
8989
all_ok.value = False
9090

9191
th = vthread.Thread(m, 'th_blink', clk, rst, blink)
92-
fsm = th.start(16)
92+
fsm = th.start(17)
9393

9494
return m
9595

tests/extension/thread_/axi_dma_wide/thread_axi_dma_wide.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def blink(size):
3030
for i in range(4):
3131
print('# iter %d start' % i)
3232
# Test for 4KB boundary check
33-
offset = i * 1024 * 16 + (myaxi.boundary_size - 16)
33+
offset = i * 1024 * 16 + (myaxi.boundary_size - memory_datawidth // 8)
3434
body(size, offset)
3535
print('# iter %d end' % i)
3636

@@ -87,7 +87,7 @@ def body(size, offset):
8787
all_ok.value = False
8888

8989
th = vthread.Thread(m, 'th_blink', clk, rst, blink)
90-
fsm = th.start(16)
90+
fsm = th.start(17)
9191

9292
return m
9393

veriloggen/thread/axi.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -618,9 +618,12 @@ def _synthesize_read_fsm_wide(self, ram, port, ram_method, ram_datawidth):
618618
'axi.datawidth must be multiple number of ram_datawidth')
619619

620620
pack_size = self.datawidth // ram_datawidth
621-
dma_size = (self.read_size >> int(math.log(pack_size, 2))
622-
if math.log(pack_size, 2) % 1.0 == 0.0 else
623-
int(size // pack_size))
621+
shamt = int(math.log(pack_size, 2))
622+
res = vtypes.Mux(
623+
vtypes.And(self.read_size, 2 ** shamt - 1) > 0, 1, 0)
624+
dma_size = (self.read_size >> shamt) + res
625+
626+
actual_read_size = dma_size << shamt
624627

625628
op_id = self._get_read_op_id(ram, port, ram_method)
626629
port = vtypes.to_int(port)
@@ -642,7 +645,7 @@ def _synthesize_read_fsm_wide(self, ram, port, ram_method, ram_datawidth):
642645
fsm.set_index(0)
643646
wdata, wvalid, w = self._get_op_write_dataflow(ram_datawidth)
644647
cond = vtypes.Ands(self.read_start, self.read_op_sel == op_id)
645-
ram_method(port, self.read_local_addr, w, self.read_size,
648+
ram_method(port, self.read_local_addr, w, actual_read_size,
646649
stride=self.read_local_stride, cond=cond)
647650

648651
fsm.If(cond).goto_next()
@@ -694,7 +697,7 @@ def _synthesize_read_fsm_wide(self, ram, port, ram_method, ram_datawidth):
694697
# state 0
695698
wdata, wvalid, w = self._get_op_write_dataflow(ram_datawidth)
696699
cond = vtypes.Ands(self.read_start, self.read_op_sel == op_id)
697-
ram_method(port, self.read_local_addr, w, self.read_size,
700+
ram_method(port, self.read_local_addr, w, actual_read_size,
698701
stride=self.read_local_stride, cond=cond)
699702

700703
fsm.If(self.read_start)(
@@ -1204,9 +1207,12 @@ def _synthesize_write_fsm_wide(self, ram, port, ram_method, ram_datawidth):
12041207
'axi.datawidth must be multiple number of ram_datawidth')
12051208

12061209
pack_size = self.datawidth // ram_datawidth
1207-
dma_size = (self.write_size >> int(math.log(pack_size, 2))
1208-
if math.log(pack_size, 2) % 1.0 == 0.0 else
1209-
int(size // pack_size))
1210+
shamt = int(math.log(pack_size, 2))
1211+
res = vtypes.Mux(
1212+
vtypes.And(self.write_size, 2 ** shamt - 1) > 0, 1, 0)
1213+
dma_size = (self.write_size >> shamt) + res
1214+
1215+
actual_write_size = dma_size << shamt
12101216

12111217
op_id = self._get_write_op_id(ram, port, ram_method)
12121218
port = vtypes.to_int(port)
@@ -1229,7 +1235,7 @@ def _synthesize_write_fsm_wide(self, ram, port, ram_method, ram_datawidth):
12291235
fsm.set_index(0)
12301236
cond = vtypes.Ands(self.write_start, self.write_op_sel == op_id)
12311237
data, last, done = ram_method(
1232-
port, self.write_local_addr, self.write_size,
1238+
port, self.write_local_addr, actual_write_size,
12331239
stride=self.write_local_stride, cond=cond, signed=False)
12341240

12351241
if self.num_data_delay > 0:
@@ -1284,7 +1290,7 @@ def _synthesize_write_fsm_wide(self, ram, port, ram_method, ram_datawidth):
12841290
# state 0
12851291
cond = vtypes.Ands(self.write_start, self.write_op_sel == op_id)
12861292
data, last, done = ram_method(
1287-
port, self.write_local_addr, self.write_size,
1293+
port, self.write_local_addr, actual_write_size,
12881294
stride=self.write_local_stride, cond=cond, signed=False)
12891295

12901296
if self.num_data_delay > 0:

veriloggen/utils/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.2
1+
1.2.3

0 commit comments

Comments
 (0)