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 Ethernet peripheral #104

Draft
wants to merge 48 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9fe29b4
Integrate HMR unit for CVA6 redundancy.
Mar 9, 2024
995fe63
Add clic virtualization and LLC partitioning.
Mar 5, 2024
a2c83d5
Integrate HMR unit for CVA6 redundancy.
Mar 2, 2024
1b1afe1
Add clic virtualization and LLC partitioning.
Mar 5, 2024
98d843c
target/sim: Add JTAG tasks for reg access and preloading (#103)
alex96295 Mar 5, 2024
887ae3a
Bump CVA6-SDK tu fetch buildroot through HTTPS.
Apr 19, 2024
56d7ad5
Bump nonfree to filter out SPI fake errors.
Apr 19, 2024
9540cce
Add selectable AXI cut between core and ID remap.
Apr 19, 2024
1625e74
Propagate FullBandwidth parameter to atomics.
Apr 19, 2024
0b06250
Update atomics tu not include ID queue optimization.
Apr 20, 2024
2c3cc40
Integrate iDMA v0.6.
Apr 23, 2024
261134a
working sim with local fix on dma
chaoqun-liang Feb 19, 2024
d7b2622
rebase
chaoqun-liang May 6, 2024
b22adae
cleanup
chaoqun-liang Apr 9, 2024
425304e
update ethernet with idma v0.6.0
chaoqun-liang Apr 14, 2024
3bbc33a
fix
chaoqun-liang Apr 14, 2024
b9c51e4
multiple fixes
chaoqun-liang Apr 14, 2024
111cb7d
plic added
chaoqun-liang Apr 16, 2024
1455492
undo a crime
chaoqun-liang Apr 16, 2024
2f0d7d6
idma wrapper
chaoqun-liang Apr 17, 2024
1d16b41
fix
chaoqun-liang May 18, 2024
3b60f7a
sim new idma
chaoqun-liang May 18, 2024
6a47f10
external clks
chaoqun-liang May 18, 2024
7a809f2
xilinx fix
chaoqun-liang May 18, 2024
903658b
fix constraints
chaoqun-liang May 21, 2024
7c9a873
chs eth with rx irq
chaoqun-liang Jun 18, 2024
0dc7d2a
eth mdio_i
chaoqun-liang Jun 19, 2024
9a17a02
add hardcoded dma contrl signals
chaoqun-liang Jul 7, 2024
93a0583
ethernet with hw packet length to dma
chaoqun-liang Jul 17, 2024
effd127
udapte ethernet with dma_en after obtaining length
chaoqun-liang Jul 21, 2024
2b98c99
idma_rx_en into reg
chaoqun-liang Jul 24, 2024
60c8cf0
fix typo in ethernet
chaoqun-liang Jul 24, 2024
a01cbb1
rm ethernet latch
chaoqun-liang Jul 28, 2024
77c879d
update ethernet with added regs
chaoqun-liang Aug 8, 2024
d93c93f
mdio sw RW to RO
chaoqun-liang Sep 4, 2024
e725509
ethernet payload cycle fix
chaoqun-liang Sep 4, 2024
1bb87e3
rm conditional iobuf
chaoqun-liang Sep 5, 2024
dcc85c4
io buf fast
chaoqun-liang Sep 5, 2024
523e02f
enlarge tx rx fifo depth
chaoqun-liang Sep 5, 2024
1d04d66
restore conditional io bud
chaoqun-liang Sep 5, 2024
f729c20
minor fixes
chaoqun-liang Sep 12, 2024
515bbac
ethernet dependency update
chaoqun-liang Oct 12, 2024
8c25a3a
eth test typo fix
chaoqun-liang Oct 29, 2024
2ebc5c6
req_ready check in test
chaoqun-liang Oct 29, 2024
912c9a9
restore req sw
chaoqun-liang Oct 29, 2024
063813b
enlarged rx fifo
chaoqun-liang Nov 8, 2024
397d29c
test cleanup
chaoqun-liang Nov 8, 2024
fd98482
update ethernet dependency
chaoqun-liang Nov 8, 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
57 changes: 43 additions & 14 deletions Bender.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ packages:
- apb
- register_interface
axi:
revision: ac5deb3ff086aa34b168f392c051e92603d6c0e2
version: 0.39.2
revision: 853ede23b2a9837951b74dbdc6d18c3eef5bac7d
version: 0.39.5
source:
Git: https://github.com/pulp-platform/axi.git
dependencies:
Expand Down Expand Up @@ -44,17 +44,24 @@ packages:
- common_cells
- common_verification
axi_rt:
revision: 56074a195b1c8b05f4bdd73674e437bbcb35f2cd
version: 0.0.0-alpha.7
revision: 641ea950e24722af747033f2ab85f0e48ea8d7f8
version: 0.0.0-alpha.9
source:
Git: https://github.com/pulp-platform/axi_rt.git
dependencies:
- axi
- common_cells
- register_interface
axi_stream:
revision: 54891ff40455ca94a37641b9da4604647878cc07
version: 0.1.1
source:
Git: https://github.com/pulp-platform/axi_stream.git
dependencies:
- common_cells
axi_vga:
revision: 3718b9930f94a9eaad8ee50b4bccc71df0403084
version: 0.1.3
revision: 4d3e70d4f47bb74edc1ab68d99ffc02382e0fb9e
version: 0.1.4
source:
Git: https://github.com/pulp-platform/axi_vga.git
dependencies:
Expand All @@ -78,8 +85,8 @@ packages:
- common_cells
- register_interface
common_cells:
revision: 13f28aa0021fc22c0d01a12d618fda58d2c93239
version: 1.33.0
revision: c27bce39ebb2e6bae52f60960814a2afca7bd4cb
version: 1.37.0
source:
Git: https://github.com/pulp-platform/common_cells.git
dependencies:
Expand Down Expand Up @@ -117,14 +124,16 @@ packages:
dependencies:
- common_cells
idma:
revision: ca1b28816a3706be0bf9ce01378246d5346384f0
version: 0.5.1
revision: c12caf59bb482fe44b27361f6924ad346b2d22fe
version: 0.6.3
source:
Git: https://github.com/pulp-platform/iDMA.git
dependencies:
- axi
- axi_stream
- common_cells
- common_verification
- obi
- register_interface
irq_router:
revision: d1d31350b24f3965b3a51e1bc96c71eb34e94db3
Expand All @@ -135,6 +144,14 @@ packages:
- axi
- common_cells
- register_interface
obi:
revision: 5321106817e177d6c16ecc4daa922b96b1bc946b
version: 0.1.5
source:
Git: https://github.com/pulp-platform/obi.git
dependencies:
- common_cells
- common_verification
opentitan_peripherals:
revision: cd3153de2783abd3d03d0595e6c4b32413c62f14
version: 0.4.0
Expand All @@ -144,9 +161,21 @@ packages:
- common_cells
- register_interface
- tech_cells_generic
pulp-ethernet:
revision: e6e4c8eb7a1dc739492818e45b7ef8196e345b0c
version: null
source:
Git: https://github.com/pulp-platform/pulp-ethernet.git
dependencies:
- axi
- axi_stream
- common_cells
- common_verification
- idma
- register_interface
register_interface:
revision: e25b36670ff7aab3402f40efcc2b11ee0f31cf19
version: 0.4.3
revision: 5daa85d164cf6b54ad061ea1e4c6f3624556e467
version: 0.4.5
source:
Git: https://github.com/pulp-platform/register_interface.git
dependencies:
Expand All @@ -163,8 +192,8 @@ packages:
- common_cells
- tech_cells_generic
serial_link:
revision: 5a25f5a71074f1ebb6de7b5280f2b16924bcc666
version: 1.1.1
revision: c55df03a1da06b00e567cf968b1b1a5f40c9f802
version: 1.1.2
source:
Git: https://github.com/pulp-platform/serial_link.git
dependencies:
Expand Down
4 changes: 3 additions & 1 deletion Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ dependencies:
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.33.0 }
common_verification: { git: "https://github.com/pulp-platform/common_verification.git", version: 0.2.0 }
cva6: { git: "https://github.com/pulp-platform/cva6.git", rev: pulp-v1.0.0 }
iDMA: { git: "https://github.com/pulp-platform/iDMA.git", version: 0.5.1 }
iDMA: { git: "https://github.com/pulp-platform/iDMA.git", version: 0.6.0 }
irq_router: { git: "https://github.com/pulp-platform/irq_router.git", version: 0.0.1-beta.1 }
opentitan_peripherals: { git: "https://github.com/pulp-platform/opentitan_peripherals.git", version: 0.4.0 }
register_interface: { git: "https://github.com/pulp-platform/register_interface.git", version: 0.4.3 }
riscv-dbg: { git: "https://github.com/pulp-platform/riscv-dbg.git", version: 0.8.1 }
serial_link: { git: "https://github.com/pulp-platform/serial_link.git", version: 1.1.1 }
unbent: { git: "https://github.com/pulp-platform/unbent.git", version: 0.1.6 }
pulp-ethernet: { git: "https://github.com/pulp-platform/pulp-ethernet.git", rev: "e6e4c8e" } # branch: chs-hs

export_include_dirs:
- hw/include
Expand All @@ -39,6 +40,7 @@ sources:
- hw/regs/cheshire_reg_pkg.sv
- hw/regs/cheshire_reg_top.sv
- hw/cheshire_pkg.sv
- hw/dma_core_wrap.sv
- hw/cheshire_soc.sv

- target: any(simulation, test)
Expand Down
9 changes: 7 additions & 2 deletions cheshire.mk
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ CLINTROOT := $(shell $(BENDER) path clint)
AXIRTROOT := $(shell $(BENDER) path axi_rt)
AXI_VGA_ROOT := $(shell $(BENDER) path axi_vga)
IDMA_ROOT := $(shell $(BENDER) path idma)
ETH_ROOT := $(shell $(BENDER) path pulp-ethernet)

REGTOOL ?= $(CHS_REG_DIR)/vendor/lowrisc_opentitan/util/regtool.py

Expand Down Expand Up @@ -103,6 +104,10 @@ $(CHS_SLINK_DIR)/.generated: $(CHS_ROOT)/hw/serial_link.hjson
cp $< $(dir $@)/src/regs/serial_link_single_channel.hjson
flock -x $@ $(MAKE) -C $(CHS_SLINK_DIR) update-regs BENDER="$(BENDER)" && touch $@

# iDMA
$(IDMA_ROOT)/.generated: $(IDMA_ROOT)/target/rtl/idma_reg64_2d.hjson
flock -x $@ sh -c "cp $< $(dir $@)/target/rtl/; $(MAKE) -j1 otp" && touch $@

CHS_HW_ALL += $(CHS_ROOT)/hw/regs/cheshire_reg_pkg.sv $(CHS_ROOT)/hw/regs/cheshire_reg_top.sv
CHS_HW_ALL += $(CLINTROOT)/.generated
CHS_HW_ALL += $(OTPROOT)/.generated
Expand Down Expand Up @@ -133,7 +138,7 @@ CHS_BOOTROM_ALL += $(CHS_ROOT)/hw/bootrom/cheshire_bootrom.sv $(CHS_ROOT)/hw/boo
##############

$(CHS_ROOT)/target/sim/vsim/compile.cheshire_soc.tcl: $(CHS_ROOT)/Bender.yml
$(BENDER) script vsim -t sim -t cv64a6_imafdcsclic_sv39 -t test -t cva6 -t rtl --vlog-arg="$(VLOG_ARGS)" > $@
$(BENDER) script vsim -t sim -t cv64a6_imafdcsclic_sv39 -t test -t cva6 -t rtl -t snitch_cluster --vlog-arg="$(VLOG_ARGS)" > $@
echo 'vlog "$(realpath $(CHS_ROOT))/target/sim/src/elfloader.cpp" -ccflags "-std=c++11"' >> $@

.PRECIOUS: $(CHS_ROOT)/target/sim/models
Expand Down Expand Up @@ -169,7 +174,7 @@ include $(CHS_ROOT)/target/xilinx/xilinx.mk

CHS_ALL += $(CHS_SW_ALL) $(CHS_HW_ALL) $(CHS_SIM_ALL)

chs-all: $(CHS_ALL)
chs-all: $(CHS_ALL) #idma-gen
chs-sw-all: $(CHS_SW_ALL)
chs-hw-all: $(CHS_HW_ALL)
chs-bootrom-all: $(CHS_BOOTROM_ALL)
Expand Down
1 change: 1 addition & 0 deletions hw/bootrom/cheshire_bootrom.S
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ _start:
andi t0, t0, 2 // regs.HW_FEATURES.llc
beqz t0, _prom_check_run
la t0, __base_llc
// Only configure half of LLC as SPM
_wait_llc_bist:
lw t1, 72(t0) // llc.BIST_STATUS_DONE_BIT
beqz t1, _wait_llc_bist
Expand Down
2 changes: 1 addition & 1 deletion hw/bootrom/cheshire_bootrom.sv
Original file line number Diff line number Diff line change
Expand Up @@ -2081,4 +2081,4 @@
endcase
end

endmodule
endmodule

Check warning on line 2084 in hw/bootrom/cheshire_bootrom.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/bootrom/cheshire_bootrom.sv#L2084

File must end with a newline. [Style: posix-file-endings] [posix-eof]
Raw output
message:"File must end with a newline. [Style: posix-file-endings] [posix-eof]"  location:{path:"hw/bootrom/cheshire_bootrom.sv"  range:{start:{line:2084  column:10}}}  severity:WARNING  source:{name:"verible-verilog-lint"  url:"https://github.com/chipsalliance/verible"}  suggestions:{range:{start:{line:2084  column:10}  end:{line:2085}}  text:"endmodule\n"}
21 changes: 17 additions & 4 deletions hw/cheshire_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ package cheshire_pkg;
dw_bt AxiDataWidth;
dw_bt AxiUserWidth;
aw_bt AxiMstIdWidth;
aw_bt TFLenWidth;
dw_bt AxiMaxMstTrans;
dw_bt AxiMaxSlvTrans;
// User signals identify atomics masters.
Expand All @@ -100,9 +101,11 @@ package cheshire_pkg;
dw_bt AxiUserErrBits;
dw_bt AxiUserErrLsb;
doub_bt AxiUserDefault; // Default user assignment, adjusted by user features (AMO)
bit CorePostCut;
// Reg parameters
dw_bt RegMaxReadTxns;
dw_bt RegMaxWriteTxns;
bit AxiToRegCut;
aw_bt RegAmoNumCuts;
bit RegAmoPostCut;
bit RegAdaptMemCut;
Expand All @@ -127,6 +130,7 @@ package cheshire_pkg;
bit Bootrom;
bit Uart;
bit I2c;
bit Ethernet;
bit SpiHost;
bit Gpio;
bit Dma;
Expand Down Expand Up @@ -212,6 +216,7 @@ package cheshire_pkg;
typedef struct packed {
cheshire_bus_err_intr_t bus_err;
logic [31:0] gpio;
logic ethernet;
logic spih_spi_event;
logic spih_error;
logic i2c_host_timeout;
Expand Down Expand Up @@ -293,6 +298,7 @@ package cheshire_pkg;
aw_bt vga;
aw_bt ext_base;
aw_bt num_in;
aw_bt eth;
} axi_in_t;

function automatic axi_in_t gen_axi_in(cheshire_cfg_t cfg);
Expand All @@ -303,6 +309,7 @@ package cheshire_pkg;
if (cfg.Dma) begin i++; ret.dma = i; end
if (cfg.SerialLink) begin i++; ret.slink = i; end
if (cfg.Vga) begin i++; ret.vga = i; end
if (cfg.Ethernet) begin i++; ret.eth = i; end
i++;
ret.ext_base = i;
ret.num_in = i + cfg.AxiExtNumMst;
Expand Down Expand Up @@ -380,6 +387,7 @@ package cheshire_pkg;
aw_bt llc;
aw_bt uart;
aw_bt i2c;
aw_bt ethernet;
aw_bt spi_host;
aw_bt gpio;
aw_bt slink;
Expand All @@ -388,6 +396,7 @@ package cheshire_pkg;
aw_bt irq_router;
aw_bt [2**MaxCoresWidth-1:0] bus_err;
aw_bt [2**MaxCoresWidth-1:0] clic;
aw_bt hmr_unit;
aw_bt ext_base;
aw_bt num_out;
aw_bt num_rules;
Expand All @@ -410,6 +419,7 @@ package cheshire_pkg;
if (cfg.Vga) begin i++; ret.vga = i; r++; ret.map[r] = '{i, 'h0300_7000, 'h0300_8000}; end
if (cfg.IrqRouter) begin i++; ret.irq_router = i; r++; ret.map[r] = '{i, 'h0208_0000, 'h020c_0000}; end
if (cfg.AxiRt) begin i++; ret.axirt = i; r++; ret.map[r] = '{i, 'h020c_0000, 'h0210_0000}; end
if (cfg.Ethernet) begin i++; ret.ethernet = i; r++; ret.map[r] = '{i, 'h0300_c000, 'h0300_d000}; end
if (cfg.Clic) for (int j = 0; j < cfg.NumCores; j++) begin
i++; ret.clic[j] = i; r++; ret.map[r] = '{i, AmClic + j*'h40000, AmClic + (j+1)*'h40000};
end
Expand Down Expand Up @@ -569,8 +579,9 @@ package cheshire_pkg;
// Interconnect
AddrWidth : 48,
AxiDataWidth : 64,
AxiUserWidth : 2, // AMO(2)
AxiUserWidth : 2, // Convention: bit 0 for core(s), bit 1 for serial link
AxiMstIdWidth : 2,
TFLenWidth : 32,
AxiMaxMstTrans : 24,
AxiMaxSlvTrans : 24,
AxiUserAmoMsb : 1, // Convention: lower AMO bits for cores, MSB for serial link
Expand All @@ -580,6 +591,7 @@ package cheshire_pkg;
AxiUserDefault : 0,
RegMaxReadTxns : 8,
RegMaxWriteTxns : 8,
AxiToRegCut : 0,
RegAmoNumCuts : 1,
RegAmoPostCut : 1,
RegAdaptMemCut : 1,
Expand All @@ -589,12 +601,13 @@ package cheshire_pkg;
Bootrom : 1,
Uart : 1,
I2c : 1,
Ethernet : 1,
SpiHost : 1,
Gpio : 1,
Dma : 1,
Dma : 0,
Copy link
Collaborator

@alex96295 alex96295 Feb 23, 2024

Choose a reason for hiding this comment

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

I know this is WIP, but make sure you test correct working of the ethernet integration when the system DMA is enabled. Just a reminder :)

SerialLink : 1,
Vga : 1,
AxiRt : 0,
AxiRt : 1,
Clic : 0,
IrqRouter : 0,
BusErr : 1,
Expand All @@ -608,7 +621,7 @@ package cheshire_pkg;
// LLC: 128 KiB, up to 2 GiB DRAM
LlcNotBypass : 1,
LlcSetAssoc : 8,
LlcNumLines : 256,
LlcNumLines : 128, // from 256
LlcNumBlocks : 8,
LlcMaxReadTxns : 16,
LlcMaxWriteTxns : 16,
Expand Down
Loading
Loading