Skip to content

Commit

Permalink
Separate config registers from the LLC implementation #5
Browse files Browse the repository at this point in the history
  • Loading branch information
creinwar authored and thommythomaso committed Nov 21, 2022
1 parent 29fd76f commit aa42cd6
Show file tree
Hide file tree
Showing 22 changed files with 2,138 additions and 1,305 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:

env:
BENDER: ./bender
MORTY: ./morty

jobs:
check-clean:
Expand All @@ -25,13 +26,17 @@ jobs:
with:
python-version: '3.9'
cache: 'pip'
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Install Bender
run: make bender
- name: Install Morty
run: make morty
- name: Python Requirements
run: pip install -r requirements.txt
- name: Check clean make targets
run: |
make -B all
make -B pickle doc graph regs
make clean
git status && test -z "$(git status --porcelain)"
check-stale:
Expand All @@ -42,13 +47,17 @@ jobs:
with:
python-version: '3.9'
cache: 'pip'
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
- name: Install Bender
run: make bender
- name: Install Morty
run: make morty
- name: Python Requirements
run: pip install -r requirements.txt
- name: Check clean makefile
run: |
make -B all
make -B pickle doc graph regs
git status && test -z "$(git status --porcelain)"
lint:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -153,10 +162,7 @@ jobs:
- name: Python Requirements
run: python3 -m pip install -r requirements.txt
- name: Install Morty
run: |
curl --proto '=https' --tlsv1.2 -sLO https://github.com/pulp-platform/morty/releases/download/v0.8.0/morty-ubuntu.22.04-x86_64.tar.gz
tar -xvf morty-ubuntu.22.04-x86_64.tar.gz morty
rm -f morty-ubuntu.22.04-x86_64.tar.gz
run: make morty
- name: Build Doc
run: make doc
- name: Pickle
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ sources*.txt
pickle
doc/morty*
bender
morty*
16 changes: 12 additions & 4 deletions Bender.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
packages:
axi:
revision: 9a53b3c66d32725e5c5656b02e1caf07c5f79a97
version: 0.37.0
revision: af8b0ce2653997301b1b792c4c6d207b95f63a56
version: 0.39.0-beta.2
source:
Git: https://github.com/pulp-platform/axi.git
dependencies:
Expand All @@ -17,11 +17,19 @@ packages:
- common_verification
- tech_cells_generic
common_verification:
revision: 5def6fee3f010b603357d7b941661892aeafcc5d
version: 0.2.2
revision: 9c07fa860593b2caabd9b5681740c25fac04b878
version: 0.2.3
source:
Git: https://github.com/pulp-platform/common_verification.git
dependencies: []
register_interface:
revision: 9fc63015615acb11111e4bc3e858381e3e72405d
version: 0.3.6
source:
Git: https://github.com/pulp-platform/register_interface.git
dependencies:
- axi
- common_cells
tech_cells_generic:
revision: e6226a6f374eb88fed84d4989bb3f066cb470f33
version: 0.2.9
Expand Down
11 changes: 9 additions & 2 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,27 @@ package:
- "Wolfgang Roenninger <wroennin@ethz.ch>"

dependencies:
axi: { git: "https://github.com/pulp-platform/axi.git", version: 0.37.0 }
axi: { git: "https://github.com/pulp-platform/axi.git", version: 0.39.0-beta.2 }
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.21.0 }
common_verification: { git: "https://github.com/pulp-platform/common_verification.git", version: 0.2.0 }
register_interface: { git: "https://github.com/pulp-platform/register_interface.git", version: 0.3.6 }
tech_cells_generic: { git: "https://github.com/pulp-platform/tech_cells_generic.git", version: 0.2.9 }

export_include_dirs:
- include

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
- src/axi_llc_demux.sv
- src/axi_llc_pkg.sv
- src/axi_llc_burst_cutter.sv
- src/axi_llc_data_way.sv
- src/axi_llc_merge_unit.sv
- src/axi_llc_read_unit.sv
- src/axi_llc_reg_pkg.sv
- src/axi_llc_reg_top.sv
- src/axi_llc_write_unit.sv
- src/eviction_refill/axi_llc_ax_master.sv
- src/eviction_refill/axi_llc_r_master.sv
Expand All @@ -44,6 +49,8 @@ sources:
- src/axi_llc_hit_miss.sv
# Level 3
- src/axi_llc_top.sv
# Level 4
- src/axi_llc_reg_wrap.sv


- target: test
Expand Down
28 changes: 27 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# Author: Thomas Benz <tbenz@iis.ee.ethz.ch>

BENDER ?= bender
PYTHON ?= python3

REGGEN_PATH = $(shell $(BENDER) path register_interface)/vendor/lowrisc_opentitan/util/regtool.py
REGGEN = $(PYTHON) $(REGGEN_PATH)

.PHONY: all clean

Expand All @@ -29,12 +33,20 @@ help:
@echo "pickle: uses morty to generate a pickled version of the hardware"
@echo "doc: generates the documentation in doc/morty"
@echo "graph: generates the module hierarchy graph in doc/morty-graph"
@echo "regs: generates the RegBus compatible register file"
@echo ""
@echo "clean: cleans generated files"
@echo "nuke: cleans all generated file, also almost all files checked in"
@echo ""


# --------------
# Registers
# --------------

regs:
$(REGGEN) -r --outdir src/ data/axi_llc_regs.hjson
$(REGGEN) --cdefines --outfile sw/include/axi_llc_regs.h data/axi_llc_regs.hjson

# --------------
# QuestaSim
Expand Down Expand Up @@ -193,6 +205,20 @@ bender-rm:
rm -f bender


.PHONY: morty-rm

morty:
ifeq (,$(wildcard ./morty))
mkdir -p morty-dl
cd morty-dl; wget https://github.com/pulp-platform/morty/releases/download/v0.8.0/morty-centos.7.9.2009-x86_64.tar.gz
cd morty-dl; tar -xvf morty-centos.7.9.2009-x86_64.tar.gz; rm -f morty-centos.7.9.2009-x86_64.tar.gz
mv morty-dl/morty .; rm -rf morty-dl
endif

morty-rm:
rm -f morty


# --------------
# Misc Clean
# --------------
Expand All @@ -205,5 +231,5 @@ misc_clean:
rm -f open_todos.txt
rm -f gmon.out

nuke: clean
nuke: clean morty-rm bender-rm
rm -rf .bender
158 changes: 158 additions & 0 deletions data/axi_llc_regs.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
// Copyright 2018-2021 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
//
// Authors:
// Nicole Narr <narrn@ethz.ch>
// Christopher Reinwardt <creinwar@ethz.ch>



{
name: "axi_llc",
clock_primary: "clk_i",
bus_interfaces: [
{ protocol: "reg_iface", direction: "device" }
],
regwidth: 32,
registers: [

{ name: "CFG_SPM_LOW",
desc: "SPM Configuration (lower 32 bit)",
swaccess: "rw",
hwaccess: "hrw",
fields: [
{bits: "31:0", resval: 0, name: "low", desc: "lower 32 bit"}
]
},
{ name: "CFG_SPM_HIGH",
desc: "SPM Configuration (upper 32 bit)",
swaccess: "rw",
hwaccess: "hrw",
fields: [
{bits: "31:0", name: "high", desc: "upper 32 bit"}
]
},
{ name: "CFG_FLUSH_LOW",
desc: "Flush Configuration (lower 32 bit)",
swaccess: "rw",
hwaccess: "hrw",
fields: [
{bits: "31:0", name: "low", desc: "lower 32 bit"}
]
},
{ name: "CFG_FLUSH_HIGH",
desc: "Flush Configuration (upper 32 bit)",
swaccess: "rw",
hwaccess: "hrw",
fields: [
{bits: "31:0", name: "high", desc: "upper 32 bit"}
]
},
{ name: "COMMIT_CFG",
desc: "Commit the configuration",
swaccess: "rw1s",
hwaccess: "hrw",
fields: [
{bits: "0", name: "commit", desc: "commit configuration"}
]
},
{skipto: "0x18"}
{ name: "FLUSHED_LOW",
desc: "Flushed Flag (lower 32 bit)",
swaccess: "ro",
hwaccess: "hrw",
fields: [
{bits: "31:0", name: "low", desc: "lower 32 bit"}
]
},
{ name: "FLUSHED_HIGH",
desc: "Flushed Flag (upper 32 bit)",
swaccess: "ro",
hwaccess: "hrw",
fields: [
{bits: "31:0", name: "high", desc: "upper 32 bit"}
]
},
{ name: "BIST_OUT_LOW",
desc: "Tag Storage BIST Result (lower 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "low", desc: "lower 32 bit"}
]
},
{ name: "BIST_OUT_HIGH",
desc: "Tag Storage BIST Result (upper 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "high", desc: "upper 32 bit"}
]
},
{ name: "SET_ASSO_LOW",
desc: "Instantiated Set-Associativity (lower 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "low", desc: "lower 32 bit"}
]
},
{ name: "SET_ASSO_HIGH",
desc: "Instantiated Set-Associativity (upper 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "high", desc: "upper 32 bit"}
]
},
{ name: "NUM_LINES_LOW",
desc: "Instantiated Number of Cache-Lines (lower 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "low", desc: "lower 32 bit"}
]
},
{ name: "NUM_LINES_HIGH",
desc: "Instantiated Number of Cache-Lines (upper 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "high", desc: "upper 32 bit"}
]
},
{ name: "NUM_BLOCKS_LOW",
desc: "Instantiated Number of Blocks (lower 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "low", desc: "lower 32 bit"}
]
},
{ name: "NUM_BLOCKS_HIGH",
desc: "Instantiated Number of Blocks (upper 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "high", desc: "upper 32 bit"}
]
},
{ name: "VERSION_LOW",
desc: "AXI LLC Version (lower 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "low", desc: "lower 32 bit"}
]
},
{ name: "VERSION_HIGH",
desc: "AXI LLC Version (upper 32 bit)",
swaccess: "ro",
hwaccess: "hwo",
fields: [
{bits: "31:0", name: "high", desc: "upper 32 bit"}
]
}
]
}
44 changes: 44 additions & 0 deletions include/axi_llc/assign.svh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2022 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
//
// Authors:
// - Nicole Narr <narrn@ethz.ch>
// - Christopher Reinwardt <creinwar@ethz.ch>
// Date: 17.11.2022

// Macros to connect AXI_LLC config registers

`ifndef AXI_LLC_ASSIGN_SVH_
`define AXI_LLC_ASSIGN_SVH_

// Assign the regtool RegBus 32-bit HW2REG _low, _high and enable signals from the
// 64-bit d_struct member with the same name
`define AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, member) \
assign regbus.member``_low.d = d_struct.member; \
assign regbus.member``_low.de = d_struct.member``_en; \
assign regbus.member``_high.d = d_struct.member >> 32; \
assign regbus.member``_high.de = d_struct.member``_en;

// Assign the regtool RegBus HW2REG struct from a d_struct
`define AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D(regbus, d_struct) \
`AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, cfg_spm) \
`AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, cfg_flush) \
assign regbus.commit_cfg.d = d_struct.commit_cfg; \
assign regbus.commit_cfg.de = d_struct.commit_cfg_en; \
`AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, flushed) \
`AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, bist_out) \
`AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, set_asso) \
`AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, num_lines) \
`AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, num_blocks) \
`AXI_LLC_ASSIGN_REGBUS_FROM_REGS_D_MEMBER(regbus, d_struct, version)

// Assign the 64-bit q_struct values from the corresponding 32-bit _low and _high
// REG2HW signals
`define AXI_LLC_ASSIGN_REGS_Q_FROM_REGBUS(q_struct, regbus) \
assign q_struct.cfg_spm = {regbus.cfg_spm_high.q, regbus.cfg_spm_low.q}; \
assign q_struct.cfg_flush = {regbus.cfg_flush_high.q, regbus.cfg_flush_low.q}; \
assign q_struct.commit_cfg = regbus.commit_cfg.q; \
assign q_struct.flushed = {regbus.flushed_high.q, regbus.flushed_low.q};

`endif
Loading

0 comments on commit aa42cd6

Please sign in to comment.