Skip to content

Commit f550668

Browse files
committed
2023 clean-up and update
1 parent 0b4f3e8 commit f550668

36 files changed

+99616
-350
lines changed

Diff for: .github/workflows/ci.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Async_FIFO
2+
on: [push]
3+
jobs:
4+
Lint:
5+
runs-on: macos-latest
6+
steps:
7+
- uses: actions/checkout@v2
8+
- run: brew install verilator
9+
- run: ./flow.sh lint
10+
Simulation:
11+
runs-on: macos-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- run: brew install verilator
15+
- run: brew install icarus-verilog
16+
- run: ./flow.sh sim
17+
Synthesis:
18+
runs-on: macos-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- run: brew install yosys
22+
- run: ./flow.sh syn

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
*.lxt
44
.DS_Store
55
tags
6+
lint.log script src
7+
async_fifo_syn.v
8+
lint.log

Diff for: README.md

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Asynchronous dual clock FIFO
22

3+
![CI](https://github.com/dpretet/async_fifo/actions/workflows/ci.yaml/badge.svg?branch=master)
34
[![GitHub issues](https://img.shields.io/github/issues/dpretet/async_fifo)](https://github.com/dpretet/async_fifo/issues)
45
[![GitHub forks](https://img.shields.io/github/forks/dpretet/async_fifo)](https://github.com/dpretet/async_fifo/network)
56
[![GitHub stars](https://img.shields.io/github/stars/dpretet/async_fifo)](https://github.com/dpretet/async_fifo/stargazers)
@@ -18,10 +19,24 @@ Design](http://www.sunburst-design.com/papers/CummingsSNUG2002SJ_FIFO1.pdf).
1819

1920
The simulation testcases available use [Icarus Verilog](http://iverilog.icarus.com) and [SVUT](https://github.com/dpretet/svut) tool to run the tests.
2021

21-
# Documentation
22+
The FIFO is fully functional and used in many successful project
23+
24+
# Usage
25+
26+
RTL sources are present in RTL folder under three flavors:
27+
- `rtl/async_fifo.v`: a basic asynchronous dual-clock FIFO
28+
- `rtl/async_bidir_fifo.v`: two instance of the first one into a single top level for full-duplex channel
29+
- `rtl/async_bidir_ramif_fifo.v`: same than previous but with external RAM
30+
31+
The three FIFOs have a list file to get the associated fileset.
32+
33+
The testbench in `sim/` provides an example about the instance and the configuration.
34+
35+
All three top levels have the same parameters:
36+
- `DSIZE`: the size in bits of the datapath
37+
- `ASIZE`: the size in bits of the internal RAM address bus. This implies the FIFO can be configured only with power of 2 depth
38+
- `FALLTHROUGH`: allow to reduce the inner latency and propagate faster the data through the FIFO
2239

23-
* [specification](doc/specification.rst)
24-
* [testplan](doc/testplan.rst)
2540

2641
# License
2742

Diff for: async_fifo.core

-3
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ name : ::async_fifo:1.1.0-r1
55
filesets:
66
rtl:
77
files:
8-
- src/vlog/fifomem_dp.v
98
- src/vlog/sync_r2w.v
10-
- src/vlog/async_bidir_fifo.v
119
- src/vlog/rptr_empty.v
1210
- src/vlog/sync_w2r.v
1311
- src/vlog/wptr_full.v
1412
- src/vlog/fifo_2mem.v
15-
- src/vlog/async_bidir_ramif_fifo.v
1613
- src/vlog/async_fifo.v
1714
- src/vlog/sync_ptr.v
1815
file_type : verilogSource

Diff for: doc/architecture.rst

Whitespace-only changes.

Diff for: doc/release.rst

Whitespace-only changes.

Diff for: doc/testplan.rst

+13-18
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,34 @@ A first focus is put in write vs read frequency relation:
1313
1. Test the same clock frequency on both sides. Phases can be equal or not.
1414

1515
2. Test slower clock on write side
16-
17-
* clock can be close to read frequency, but slower
18-
* clock can be very regarding read frequency
16+
- clock can be close to read frequency, but slower
17+
- clock can be very regarding read frequency
1918

2019
3. Test higher clock on write side
21-
22-
* clock can be close to read frequency, but higher
23-
* clock can be very high regarding read frequency
20+
- clock can be close to read frequency, but higher
21+
- clock can be very high regarding read frequency
2422

2523
Read/Write enable control assertion
2624
-----------------------------------
2725

2826
A second focus is put on read/write enable assertion:
2927

3028
1. Read enable is always enable, unless empty = 1
31-
32-
* Write enable is always asserted, data are not corrupted
33-
* Write enable can be occasionaly asserted, data are not corrupted
29+
- Write enable is always asserted, data are not corrupted
30+
- Write enable can be occasionaly asserted, data are not corrupted
3431

3532
2. Write enable is always enable, unless full = 1
36-
37-
* Read enable is always asserted, data are not corrupted
38-
* Read enable can be occasionaly asserted, data are not corrupted
33+
- Read enable is always asserted, data are not corrupted
34+
- Read enable can be occasionaly asserted, data are not corrupted
3935

4036
3. Read and Write enable can be occasionaly asserted
41-
42-
* Assertion frequency (either read or write) is periodic (1/2, 1/3, 1/2, ...)
43-
* Assertion frequecy is (pseudo) random
37+
- Assertion frequency (either read or write) is periodic (1/2, 1/3, 1/2, ...)
38+
- Assertion frequecy is (pseudo) random
4439

4540
Test coverage
4641
-------------
4742

48-
To ensure a wide feature feature coverage is performed, both clock frequency scale and
49-
read/write enable assertions have to be tested together. Big range over higher frequency
50-
scale factor doesn't have to considered. Only few conbinations can be tested for
43+
To ensure a wide feature feature coverage is performed, both clock frequency scale and
44+
read/write enable assertions have to be tested together. Big range over higher frequency
45+
scale factor doesn't have to considered. Only few combinations can be tested for
5146
good confidence on the IP behavior.

Diff for: flow.sh

+167
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
#!/usr/bin/env bash
2+
3+
# -e: exit if one command fails
4+
# -u: treat unset variable as an error
5+
# -f: disable filename expansion upon seeing *, ?, ...
6+
# -o pipefail: causes a pipeline to fail if any command fails
7+
set -e -o pipefail
8+
9+
# Current script path; doesn't support symlink
10+
FIFO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
11+
12+
13+
# Bash color codes
14+
Red='\033[0;31m'
15+
Green='\033[0;32m'
16+
Yellow='\033[0;33m'
17+
Blue='\033[0;34m'
18+
# Reset
19+
NC='\033[0m'
20+
21+
function printerror {
22+
echo -e "${Red}ERROR: ${1}${NC}"
23+
}
24+
25+
function printwarning {
26+
echo -e "${Yellow}WARNING: ${1}${NC}"
27+
}
28+
29+
function printinfo {
30+
echo -e "${Blue}INFO: ${1}${NC}"
31+
}
32+
33+
function printsuccess {
34+
echo -e "${Green}SUCCESS: ${1}${NC}"
35+
}
36+
37+
help() {
38+
echo -e "${Blue}"
39+
echo ""
40+
echo "NAME"
41+
echo ""
42+
echo " Async FIFO Flow"
43+
echo ""
44+
echo "SYNOPSIS"
45+
echo ""
46+
echo " ./flow.sh -h"
47+
echo ""
48+
echo " ./flow.sh help"
49+
echo ""
50+
echo " ./flow.sh syn"
51+
echo ""
52+
echo " ./flow.sh sim"
53+
echo ""
54+
echo "DESCRIPTION"
55+
echo ""
56+
echo " This flow handles the different operations available"
57+
echo ""
58+
echo " ./flow.sh help|-h"
59+
echo ""
60+
echo " Print the help menu"
61+
echo ""
62+
echo " ./flow.sh syn"
63+
echo ""
64+
echo " Launch the synthesis script relying on Yosys"
65+
echo ""
66+
echo " ./flow.sh sim"
67+
echo -e "${NC}"
68+
}
69+
70+
71+
run_sims() {
72+
printinfo "Start simulation"
73+
cd "$FIFO_DIR"/sim
74+
svutRun -f files.f -test async_fifo_unit_test.sv -sim icarus
75+
return $?
76+
}
77+
78+
run_syn() {
79+
printinfo "Start synthesis"
80+
cd "$FIFO_DIR/syn"
81+
./syn_asic.sh
82+
return $?
83+
}
84+
85+
86+
run_lint() {
87+
set +e
88+
89+
printinfo "Start lint"
90+
verilator --lint-only +1800-2017ext+sv \
91+
-Wall -Wpedantic \
92+
-Wno-VARHIDDEN \
93+
-Wno-PINCONNECTEMPTY \
94+
-Wno-PINMISSING \
95+
./rtl/async_fifo.v \
96+
./rtl/fifomem.v \
97+
./rtl/rptr_empty.v \
98+
./rtl/sync_r2w.v \
99+
./rtl/sync_w2r.v \
100+
./rtl/wptr_full.v \
101+
--top-module async_fifo 2> lint.log
102+
103+
set -e
104+
105+
ec=$(grep -c "%Error:" lint.log)
106+
107+
if [[ $ec -gt 1 ]]; then
108+
printerror "Lint failed, check ./lint.log for further details"
109+
return 1
110+
else
111+
printsuccess "Lint ran successfully"
112+
return 0
113+
fi
114+
115+
}
116+
117+
check_setup() {
118+
119+
source script/setup.sh
120+
121+
if [[ ! $(type iverilog) ]]; then
122+
printerror "Icarus-Verilog is not installed"
123+
exit 1
124+
fi
125+
if [[ ! $(type verilator) ]]; then
126+
printerror "Verilator is not installed"
127+
exit 1
128+
fi
129+
}
130+
131+
132+
main() {
133+
134+
echo ""
135+
printinfo "Start Aync FIFO Flow"
136+
137+
# If no argument provided, preint help and exit
138+
if [[ $# -eq 0 ]]; then
139+
help
140+
exit 1
141+
fi
142+
143+
# Print help
144+
if [[ $1 == "-h" || $1 == "help" ]]; then
145+
help
146+
exit 0
147+
fi
148+
149+
if [[ $1 == "lint" ]]; then
150+
run_lint
151+
exit $?
152+
fi
153+
154+
if [[ $1 == "sim" ]]; then
155+
check_setup
156+
run_sims
157+
exit $?
158+
fi
159+
160+
if [[ $1 == "syn" ]]; then
161+
run_syn
162+
return $?
163+
fi
164+
}
165+
166+
167+
main "$@"

Diff for: rtl/async_bidir_fifo.list

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
async_bidir_fifo.v
2+
fifomem.v
3+
fifomem_dp.v
4+
rptr_empty.v
5+
sync_ptr.v
6+
sync_r2w.v
7+
sync_w2r.v
8+
wptr_full.v
File renamed without changes.

Diff for: rtl/async_bidir_ramif_fifo.list

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
async_bidir_ramif_fifo.v
2+
fifomem.v
3+
fifomem_dp.v
4+
rptr_empty.v
5+
sync_ptr.v
6+
sync_r2w.v
7+
sync_w2r.v
8+
wptr_full.v
File renamed without changes.

Diff for: rtl/async_fifo.list

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
async_fifo.v
2+
fifomem.v
3+
fifomem_dp.v
4+
hdl.list
5+
rptr_empty.v
6+
sync_ptr.v
7+
sync_r2w.v
8+
sync_w2r.v
9+
wptr_full.v

0 commit comments

Comments
 (0)