Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SoCLabs SHA-2 Accelerator
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
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SoCLabs
SoCLabs SHA-2 Accelerator
Commits
a9452430
Commit
a9452430
authored
2 years ago
by
dam1n19
Browse files
Options
Downloads
Patches
Plain Diff
refactor:
ATO2-24
: restructured code to make it more readable
parent
83d64b0a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hdl/src/primatives/vr_fifo.sv
+9
-9
9 additions, 9 deletions
hdl/src/primatives/vr_fifo.sv
with
9 additions
and
9 deletions
hdl/src/primatives/vr_fifo.sv
+
9
−
9
View file @
a9452430
...
...
@@ -29,12 +29,7 @@ module vr_fifo
output
logic
out_valid
);
logic
[
DATA_W
-
1
:
0
]
fifo
[
DEPTH
-
1
:
0
];
// FIFO Memory Structure
logic
[
PTR_W
-
1
:
0
]
write_ptr
;
// FIFO Write Pointer
logic
[
PTR_W
-
1
:
0
]
read_ptr
;
// FIFO Read Pointer
logic
[
PTR_W
-
1
:
0
]
ptr_dif
;
// Difference between Write and Read Pointers
assign
ptr_dif
=
write_ptr
-
read_ptr
;
assign
out_data
=
fifo
[
read_ptr
[
PTR_W
-
2
:
0
]];
// Output Data is dereferenced value of the Read Pointer
logic
in_shake
;
// Successful Write Handshake
logic
out_shake
;
// Successful Read Handshake
...
...
@@ -42,7 +37,14 @@ module vr_fifo
assign
in_shake
=
(
in_valid
==
1'b1
)
&&
(
in_ready
==
1'b1
);
assign
out_shake
=
(
out_valid
==
1'b1
)
&&
(
out_ready
==
1'b1
);
// Conditions to write and read from FIFO's
logic
[
DATA_W
-
1
:
0
]
fifo
[
DEPTH
-
1
:
0
];
// FIFO Memory Structure
logic
[
PTR_W
-
1
:
0
]
write_ptr
;
// FIFO Write Pointer
logic
[
PTR_W
-
1
:
0
]
read_ptr
;
// FIFO Read Pointer
logic
[
PTR_W
-
1
:
0
]
ptr_dif
;
// Difference between Write and Read Pointers
assign
ptr_dif
=
write_ptr
-
read_ptr
;
// EXAMPLE: Conditions to write and read from FIFO's
// Write Ptr | Read Ptr | Ptr_Dif | Valid Write | Valid Read
// 000 - 000 = 000 | Y | N
// 001 - 000 = 001 | Y | Y
...
...
@@ -55,8 +57,6 @@ module vr_fifo
// WriteValid: WritePtr - ReadPtr < 3'd4
// ReadValid: WritePtr - ReadPtr - 1 < 3'd4
assign
out_data
=
fifo
[
read_ptr
[
PTR_W
-
2
:
0
]];
// Out Data is dereferenced value of the Read Pointer
always_ff
@
(
posedge
clk
,
negedge
nrst
)
begin
if
(
!
nrst
)
begin
// Under Reset
...
...
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