Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Accelerator Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SoCLabs
Accelerator Project
Commits
b5699e1c
Commit
b5699e1c
authored
2 years ago
by
dam1n19
Browse files
Options
Downloads
Patches
Plain Diff
ATO2-24
: Added Gapping to message build testbench
parent
1fa6fdc6
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
hdl/verif/tb_sha256_message_build.sv
+35
-5
35 additions, 5 deletions
hdl/verif/tb_sha256_message_build.sv
model/py/hash_model.py
+21
-5
21 additions, 5 deletions
model/py/hash_model.py
with
56 additions
and
10 deletions
hdl/verif/tb_sha256_message_build.sv
+
35
−
5
View file @
b5699e1c
...
...
@@ -81,15 +81,27 @@ module tb_sha256_message_build;
data_in
<=
512'd0
;
data_in_valid
<=
1'b0
;
data_in_last
<=
1'b0
;
data_in_gap
<=
0
;
data_in_wait_queue
<=
1'b1
;
end
else
if
(
data_in_drive_en
)
begin
if
(
data_in_gap
>
0
)
begin
data_in_gap
<=
data_in_gap
-
1
;
data_in_valid
<=
1'b0
;
end
else
begin
data_in_valid
<=
1'b1
;
end
if
(((
data_in_valid
==
1'b1
)
&&
(
data_in_ready
==
1'b1
))
||
(
data_in_wait_queue
==
1'b1
))
begin
// Data transfer just completed or transfers already up to date
if
((
data_in_queue
.
size
()
>
0
)
&&
(
data_in_last_queue
.
size
()
>
0
))
begin
if
((
data_in_queue
.
size
()
>
0
)
&&
(
data_in_last_queue
.
size
()
>
0
)
&&
(
data_in_gap_queue
.
size
()
>
0
))
begin
data_in
<=
data_in_queue
.
pop_front
();
data_in_last
<=
data_in_last_queue
.
pop_front
();
if
(
data_in_gap_queue
[
0
]
==
0
)
begin
data_in_valid
<=
1'b1
;
end
else
begin
data_in_valid
<=
1'b0
;
end
data_in_gap
<=
data_in_gap_queue
.
pop_front
();
data_in_wait_queue
<=
1'b0
;
end
else
begin
// No data currently avaiable in queue to write but transfers up to date
...
...
@@ -107,16 +119,28 @@ module tb_sha256_message_build;
cfg_scheme
<=
2'd0
;
cfg_valid
<=
1'b0
;
cfg_last
<=
1'b0
;
cfg_gap
<=
0
;
cfg_wait_queue
<=
1'b1
;
end
else
if
(
cfg_drive_en
)
begin
if
(
cfg_gap
>
0
)
begin
cfg_gap
<=
cfg_gap
-
1
;
cfg_valid
<=
1'b0
;
end
else
begin
cfg_valid
<=
1'b1
;
end
if
(((
cfg_valid
==
1'b1
)
&&
(
cfg_ready
==
1'b1
))
||
(
cfg_wait_queue
==
1'b1
))
begin
// cfg transfer just completed or transfers already up to date
if
((
cfg_size_queue
.
size
()
>
0
)
&&
(
cfg_scheme_queue
.
size
()
>
0
)
&&
(
cfg_last_queue
.
size
()
>
0
))
begin
if
((
cfg_size_queue
.
size
()
>
0
)
&&
(
cfg_scheme_queue
.
size
()
>
0
)
&&
(
cfg_last_queue
.
size
()
>
0
)
&&
(
cfg_gap_queue
.
size
()
>
0
))
begin
cfg_size
<=
cfg_size_queue
.
pop_front
();
cfg_scheme
<=
cfg_scheme_queue
.
pop_front
();
cfg_last
<=
cfg_last_queue
.
pop_front
();
if
(
cfg_gap_queue
[
0
]
==
0
)
begin
cfg_valid
<=
1'b1
;
end
else
begin
cfg_valid
<=
1'b0
;
end
cfg_gap
<=
cfg_gap_queue
.
pop_front
();
cfg_wait_queue
<=
1'b0
;
end
else
begin
// No data currently avaiable in queue to write but transfers up to date
...
...
@@ -129,6 +153,8 @@ module tb_sha256_message_build;
logic
[
511
:
0
]
data_out_check
;
logic
data_out_last_check
;
int
data_in_gap
;
int
cfg_gap
;
int
data_out_stall
;
int
packet_num
;
...
...
@@ -145,9 +171,13 @@ module tb_sha256_message_build;
// Wait for handshake before updating stall value
if
((
data_out_valid
==
1'b1
)
&&
(
data_out_ready
==
1'b1
))
begin
if
(
data_out_stall_queue
.
size
()
>
0
)
begin
if
(
data_out_stall_queue
[
0
]
==
0
)
begin
data_out_ready
<=
1'b1
;
end
else
begin
data_out_ready
<=
1'b0
;
end
data_out_stall
<=
data_out_stall_queue
.
pop_front
();
end
data_out_ready
<=
1'b0
;
// Keep Ready Asserted until handshake seen
end
else
begin
data_out_ready
<=
1'b1
;
...
...
This diff is collapsed.
Click to expand it.
model/py/hash_model.py
+
21
−
5
View file @
b5699e1c
...
...
@@ -48,8 +48,15 @@ def main():
# Generate Gapping and Stalling Values
# Gapping - Period to wait before taking Input Valid High
# Stalling - Period to wait before taking Output Read High
if
gap_limit
>
0
:
cfg_words_gap_list
.
append
(
random
.
randrange
(
0
,
gap_limit
))
else
:
cfg_words_gap_list
.
append
(
0
)
if
stall_limit
>
0
:
hash_stall_list
.
append
(
random
.
randrange
(
0
,
stall_limit
))
else
:
hash_stall_list
.
append
(
0
)
# Generate expected output in 512 bit chunks
cfg_size
=
math
.
ceil
(
random
.
randint
(
0
,
pow
(
2
,
14
))
/
8
)
*
8
...
...
@@ -87,13 +94,22 @@ def main():
for
i
in
range
(
len
(
in_data_words
)):
in_data_words_last
.
append
(
"
0
"
)
if
gap_limit
>
0
:
in_data_words_gap
.
append
(
random
.
randrange
(
0
,
gap_limit
))
else
:
in_data_words_gap
.
append
(
0
)
in_data_words_last
[
-
1
]
=
"
1
"
for
i
in
range
(
len
(
message_block
)):
message_block_last
.
append
(
"
0
"
)
if
stall_limit
>
0
:
message_block_stall
.
append
(
random
.
randrange
(
0
,
stall_limit
))
else
:
message_block_stall
.
append
(
0
)
if
gap_limit
>
0
:
message_block_gap
.
append
(
random
.
randrange
(
0
,
gap_limit
))
else
:
message_block_gap
.
append
(
0
)
message_block_last
[
-
1
]
=
"
1
"
cfg_words_list
.
append
(
cfg_size_str
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment