Skip to content

Commit

Permalink
CVA6: Extend CVA6 system wrapper to include 2D support
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Alessandro Ottaviano <aottaviano@iis.ee.ethz.ch>
  • Loading branch information
thommythomaso and alex96295 committed Sep 14, 2023
1 parent 437ffa9 commit 1876e2e
Show file tree
Hide file tree
Showing 10 changed files with 1,508 additions and 59 deletions.
8 changes: 8 additions & 0 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ sources:
# Level 2
- src/frontends/register_64bit/idma_reg64_frontend.sv

- files: # 2D 64bit register frontend
# Level 0
- src/frontends/register_64bit_2d/idma_reg64_2d_frontend_reg_pkg.sv
# Level 1
- src/frontends/register_64bit_2d/idma_reg64_2d_frontend_reg_top.sv
# Level 2
- src/frontends/register_64bit_2d/idma_reg64_2d_frontend.sv

- files: # 64bit descriptor frontend
# Level 0
- src/frontends/desc64/idma_desc64_reg_pkg.sv
Expand Down
24 changes: 21 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,14 @@ REG32_2D_FE_DIR = src/frontends/register_32bit_2d/
REG32_2D_HJSON = $(REG32_2D_FE_DIR)/idma_reg32_2d_frontend.hjson
REG64_FE_DIR = src/frontends/register_64bit/
REG64_HJSON = $(REG64_FE_DIR)/idma_reg64_frontend.hjson
REG64_2D_FE_DIR = src/frontends/register_64bit_2d/
REG64_2D_HJSON = $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend.hjson
DESC64_FE_DIR = src/frontends/desc64/
DESC64_HJSON = $(DESC64_FE_DIR)/idma_desc64_frontend.hjson

REG_HTML_STRING = "<!DOCTYPE html>\n<html>\n<head>\n<link rel="stylesheet" href="reg_html.css">\n</head>\n"

gen_regs: reg32_2d_regs reg64_regs desc64_regs
gen_regs: reg32_2d_regs reg64_regs desc64_regs reg64_2d_regs

reg32_2d_regs:
$(PYTHON) $(REG_TOOL) $(REG32_2D_HJSON) -t $(REG32_2D_FE_DIR) -r
Expand All @@ -306,6 +308,14 @@ reg64_regs:
printf "</html>\n" >> $(REG64_FE_DIR)/idma_reg64_frontend.html
cp $(REG_PATH)/vendor/lowrisc_opentitan/util/reggen/reg_html.css $(REG64_FE_DIR)

reg64_2d_regs:
$(PYTHON) $(REG_TOOL) $(REG64_2D_HJSON) -t $(REG64_2D_FE_DIR) -r
$(PYTHON) $(REG_TOOL) $(REG64_2D_HJSON) -D > $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend.h
printf $(REG_HTML_STRING) > $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend.html
$(PYTHON) $(REG_TOOL) $(REG64_2D_HJSON) -d >> $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend.html
printf "</html>\n" >> $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend.html
cp $(REG_PATH)/vendor/lowrisc_opentitan/util/reggen/reg_html.css $(REG64_2D_FE_DIR)

desc64_regs:
$(PYTHON) $(REG_TOOL) $(DESC64_HJSON) -t $(DESC64_FE_DIR) -r
$(PYTHON) $(REG_TOOL) $(DESC64_HJSON) -D > $(DESC64_FE_DIR)/idma_desc64_frontend.h
Expand All @@ -318,12 +328,20 @@ regs_clean:
rm -f $(REG32_2D_FE_DIR)/idma_reg32_2d_frontend.h
rm -f $(REG32_2D_FE_DIR)/idma_reg32_2d_frontend_reg_pkg.sv
rm -f $(REG32_2D_FE_DIR)/idma_reg32_2d_frontend_reg_top.sv
rm -f $(REG32_2D_FE_DIR)/idma_reg32_2d_frontend.html
rm -f $(REG32_2D_FE_DIR)/reg_html.css
rm -f $(REG64_FE_DIR)/idma_reg64_frontend.h
rm -f $(REG64_FE_DIR)/idma_reg32_frontend_reg_pkg.sv
rm -f $(REG64_FE_DIR)/idma_reg32_frontend_reg_top.sv
rm -f $(REG64_FE_DIR)/idma_reg64_frontend_reg_pkg.sv
rm -f $(REG64_FE_DIR)/idma_reg64_frontend_reg_top.sv
rm -f $(REG64_FE_DIR)/idma_reg64_frontend.html
rm -f $(REG64_FE_DIR)/reg_html.css
rm -f $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend.h
rm -f $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend_reg_pkg.sv
rm -f $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend_reg_top.sv
rm -f $(REG64_2D_FE_DIR)/idma_reg64_2d_frontend.html
rm -f $(REG64_2D_FE_DIR)/reg_html.css
rm -f $(DESC64_FE_DIR)/idma_desc64_frontend.h
rm -f $(DESC64_FE_DIR)/idma_desc64_reg_pkg.sv
rm -f $(DESC64_FE_DIR)/idma_desc64_reg_top.sv
rm -f $(DESC64_FE_DIR)/idma_desc64_frontend.html
rm -f $(DESC64_FE_DIR)/reg_html.css
57 changes: 57 additions & 0 deletions src/frontends/register_64bit_2d/idma_reg64_2d_frontend.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Generated register defines for idma_reg64_2d_frontend

// Copyright information found in source file:
// Copyright 2022 ETH Zurich and University of Bologna.

// Licensing information found in source file:
// Licensed under Solderpad Hardware License, Version 0.51
// SPDX-License-Identifier: SHL-0.51

#ifndef _IDMA_REG64_2D_FRONTEND_REG_DEFS_
#define _IDMA_REG64_2D_FRONTEND_REG_DEFS_

#ifdef __cplusplus
extern "C" {
#endif
// Register width
#define IDMA_REG64_2D_FRONTEND_PARAM_REG_WIDTH 64

// Source Address
#define IDMA_REG64_2D_FRONTEND_SRC_ADDR_REG_OFFSET 0x0

// Destination Address
#define IDMA_REG64_2D_FRONTEND_DST_ADDR_REG_OFFSET 0x8

// Number of bytes
#define IDMA_REG64_2D_FRONTEND_NUM_BYTES_REG_OFFSET 0x10

// Configuration Register for DMA settings
#define IDMA_REG64_2D_FRONTEND_CONF_REG_OFFSET 0x18
#define IDMA_REG64_2D_FRONTEND_CONF_DECOUPLE_BIT 0
#define IDMA_REG64_2D_FRONTEND_CONF_DEBURST_BIT 1
#define IDMA_REG64_2D_FRONTEND_CONF_SERIALIZE_BIT 2

// DMA Status
#define IDMA_REG64_2D_FRONTEND_STATUS_REG_OFFSET 0x20
#define IDMA_REG64_2D_FRONTEND_STATUS_BUSY_BIT 0

// Next ID, launches transfer, returns 0 if transfer not set up properly.
#define IDMA_REG64_2D_FRONTEND_NEXT_ID_REG_OFFSET 0x28

// Get ID of finished transactions.
#define IDMA_REG64_2D_FRONTEND_DONE_REG_OFFSET 0x30

// Source Stride
#define IDMA_REG64_2D_FRONTEND_STRIDE_SRC_REG_OFFSET 0x38

// Destination Stride
#define IDMA_REG64_2D_FRONTEND_STRIDE_DST_REG_OFFSET 0x40

// Number of 2D repetitions
#define IDMA_REG64_2D_FRONTEND_NUM_REPETITIONS_REG_OFFSET 0x48

#ifdef __cplusplus
} // extern "C"
#endif
#endif // _IDMA_REG64_2D_FRONTEND_REG_DEFS_
// End generated register defines for idma_reg64_2d_frontend
142 changes: 142 additions & 0 deletions src/frontends/register_64bit_2d/idma_reg64_2d_frontend.hjson
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// Copyright 2022 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
// Licensed under Solderpad Hardware License, Version 0.51

{
name: "idma_reg64_2d_frontend",
clock_primary: "clk_i",
reset_primary: "rst_ni",
bus_interfaces: [
{ protocol: "reg_iface",
direction: "device"
}
],
regwidth: "64",
registers: [
{ name: "src_addr",
desc: "Source Address",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "63:0",
name: "src_addr",
desc: "Source Address"
}
]
},
{ name: "dst_addr",
desc: "Destination Address",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "63:0",
name: "dst_addr",
desc: "Destination Address"
}
]
},
{ name: "num_bytes",
desc: "Number of bytes",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "63:0",
name: "num_bytes",
desc: "Number of bytes"
}
]
},
{ name: "conf",
desc: "Configuration Register for DMA settings",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "0",
name: "decouple",
desc: "Decouple enable"
},
{ bits: "1",
name: "deburst",
desc: "Deburst enable"
},
{ bits: "2",
name: "serialize",
desc: "Serialize enable"
}
]
},
{ name: "status",
desc: "DMA Status",
swaccess: "ro",
hwaccess: "hwo",
hwext: "true",
fields: [
{ bits: "0",
name: "busy",
desc: "DMA busy"
}
]
},
{ name: "next_id",
desc: "Next ID, launches transfer, returns 0 if transfer not set up properly.",
swaccess: "ro",
hwaccess: "hrw",
hwext: "true",
hwre: "true",
fields: [
{ bits: "63:0",
name: "next_id",
desc: "Next ID, launches transfer, returns 0 if transfer not set up properly."
}
]
},
{ name: "done",
desc: "Get ID of finished transactions.",
swaccess: "ro",
hwaccess: "hrw",
hwext: "true",
hwre: "true",
fields: [
{ bits: "63:0",
name: "done",
desc: "Get ID of finished transactions."
}
]
},
{ name: "stride_src",
desc: "Source Stride",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "63:0",
name: "stride_src",
desc: "Source Stride"
}
]
},
{ name: "stride_dst"
desc: "Destination Stride",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "63:0",
name: "stride_dst",
desc: "Destination Stride"
}
]
},
{ name: "num_repetitions"
desc: "Number of 2D repetitions",
swaccess: "rw",
hwaccess: "hro",
fields: [
{ bits: "63:0",
name: "num_repetitions",
desc: "Number of 2D repetitions",
resval: "0"
}
]
}
]
}
Loading

0 comments on commit 1876e2e

Please sign in to comment.