Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide: Add idma to ethernet #3

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.bender
33 changes: 22 additions & 11 deletions Bender.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@ packages:
- common_cells
- common_verification
- tech_cells_generic
axi_mem_if:
revision: 3567273b4f67bd57a81a2a503394a49641bae53a
version: 0.2.1
source:
Git: [email protected]:pulp-platform/axi_mem_if.git
dependencies:
- axi
axi_stream:
revision: 472751f550e3918215603e21734fe0ece3c66f79
version: null
revision: 54891ff40455ca94a37641b9da4604647878cc07
version: 0.1.1
source:
Git: [email protected]:pulp-platform/axi_stream.git
dependencies:
Expand All @@ -43,15 +36,33 @@ packages:
source:
Git: https://github.com/pulp-platform/common_verification.git
dependencies: []
idma:
revision: a80fcace92b1562e7cd76c8615298b5623ba74d2
version: 0.6.0-beta
source:
Git: [email protected]:pulp-platform/iDMA.git
dependencies:
- axi
- common_cells
- common_verification
- idma_gen
- register_interface
idma_gen:
revision: null
version: null
source:
Path: .bender/git/checkouts/idma-c23dbd3f440503c0/target/rtl
dependencies: []
register_interface:
revision: 146501d80052b61475cdc333d3aab4cd769fd5dc
version: 0.3.9
revision: d7693be4aef1fc7e7eb2b00b41c42e87d959866c
version: 0.4.2
source:
Git: https://github.com/pulp-platform/register_interface.git
dependencies:
- apb
- axi
- common_cells
- common_verification
tech_cells_generic:
revision: 7968dd6e6180df2c644636bc6d2908a49f2190cf
version: 0.2.13
Expand Down
27 changes: 17 additions & 10 deletions Bender.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Copyright 2023 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51

package:
name: pulp-ethernet

Expand All @@ -11,20 +15,20 @@ package:
- "Davide Rossi <[email protected]>"

dependencies:
axi_mem_if : { git: [email protected]:pulp-platform/axi_mem_if.git, version: 0.2.1 }
axi : { git: "[email protected]:pulp-platform/axi.git", version: 0.39.1 }
common_verification : { git: "https://github.com/pulp-platform/common_verification.git", version: 0.2.3 }
register_interface : { git: "https://github.com/pulp-platform/register_interface.git", version: 0.3.8 }
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.32.0 }
axi_stream: { git: "[email protected]:pulp-platform/axi_stream.git", rev: "472751f550e3918215603e21734fe0ece3c66f79" }
axi : { git: "[email protected]:pulp-platform/axi.git", version: 0.39.1 }
axi_stream: { git: "[email protected]:pulp-platform/axi_stream.git", rev: "54891ff" } # branch: main
common_verification : { git: "https://github.com/pulp-platform/common_verification.git", version: 0.2.3 }
register_interface : { git: "https://github.com/pulp-platform/register_interface.git", version: 0.4.2 }
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.32.0 }
idma: { git: "[email protected]:pulp-platform/iDMA.git", rev: "v0.6.0-beta" }

sources:
# Source files grouped in levels. Files in level 0 have no dependencies on files in this
# package. Files in level 1 only depend on files in level 0, files in level 2 on files in
# levels 1 and 0, etc. Files within a level are ordered alphabetically.
# Level 0
- gen/eth_framing_reg_pkg.sv
- gen/eth_framing_reg_top.sv
- gen/eth_idma_reg_pkg.sv
- gen/eth_idma_reg_top.sv
- rtl/axis_gmii_rx.sv
- rtl/axis_gmii_tx.sv
# Level 1
Expand All @@ -40,9 +44,12 @@ sources:
- rtl/ssio_ddr_in.sv
# Level 2
- rtl/framing_top.sv
- rtl/eth_top_pkg.sv
- rtl/eth_top.sv
- target/synth/eth_top_synth.sv
- rtl/eth_idma_wrap.sv

- target: any(synthesis, asic)
files:
- target/synth/eth_idma_wrap_synth.sv

- target: test
files:
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,21 @@ used.
`pulp-ethernet` is intended for use with https://github.com/pulp-platform/ariane
(a RISCV Linux-capable soft core).

## Generate iDMA

```
make eth-idma-gen
```

## Compile (Questa)

```
make eth-hw-build
make eth-sim-build
```

## Simulate (Questa)
```
make eth-hw-sim
make eth-vsim-sim-run
```

### Debugging
Expand Down
48 changes: 38 additions & 10 deletions eth.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@
BENDER ?= bender
QUESTA ?= questa-2022.3
TBENCH ?= eth_tb
DUT ?= eth_rgmii_synth
DUT ?= eth_idma_wrap

