Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
MasterFIP - Gateware
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
MasterFIP - Gateware
Commits
19792d9e
Commit
19792d9e
authored
Mar 30, 2023
by
kblantos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changing the header data that we write to RMQ
parent
aee3f6af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
12 deletions
+107
-12
main.sv
testbench/top_mt/main.sv
+107
-12
No files found.
testbench/top_mt/main.sv
View file @
19792d9e
...
@@ -238,15 +238,15 @@ module main;
...
@@ -238,15 +238,15 @@ module main;
int
idx
=
0
;
int
idx
=
0
;
int
k
=
0
;
int
k
=
0
;
//
// Write SPI mosi data task. Used to generate MOSI data
// Write SPI mosi data task. Used to generate MOSI data
//
task write_spi(input logic [31:0] mosi_spi_data, input int data_length);
task
write_spi
(
input
logic
[
31
:
0
]
mosi_spi_data
,
input
int
data_length
)
;
//
int i;
int
i
;
//
for (i=data_length;i>0;i--)
for
(
i
=
data_length
;
i
>
0
;
i
--
)
//
begin
begin
//
@(posedge spi_clk);
@
(
posedge
spi_clk
)
;
//
spi_mosi = mosi_spi_data[i-1];
spi_mosi
=
mosi_spi_data
[
i
-
1
]
;
//
end
end
//
endtask
endtask
// Generate the frame that will be written in the RMQ
// Generate the frame that will be written in the RMQ
task
write_to_rmq
()
;
task
write_to_rmq
()
;
...
@@ -265,12 +265,52 @@ module main;
...
@@ -265,12 +265,52 @@ module main;
for
(
j
=
3
+
data_len
;
j
>
0
;
j
--
)
for
(
j
=
3
+
data_len
;
j
>
0
;
j
--
)
begin
begin
mosi_data
=
$
urandom_range
(
1
,
2048
)
;
mosi_data
=
$
urandom_range
(
1
,
2048
)
;
write_spi
(
spi_clk
,
mosi_data
,
32
,
spi_mosi
)
;
write_spi
(
mosi_data
,
32
)
;
end
end
@
(
posedge
spi_clk
)
;
//KB: added in order to catch it in the queue
@
(
posedge
spi_clk
)
;
//KB: added in order to catch it in the queue
spi_mosi
=
'b0
;
spi_mosi
=
'b0
;
endtask
// write_to_rmq
endtask
// write_to_rmq
// Generate the frame that will be written in a specific RMQ
task
write_to_specific_rmq
()
;
logic
[
31
:
0
]
header_data
;
logic
[
15
:
0
]
rt_app_id
,
len
,
sync_id
;
logic
[
7
:
0
]
flags
,
msg_id
;
logic
[
31
:
0
]
seq
;
operation
=
8'h00
;
wr_rmq_id
=
$
urandom_range
(
0
,
6
)
;
data_len
=
$
urandom_range
(
1
,
16
)
;
basic_info
=
{
operation
,
wr_rmq_id
,
data_len
,
8'h00
};
// < wr/rd | rmq_id | len | unused >
rd_rmq_id
.
push_back
(
wr_rmq_id
)
;
q_data_len
.
push_back
(
data_len
)
;
// First send the Basic Info
write_spi
(
basic_info
,
32
)
;
// First we send the 3 header data
rt_app_id
=
16'hA
;
len
sync_id
header_data
=
{
rt_app_id
,
8'h8
,
8'h9
};
write_spi
(
header_data
,
32
)
;
header_data
=
{
8'h0
,
data_len
,
16'h12
};
write_spi
(
header_data
,
32
)
;
header_data
=
32'hAABBCCDD
;
write_spi
(
header_data
,
32
)
;
// Then send the 3 header words and payload
for
(
int
j
=
data_len
;
j
>
0
;
j
--
)
//it was j=3+data_len
begin
mosi_data
=
$
urandom_range
(
1
,
2048
)
;
write_spi
(
mosi_data
,
32
)
;
end
@
(
posedge
spi_clk
)
;
//KB: added in order to catch it in the queue
spi_mosi
=
'b0
;
endtask
// write_to_specific_rmq
task
write_shorter_to_rmq
()
;
task
write_shorter_to_rmq
()
;
int
j
;
int
j
;
operation
=
8'h00
;
operation
=
8'h00
;
...
@@ -502,7 +542,7 @@ module main;
...
@@ -502,7 +542,7 @@ module main;
end
end
*/
*/
/*
$display("************ 4x Write and 4x Read ************");
$display("************ 4x Write and 4x Read ************");
$display("************ TEST CASE 2 ************\n");
$display("************ TEST CASE 2 ************\n");
...
@@ -529,7 +569,7 @@ module main;
...
@@ -529,7 +569,7 @@ module main;
q_miso_data.delete();
q_miso_data.delete();
#100us;
#100us;
end
end
*/
/*
/*
$display("************ Write to all and Read all ************");
$display("************ Write to all and Read all ************");
$display("************ TEST CASE 3 ************\n");
$display("************ TEST CASE 3 ************\n");
...
@@ -643,6 +683,61 @@ module main;
...
@@ -643,6 +683,61 @@ module main;
// assert (q_mosi_data == q_miso_data)
// assert (q_mosi_data == q_miso_data)
// else $error("Mismatch between two queues, MOSI %p and MISO %p", q_mosi_data, q_miso_data);
// else $error("Mismatch between two queues, MOSI %p and MISO %p", q_mosi_data, q_miso_data);
$
display
(
"************ RMQ 0 ************"
)
;
$
display
(
"************ 3x Write and 4x Read ************"
)
;
$
display
(
"************ 2x Write and 3x Read ************"
)
;
$
display
(
"************ TEST CASE 5 ************
\n
"
)
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
begin
$
display
(
"**** Start writing the %d frame ****
\n
"
,
i
+
1
)
;
spi_cs_n
=
'b0
;
write_to_specific_rmq
()
;
spi_cs_n
=
'b1
;
#
500u
s
;
$
displayh
(
"FRAME WRITTEN IN RMQ (%d) : %p
\n
"
,
DUT
.
cmp_mt_profip_translator
.
s_rmq_id
,
q_mosi_data
)
;
q_mosi_data
.
delete
()
;
end
for
(
int
i
=
0
;
i
<
4
;
i
++
)
begin
$
display
(
"q_data_len = %p"
,
q_data_len
)
;
$
display
(
"**** Start reading the %d frame ****
\n
"
,
i
+
1
)
;
idx
=
rd_rmq_id
[
i
]
;
spi_cs_n
=
'b0
;
read_from_rmq
(
idx
)
;
spi_cs_n
=
'b1
;
$
displayh
(
"FRAME READ FROM RMQ (%d) : %p"
,
idx
,
q_miso_data
)
;
q_miso_data
.
delete
()
;
#
100u
s
;
end
for
(
int
i
=
0
;
i
<
2
;
i
++
)
begin
$
display
(
"**** Start writing the %d frame ****
\n
"
,
i
+
1
)
;
spi_cs_n
=
'b0
;
write_to_specific_rmq
()
;
spi_cs_n
=
'b1
;
#
500u
s
;
$
displayh
(
"FRAME WRITTEN IN RMQ (%d) : %p
\n
"
,
DUT
.
cmp_mt_profip_translator
.
s_rmq_id
,
q_mosi_data
)
;
q_mosi_data
.
delete
()
;
end
for
(
int
i
=
0
;
i
<
3
;
i
++
)
begin
$
display
(
"q_data_len = %p"
,
q_data_len
)
;
$
display
(
"**** Start reading the %d frame ****
\n
"
,
i
+
1
)
;
idx
=
rd_rmq_id
[
i
]
;
spi_cs_n
=
'b0
;
read_from_rmq
(
idx
)
;
spi_cs_n
=
'b1
;
$
displayh
(
"FRAME READ FROM RMQ (%d) : %p"
,
idx
,
q_miso_data
)
;
q_miso_data
.
delete
()
;
#
100u
s
;
end
q_mosi_data
.
delete
()
;
q_mosi_data
.
delete
()
;
q_miso_data
.
delete
()
;
q_miso_data
.
delete
()
;
q_mosi_payload
.
delete
()
;
q_mosi_payload
.
delete
()
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment