Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

PacketStream protocol, converters, UART stuff and async FIFO #51

Closed
wants to merge 152 commits into from
Closed
Show file tree
Hide file tree
Changes from 151 commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
a312860
Added a first nix environment to test working with nix-shell
Baublesaurus Feb 23, 2024
227a8b9
This should use the shell.nix from the repo
Baublesaurus Feb 23, 2024
58bb379
Added caching of the nix environment, otherwise nix has to be re-inst…
Baublesaurus Feb 23, 2024
45f1899
Run tests during CI, uses the make test command
Baublesaurus Feb 23, 2024
fe441a8
added a name to a step
Baublesaurus Feb 23, 2024
dbab722
removed step to find error
Baublesaurus Feb 23, 2024
b1f76db
added build and test
Baublesaurus Feb 23, 2024
1c6d0d8
spelling error
Baublesaurus Feb 23, 2024
7e4e594
added git checkout
Baublesaurus Feb 23, 2024
92043ec
removed cache action
Baublesaurus Feb 23, 2024
f6b1dbc
last working version
Baublesaurus Feb 23, 2024
13512f8
adds caching
Baublesaurus Feb 23, 2024
558d34a
added default.nix file to enable nix-build
Baublesaurus Feb 23, 2024
38ca212
add nix build to the pipeline
Baublesaurus Feb 23, 2024
8ea3637
add caching again
Baublesaurus Feb 23, 2024
8552666
remove caching for now, to see if speed is OK
Baublesaurus Feb 23, 2024
dc3cdcf
magic nix cache is needed for speedy tests
Baublesaurus Feb 23, 2024
8551684
Added names, and make verilog
Baublesaurus Feb 23, 2024
c7b6ff2
Indentation fix
Baublesaurus Feb 23, 2024
0549e4d
More names for clarity of process
Baublesaurus Feb 23, 2024
4eaf630
Add make netlist
Baublesaurus Feb 23, 2024
77d3da9
Added test for illegal whitspace file endings
Baublesaurus Feb 23, 2024
b65bb96
Missing keyword
Baublesaurus Feb 23, 2024
ead6b9f
added run permissions to the .sh file
Baublesaurus Feb 23, 2024
2d21be4
update checkout versions
Baublesaurus Feb 23, 2024
4e8b72d
Adds make pnr, fixes file endings
Baublesaurus Feb 23, 2024
4a6afef
add run permissions for the bash files
Baublesaurus Feb 23, 2024
1ac53f5
fixed the end of file :(
Baublesaurus Feb 23, 2024
42652cc
Merge pull request #10 from GiPHouse/2-setup-ci
rowanG077 Feb 28, 2024
8c9e340
Add hoogle and int commands to Makefile
JasmijnB Feb 23, 2024
be6a4b0
create initial stream protocol
JasmijnB Feb 23, 2024
914d157
proper cabal configuration
JasmijnB Feb 23, 2024
6b701b5
renamed the Stream types to PacketStream
JasmijnB Feb 23, 2024
3717fcd
started on Simulate instance
JasmijnB Feb 23, 2024
2f4f730
finalised Packetstream
JasmijnB Feb 23, 2024
0efc206
fix hashable error
JasmijnB Feb 23, 2024
55071d2
Change _byte_enable to _last of type Index
JasmijnB Feb 28, 2024
5af9bfb
added documentation / style changes
Feb 23, 2024
cb82296
added stylish haskell check
Baublesaurus Mar 1, 2024
047a947
syntax error
Baublesaurus Mar 1, 2024
d412407
ran make format
Baublesaurus Mar 1, 2024
4f5ca97
Reorder tests for quicker testing
Baublesaurus Mar 1, 2024
7f8b4af
Merge branch 'develop' into 2-setup-ci
Baublesaurus Mar 1, 2024
cd28ad1
Merge pull request #16 from GiPHouse/2-setup-ci
rowanG077 Mar 1, 2024
3a094e9
Add test with example
rowanG077 Feb 28, 2024
c4d4b25
Add test together with team
rowanG077 Mar 1, 2024
7680e47
Merge branch 'develop' into 5-define-a-streaming-protocol
JasmijnB Mar 1, 2024
4c4182c
Added product backlog with color coding and full work breakdown struc…
rowanG077 Mar 1, 2024
ae35fad
Fixup XSGMII color
rowanG077 Mar 1, 2024
eae86eb
Merge pull request #12 from GiPHouse/5-define-a-streaming-protocol
rowanG077 Mar 3, 2024
20a622e
diagrams: Update product backlog with current issues in sprint
rowanG077 Mar 5, 2024
5f6950a
diagrams: update uart-eth to reflect our PacketStream protocol
rowanG077 Mar 5, 2024
3cba298
diagram: Update layer1+2 diagram with PacketStream protocol
rowanG077 Mar 5, 2024
fc1380c
diagrams: regenerate
rowanG077 Mar 5, 2024
44e030c
diagrams: Make github project issue names and task names in product-b…
rowanG077 Mar 5, 2024
43bd495
patch doctest
MatthijsMu Mar 7, 2024
7510256
Remove doctest.patch
MatthijsMu Mar 7, 2024
02d0284
initial version
t-wallet Mar 8, 2024
351becc
component now handles backpressure and changed definition to return a…
t-wallet Mar 8, 2024
49859cf
stylish haskell
t-wallet Mar 8, 2024
33ec7ae
added noBaudGen version of the component
t-wallet Mar 8, 2024
9e6c5b0
delete doctest for Eq instance
MatthijsMu Mar 8, 2024
d3143c9
Merge pull request #40 from GiPHouse/fix-doctest
MatthijsMu Mar 8, 2024
ae8c99a
Disable expensive CI for now
rowanG077 Mar 8, 2024
8a18559
defined uartTxC in terms of uartTxNoBaudGenC + style changes
t-wallet Mar 9, 2024
dcb49bb
initial version
t-wallet Mar 9, 2024
552ffb3
Merge pull request #41 from GiPHouse/3-wrap-existing-clashcores-uart-…
rowanG077 Mar 9, 2024
d19ab70
Implement rudimentary up converter
Akribes Feb 23, 2024
408521e
Change type signature of up converter to indicate last byte
Akribes Feb 23, 2024
a83cdd2
Add simple test for up converter
Akribes Feb 23, 2024
570fd4f
refactor states of upconverter to flushing and filling
MatthijsMu Feb 25, 2024
8a59052
working function, also correct?
MatthijsMu Feb 26, 2024
f669292
Rewrite upconverter to use packet stream protocol
Akribes Feb 28, 2024
cd25aa4
Write down converter for dataWidth 4
Akribes Feb 29, 2024
c219eb5
Down converter for any data width
Akribes Feb 29, 2024
6110e3c
Revert "Down converter for any data width"
Akribes Feb 29, 2024
84b2bfd
Revert "Write down converter for dataWidth 4"
Akribes Feb 29, 2024
51aa747
Move up converter into its own file
Akribes Feb 29, 2024
2185554
Change UpConverterState to use _uc prefix
JLaumen Mar 1, 2024
abb4609
Change type signature of upConverter to work better with fromSignals
JLaumen Mar 1, 2024
ccbbe87
Create clash-protocols Circuit for up converter
Akribes Mar 1, 2024
213b371
Co-authored-by: Jasper Laumen <[email protected]>
MatthijsMu Mar 6, 2024
c5b4584
complete instance, add doctest
MatthijsMu Mar 6, 2024
9235029
reformat with make format
MatthijsMu Mar 6, 2024
7b0c19d
Co-authored-by: Jasper Laumen <[email protected]>
MatthijsMu Mar 8, 2024
e0f0411
not ready, for collaboration
MatthijsMu Mar 8, 2024
114379c
Add UpConverter test to unittests.hs
JLaumen Mar 8, 2024
1582a6d
Model type-checks, test has errors
JLaumen Mar 9, 2024
ea07c87
Added comments and type-signatures, test does not pass yet
JLaumen Mar 9, 2024
b2623f8
extra step for clarification of outData
MatthijsMu Mar 11, 2024
ea76402
fix rebase fallout
MatthijsMu Mar 11, 2024
878a6ae
Merge pull request #37 from GiPHouse/product-backlog
Baublesaurus Mar 11, 2024
72b94e5
Wrap Clash Cores UART receive
Akribes Mar 6, 2024
ee680c0
Clarify comments and code
Akribes Mar 6, 2024
488429f
Create circuits for uart rx to match PR #3
Akribes Mar 8, 2024
3c40295
make format oopsie
Akribes Mar 8, 2024
1c27d14
Convert to CSignals instead of ignoring back pressure
Akribes Mar 8, 2024
c20cef0
Style changes
Akribes Mar 8, 2024
6f66ed9
write function for model in Cores/.../UpConverter. Works fine.
MatthijsMu Mar 12, 2024
36c8ded
delete some comments
MatthijsMu Mar 12, 2024
86d844e
put useful test helper functions in Util.hs
MatthijsMu Mar 12, 2024
148ef91
add Util to cabal
MatthijsMu Mar 12, 2024
dc5ed87
working tests, generic in dataWidth, fix warning
MatthijsMu Mar 12, 2024
5e8356c
format code with make format
MatthijsMu Mar 12, 2024
a4f1795
fix upon review comments from Rowan. remove more warnings, redundant …
MatthijsMu Mar 12, 2024
5402ce5
Id test uart tx and rx
Akribes Mar 15, 2024
a1c2bd8
Create test for toPacketsC
Akribes Mar 15, 2024
8a1b37e
Fix test
Akribes Mar 15, 2024
8f5bd1d
Fix test, so it no longer wants _last set for unfinished packets
Akribes Mar 15, 2024
a42ac45
Move unsafeToPacketStream
Akribes Mar 15, 2024
f8254e7
No longer test that _abort and _last don't come through uart id test
Akribes Mar 15, 2024
3563ba9
remove comment
Akribes Mar 15, 2024
0666873
Merge pull request #13 from GiPHouse/4-create-clash-protocols-updown-…
rowanG077 Mar 15, 2024
eddc292
Merge branch 'develop' into 22-wrap-uart-in-packetstream-protocol
rowanG077 Mar 17, 2024
51ae421
Merge pull request #42 from GiPHouse/22-wrap-uart-in-packetstream-pro…
rowanG077 Mar 17, 2024
21b8e1c
Write down converter for dataWidth 4
Akribes Feb 29, 2024
f3dc666
Modify down converter to output data correctly
Akribes Feb 29, 2024
9830183
Change DownConverterState to use camelCase and _dc prefix
JLaumen Mar 1, 2024
41caa0d
Small formatting changes
JLaumen Mar 1, 2024
0155678
Change logic of toMaybePacketStreamM2S
JLaumen Mar 1, 2024
c49612c
Restore flipped condition
Akribes Mar 1, 2024
a21553c
Formatting
Akribes Mar 1, 2024
3513a92
Create clash-protocols Circuit
Akribes Mar 1, 2024
c92f5e4
Set up unimplemented test for DownConverter
JLaumen Mar 9, 2024
2a6e222
Fix rebase missing some changes
JLaumen Mar 14, 2024
afff1ff
Properly set up test this time
JLaumen Mar 14, 2024
6e074de
Implementation(?) of test, does not type-check. Cannot figure it out …
JLaumen Mar 15, 2024
660272a
Type checks now
JLaumen Mar 15, 2024
4ab8064
Add chopPacket, remove singletonToPackets, takeFirst, copyAndShift
MatthijsMu Mar 15, 2024
35dc5dd
reimplement model, add Test. ... .DownConverter module to cabal
MatthijsMu Mar 15, 2024
c545fad
add small sample tests to DownConverter for interactive debugging
MatthijsMu Mar 15, 2024
63fb8dd
add type of top-level entities
MatthijsMu Mar 17, 2024
4e6b424
construct downConverterC with forceResetEnable => tests succeed
MatthijsMu Mar 17, 2024
aa36d3c
begin of a Util file, as requested in comment of toMaybe
MatthijsMu Mar 17, 2024
129273b
remove toMaybe (not in Util), redundant exports, unit tests, model fu…
MatthijsMu Mar 17, 2024
5fe1514
bye redundant imports, bye warnings, hello make format!
MatthijsMu Mar 17, 2024
d8230ea
Small formatting fix
JLaumen Mar 19, 2024
b68789b
Merge pull request #15 from GiPHouse/14-create-stream-down-converter
JLaumen Mar 19, 2024
409badb
initial version
t-wallet Mar 9, 2024
5047c74
added interpacket gap inserter tests and fixed state transition function
t-wallet Mar 22, 2024
f68278b
merged changes from develop
t-wallet Mar 22, 2024
a9c7b6d
fixed tests and style changes
t-wallet Mar 22, 2024
827656c
removed gapSize, hardcoded 12
t-wallet Mar 22, 2024
54fab18
use Index 12 instead of Unsigned 4 + style changes
t-wallet Mar 22, 2024
16c3566
configurable gapSize instead of hardcoded 12 cycles
t-wallet Mar 22, 2024
59ba1bf
Merge pull request #48 from GiPHouse/28-implement-interpacket-gap-ins…
t-wallet Mar 25, 2024
57dec2b
initial version of async FIFO + tests. Tests currently fail due to a …
t-wallet Mar 9, 2024
9b4a28e
Added a check that the AsyncFifo is non empty before it is ready to read
Daanww Mar 15, 2024
e86ad49
AsyncFifo gefixed met Rowan's hulp. Passed nu de tests
Daanww Mar 16, 2024
081e837
Removed unnecessary comments
Daanww Mar 16, 2024
721205d
final style and comment changes
t-wallet Mar 25, 2024
ae8af02
Handle Lucas's review comments
Akribes Apr 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .ci/test_whitespace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -xou pipefail

grep \
-E ' $' -n -r . \
--include=*.{hs,hs-boot,sh,cabal,md,yml} \
--exclude-dir=dist-newstyle --exclude-dir=deps
if [[ $? == 0 ]]; then
echo "EOL whitespace detected. See ^"
exit 1;
fi
40 changes: 40 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "CI pipeline"
on:
push:
pull_request:
jobs:
file_endings:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v4
- name: Whitespace file endings
run: |
.ci/test_whitespace.sh


# build_and_synthesize:
# runs-on: ubuntu-latest
# steps:
# - name: git checkout
# uses: actions/checkout@v4
# - name: install nix
# uses: cachix/install-nix-action@v22
# with:
# nix_path: nixpkgs=channel:nixos-unstable
# - name: cache nix
# uses: DeterminateSystems/magic-nix-cache-action@v2
# - name: build the nix environment
# run: nix-build
# - name: check stylish-haskell
# run: nix-shell --run "make check_format"
# - name: clean linting process
# run: nix-shell --run "make clean_tests"
# - name: Test suite
# run: nix-shell --run "make test"
# - name: Test synthesis
# run: nix-shell --run "make verilog"
# - name: Create netlist
# run: nix-shell --run "make netlist"
# - name: Create Place and Route
# run: nix-shell --run "make pnr"
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ clean:

format:
stylish-haskell -c ./.stylish-haskell.yaml -r -i src

check_format:
cp ./.stylish-haskell.yaml ./.stylish-haskell-check.yaml
echo "exit_code: error_on_format" >> ./.stylish-haskell-check.yaml
stylish-haskell -c ./.stylish-haskell-check.yaml -r src

clean_tests:
rm ./.stylish-haskell-check.yaml

test:
cabal test

Expand Down
5 changes: 5 additions & 0 deletions Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Prelude
import Distribution.Extra.Doctest (defaultMainWithDoctests)

main :: IO ()
main = defaultMainWithDoctests "doctests"
34 changes: 31 additions & 3 deletions clash-eth.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ common common-options
TypeFamilies
TypeOperators
ViewPatterns
ImportQualifiedPost
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort


-- TemplateHaskell is used to support convenience functions such as
-- 'listToVecTH' and 'bLit'.
Expand Down Expand Up @@ -78,18 +79,35 @@ common common-options
ghc-typelits-extra,
ghc-typelits-knownnat

custom-setup
setup-depends:
base >= 4.11 && <5,
Cabal >= 2.4,
cabal-doctest >= 1.0.1 && <1.1

library
import: common-options
hs-source-dirs: src
exposed-modules:
Clash.Lattice.ECP5.Colorlight.TopEntity
Clash.Cores.Ethernet.RGMII
Clash.Cores.Ethernet.PacketStream
Clash.Cores.Ethernet.UpConverter
Clash.Cores.Ethernet.DownConverter
Clash.Cores.Ethernet.Util
Clash.Cores.Ethernet.InterpacketGapInserter
Clash.Cores.Ethernet.AsyncFIFO
Clash.Lattice.ECP5.Prims
Clash.Lattice.ECP5.UART
Clash.Lattice.ECP5.Colorlight.CRG
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sort

default-language: Haskell2010
build-depends:
interpolate,
clash-cores
clash-cores,
deepseq,
hashable,
-- For debugging
pretty-show

test-suite doctests
type: exitcode-stdio-1.0
Expand All @@ -100,7 +118,8 @@ test-suite doctests
build-depends:
base,
clash-eth,
doctest-parallel >= 0.2 && < 0.4,
doctest >= 0.17 && <= 0.19,
process,

test-suite test-library
import: common-options
Expand All @@ -110,11 +129,20 @@ test-suite test-library
ghc-options: -threaded
main-is: unittests.hs
other-modules:
Test.Cores.Ethernet.Ethernet
Test.Cores.Ethernet.Util
Test.Cores.Ethernet.PacketStream
Test.Lattice.ECP5.UART
Test.Cores.Ethernet.DownConverter
Test.Cores.Ethernet.UpConverter
Test.Cores.Ethernet.InterpacketGapInserter
Test.Cores.Ethernet.AsyncFIFO
build-depends:
clash-eth,
QuickCheck,
hedgehog,
clash-cores,
hashable,
unordered-containers,
tasty >= 1.2 && < 1.5,
tasty-hedgehog,
tasty-th
Expand Down
9 changes: 9 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
with import ./nix/nixpkgs.nix {};

stdenv.mkDerivation{
name = "qbaylogic-clash-based-macipudp-stack-spring24" ;
src = ./. ;
installPhase= ''
touch $out
'';
}
6 changes: 4 additions & 2 deletions diagram/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env sh
set -euxo pipefail

plantuml -tsvg layer1+2-arch.puml
plantuml -tsvg uart-eth.puml
for i in *.puml
do
plantuml -tsvg "$i"
done
28 changes: 15 additions & 13 deletions diagram/layer1+2-arch.puml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ rectangle "Frame check sequence\nvalidation" as FCSRx <<SystemDomain>>
rectangle "MAC depacketizer" as PacketRx <<SystemDomain>>
rectangle "MAC sink" as Sink <<SystemDomain>>

PhyRx -down-> UpConv : last_be :: Maybe (Vec 1 Bool) \nabort :: Bool\npayload :: Vec 1 (BitVector 8)
UpConv -down-> CDCRx : last_be :: Maybe (Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
CDCRx -down-> PreRx : last_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
PreRx -down-> FCSRx : last_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
FCSRx -down-> PacketRx : last_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
PacketRx -down-> Sink : mac_header :: MacHeader\nlast_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
PhyRx -down-> UpConv : PacketStream 1 ()
UpConv -down-> CDCRx : PacketStream 1 ()
CDCRx -down-> PreRx : PacketStream 4 ()
PreRx -down-> FCSRx : PacketStream 4 ()
FCSRx -down-> PacketRx : PacketStream 4 ()
PacketRx -down-> Sink : PacketStream 4 MacHeader

rectangle "MAC source" as Source <<SystemDomain>>
rectangle "Padding insert" as PaddingTx <<SystemDomain>>
rectangle "MAC Packetizer" as PacketTx <<SystemDomain>>
rectangle "Frame check sequence\ninserter" as FCSTx <<SystemDomain>>
rectangle "Preamble inserter" as PreTx <<SystemDomain>>
Expand All @@ -50,12 +51,13 @@ rectangle "DownConverter" as DownConv <<PhyTxDomain>>
rectangle "Interpacket gap inserter" as IPG <<PhyTxDomain>>
rectangle "Phy Transmitter" as PhyTx <<PhyTxDomain>>

Source -up-> PacketTx : mac_header :: MacHeader\nlast_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
PacketTx -up-> FCSTx : last_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
FCSTx -up-> PreTx : last_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
PreTx -up-> CDCTx : last_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
CDCTx -up-> DownConv : last_be :: Maybe(Vec n Bool)\nabort :: Bool\npayload :: Vec n (BitVector 8)
DownConv -up-> IPG : last_be :: Maybe (Vec 1 Bool) \nabort :: Bool\npayload :: Vec 1 (BitVector 8)
IPG -up-> PhyTx : last_be :: Maybe (Vec 1 Bool) \nabort :: Bool\npayload :: Vec 1 (BitVector 8)
Source -up-> PacketTx : PacketStream 4 MacHeader
PacketTx -up-> PaddingTx : PacketStream 4 ()
PaddingTx -up-> FCSTx : PacketStream 4 ()
FCSTx -up-> PreTx : PacketStream 4 ()
PreTx -up-> CDCTx : PacketStream 4 ()
CDCTx -up-> DownConv : PacketStream 4 ()
DownConv -up-> IPG : PacketStream 1 ()
IPG -up-> PhyTx : PacketStream 1 ()

@enduml
Loading