# Design and simulation variables
ETH_ROOT ?= $(shell $(BENDER) path fe-ethernet)
ETH_VSIM_DIR := $(ETH_ROOT)/target/sim/vsim

IDMA_ROOT ?= $(shell $(BENDER) path idma)

QUESTA_FLAGS := -permissive -suppress 3009 -suppress 8386 -error 7 +UVM_NO_RELNOTES
#QUESTA_FLAGS :=
Expand All @@ -34,44 +37,69 @@ else
RUN_AND_EXIT := run -all; exit
endif

########
# Deps #
########

eth-checkout:
$(BENDER) checkout
touch Bender.lock

include $(IDMA_ROOT)/idma.mk

######################
# Nonfree components #
######################

ETH_NONFREE_REMOTE ?= [email protected]:pulp-restricted/pulp-ethernet-nonfree.git
ETH_NONFREE_COMMIT ?= cd8dcd3
ETH_NONFREE_COMMIT ?= 9a45a7c

eth-nonfree-init:
git clone $(ETH_NONFREE_REMOTE) $(ETH_ROOT)/nonfree
cd $(ETH_ROOT)/nonfree && git checkout $(ETH_NONFREE_COMMIT)

-include $(ETH_ROOT)/nonfree/nonfree.mk

##############
# HW GEN #
##############

eth-idma-gen: eth-checkout
make -C $(IDMA_ROOT) idma_hw_all

##############
# Simulation #
##############

# Questasim
$(ETH_ROOT)/target/sim/vsim/compile.eth.tcl: Bender.yml
$(BENDER) script vsim -t test \
$(BENDER) script vsim -t rtl -t test -t sim \
--vlog-arg="-svinputport=compat" \
--vlog-arg="-override_timescale 1ns/1ps" \
--vlog-arg="-suppress 2583" > $@
echo 'vopt $(VOPT_FLAGS) $(TBENCH) -o $(TBENCH)_opt' >> $@

eth-sim-init: $(ETH_ROOT)/target/sim/vsim/compile.eth.tcl

eth-hw-build: eth-sim-init
$(QUESTA) vsim -c -do "quit -code [source $(ETH_ROOT)/target/sim/vsim/compile.eth.tcl]"
eth-vsim-sim-build: eth-sim-init
cd $(ETH_VSIM_DIR) && $(QUESTA) vsim -c -do "quit -code [source $(ETH_ROOT)/target/sim/vsim/compile.eth.tcl]"

eth-hw-sim:
$(QUESTA) vsim $(VSIM_FLAGS) -do \
eth-vsim-sim-run:
cd $(ETH_VSIM_DIR) && $(QUESTA) vsim $(VSIM_FLAGS) -do \
"set TESTBENCH $(TBENCH); \
set VSIM_FLAGS \"$(VSIM_FLAGS)\"; \
source $(ETH_ROOT)/target/sim/vsim/start.eth.tcl ; \
$(RUN_AND_EXIT)"

eth-vsim-sim-clean:
cd $(ETH_VSIM_DIR) && rm -rf work transcript

# Global targets

eth-sim-init: $(ETH_ROOT)/target/sim/vsim/compile.eth.tcl
eth-sim-build: eth-vsim-sim-build
eth-sim-clean: eth-vsim-sim-clean

#################################
# Phonies (KEEP AT END OF FILE) #
#################################

.PHONY: eth-all eth-nonfree-init eth-sim-init eth-hw-build eth-hw-sim
.PHONY: eth-all eth-nonfree-init eth-checkout eth-idma-gen eth-sim-init eth-sim-build eth-sim-clean eth-vsim-sim-build eth-vsim-sim-clean eth-vsim-sim-run
8 changes: 4 additions & 4 deletions gen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@

REGTOOL ?= regtool.py
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can we add also the commands to generate the register list as markdown file? This command should make it: https://github.com/pulp-platform/carfield/blob/main/carfield.mk#L236

Choose a reason for hiding this comment

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

thanks! i will include it in my next commit.


SRCS = eth_framing_reg_top.sv eth_framing_reg_pkg.sv
SRCS = eth_idma_reg_top.sv eth_idma_reg_pkg.sv

all: srcs headers

srcs: $(SRCS)

eth_framing_reg_top.sv: eth_framing_regs.hjson
eth_idma_reg_top.sv: eth_idma_reg.hjson
$(REGTOOL) -r $< -t .

headers: eth_framing.h
headers: eth_idma_reg.h

eth_framing.h: eth_framing_regs.hjson
eth_idma_reg.h: eth_idma_reg.hjson
$(REGTOOL) --cdefines $< > $@

.PHONY: install
Expand Down
37 changes: 0 additions & 37 deletions gen/eth_framing.h

This file was deleted.

83 changes: 0 additions & 83 deletions gen/eth_framing_reg_pkg.sv

This file was deleted.

Loading
Loading