From 5510f7594f5e676feedbd216a6cd51029ae7eff1 Mon Sep 17 00:00:00 2001 From: Yvan Tortorella Date: Mon, 15 Apr 2024 18:19:54 +0200 Subject: [PATCH] First transparent streamer integration. --- Bender.lock | 2 +- Bender.yml | 6 +- bender-common.mk | 2 +- carfield.mk | 2 +- hw/carfield.sv | 116 ++++++++++++++++++ hw/carfield_pkg.sv | 22 +++- ..._l2dual_secure_pulp_periph_can_streamer.sv | 95 ++++++++++++++ target/sim/sim.mk | 1 + 8 files changed, 239 insertions(+), 7 deletions(-) create mode 100644 hw/configs/carfield_l2dual_secure_pulp_periph_can_streamer.sv diff --git a/Bender.lock b/Bender.lock index d1c08d0e4..5941f8c94 100644 --- a/Bender.lock +++ b/Bender.lock @@ -499,7 +499,7 @@ packages: - riscv-dbg - tech_cells_generic streamer: - revision: 83db53a8017c630f1c8bdc358d88b27067c01e56 + revision: 41c90f7c525f45539afaa3387e3975c6e785a243 version: null source: Git: git@gitlab.thalesdigital.io:musa/streamer.git diff --git a/Bender.yml b/Bender.yml index 5b25b4026..2fbb1aa88 100644 --- a/Bender.yml +++ b/Bender.yml @@ -28,7 +28,7 @@ dependencies: common_cells: { git: https://github.com/pulp-platform/common_cells.git, version: 1.31.1 } pulp-ethernet: { git: https://github.com/pulp-platform/pulp-ethernet.git, rev: bdc8031ab270a49da28df269266ce9ab9a133636 } # branch: carfield riscv-dbg: { git: https://github.com/pulp-platform/riscv-dbg.git, version: =0.8.0 } - streamer: { git: git@gitlab.thalesdigital.io:musa/streamer.git, rev: 83db53a8 } # branch: tech_lib_organization + streamer: { git: git@gitlab.thalesdigital.io:musa/streamer.git, rev: 41c90f7c } # branch: yt/integration workspace: package_links: @@ -40,6 +40,10 @@ workspace: sources: # Configurations + - target: carfield_l2dual_secure_pulp_periph_can_streamer + files: + - hw/configs/carfield_l2dual_secure_pulp_periph_can_streamer.sv + - target: carfield_l2dual_safe_secure_pulp_spatz_periph_can files: - hw/configs/carfield_l2dual_safe_secure_pulp_spatz_periph_can.sv diff --git a/bender-common.mk b/bender-common.mk index 131001956..5a282fc51 100644 --- a/bender-common.mk +++ b/bender-common.mk @@ -6,7 +6,7 @@ # Author: Matteo Perotti # Runtime-selectable Carfield configuration -CARFIELD_CONFIG ?= carfield_l2dual_secure_pulp_periph_can +CARFIELD_CONFIG ?= carfield_l2dual_secure_pulp_periph_can_streamer # bender targets common_targs += -t cva6 diff --git a/carfield.mk b/carfield.mk index 4bbc70a3b..3466e10cd 100644 --- a/carfield.mk +++ b/carfield.mk @@ -20,7 +20,7 @@ CAR_ROOT ?= $(shell $(BENDER) path carfield) CAR_HW_DIR := $(CAR_ROOT)/hw CAR_SW_DIR := $(CAR_ROOT)/sw -CAR_TGT_DIR := $(CAR_ROOT)/target/ +CAR_TGT_DIR := $(CAR_ROOT)/target CAR_XIL_DIR := $(CAR_TGT_DIR)/xilinx CAR_SIM_DIR := $(CAR_TGT_DIR)/sim SECD_ROOT ?= $(shell $(BENDER) path opentitan) diff --git a/hw/carfield.sv b/hw/carfield.sv index c8488cc60..5c57fa910 100644 --- a/hw/carfield.sv +++ b/hw/carfield.sv @@ -2497,6 +2497,122 @@ if (CarfieldIslandsCfg.periph.enable) begin: gen_periph // Handle with care... assign can_tx_o = '0; assign apb_mst_rsp[CanIdx] = '0; end + + // Telemetry and Telecomand IP (Streamer) + if (carfield_configuration::StreamerEnable) begin: gen_streamer + localparam int unsigned StreamerAsyncIdx = CarfieldRegBusSlvIdx.streamer-NumSyncRegSlv; + TASI_top ( + .SYS_CLK (periph_clk), + .ASYNC_RST_N (periph_rst_n), // FIXME: connect to dedicated one + .APB_PADD (apb_mst_req[StreamerIdx].paddr), // : in -- APB + .APB_PENABLE (apb_mst_req[StreamerIdx].penable), // : in -- APB + .APB_PPROT (3'b0), // : in -- APB + .APB_PSEL (apb_mst_req[StreamerIdx].psel), // : in -- APB + .APB_PSTROBE (4'b1), // : in -- APB + .APB_PWDATA (apb_mst_req[StreamerIdx].pwdata), // : in -- APB + .APB_PWRITE (apb_mst_req[StreamerIdx].pwrite), // : in -- APB + .APB_PRDATA (apb_mst_rsp[StreamerIdx].prdata), // : out -- APB + .APB_PREADY (apb_mst_rsp[StreamerIdx].pready), // : out -- APB + .APB_PSLVERR (apb_mst_rsp[StreamerIdx].pslverr), // : out -- APB + .REG_ADDR (ext_reg_async_slv_data_out[StreamerAsyncIdx].addr[31:0]), // : in -- REG IF + .REG_M_ID (3'b001), // : in std_logic_vector (2 downto 0); -- REG IF + .REG_VALID (ext_reg_async_slv_data_out[StreamerAsyncIdx].valid), // : in -- REG IF + .REG_WDATA (ext_reg_async_slv_data_out[StreamerAsyncIdx].wdata), // : in -- REG IF + .REG_WRITE (ext_reg_async_slv_data_out[StreamerAsyncIdx].write), // : in -- REG IF + .REG_RDATA (ext_reg_async_slv_data_in[StreamerAsyncIdx].rdata), // : out -- REG IF + .REG_READY (ext_reg_async_slv_data_in[StreamerAsyncIdx].ready), // : out -- REG IF + .AUEND_SDU (1'b0), // : in -- Connetti a '0' + .AUR_SDU (1'b0), // : in -- Connetti a '0' + .BIT_LOCKn (3'b0), // : in -- Connetti a '0' + .BUFFER_BUSY_SET (1'b0), // : in -- Da pilotare per mandare HPC/LLC dopo averli scritti in APB + .CLCW_C_B (1'b0), // : in -- Connetti a '0' + .CLCW_S_B (1'b0), // : in -- Connetti a '0' + .CONF_REG_ACC_ACK (1'b1), // : in -- Era un'interfaccia interna che ora va semplificata, connetti a '1' + .CPDU_INPROGRESS (1'b0), // : in -- Connetti a '0' + .EXT_OBT_CLK (1'b0), // : in -- Pin previsto per l'ASIC finale, ora lascia pure a '0' + .HPC_LLC_CTRL_REG (32'b0), // : in -- Da pilotare, valore costante + .INT_PPS_IN (1'b0), // : in -- Pin previsto per l'ASIC finale, ora lascia pure a '0' + .RFAVN (1'b0), // : in -- Connetti a '0' + .SDU_WRONG_LENGTH (1'b0), // : in -- Connetti a '0' + .SYNC_RST_N (1'b1), // : in -- Reset sincrono col sys_clk + .TC_ACTIVE (1'b0), // : in -- TC interface, pin dell'ASIC + .TC_CLOCK (1'b0), // : in -- TC interface, pin dell'ASIC + .TC_DATA (1'b0), // : in -- TC interface, pin dell'ASIC + .TME_CLCW_FSR_DAT_FROM_REM_PDEC_SEC (1'b0), // : in -- Connetti a '0' + .TME_ENCR_UNENC_CLK (1'b0), // : in -- Connetti a '0' + .TME_ENCR_UNENC_OUT (1'b0), // : in -- Connetti a '0' + .TME_ENCR_UNENC_SYNC (1'b0), // : in -- Connetti a '0' + .TME_FSR_DAT_FROM_LOC_SEC (1'b0), // : in -- Connetti a '0' + .ANACOND_LLC_RESET (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .AUTH_SEL (/* Not Connected */), // : out -- Lascia open + .BUSY (/* Not Connected */), // : out -- Da usare come info per mandare HPC/LLC dopo + // averli scritti in APB, al momento lascia pure open + .CADUFrameMark (/* Not Connected */), // : out -- Lascia open + .CLCWD_B (/* Not Connected */), // : out -- Lascia open + .CONF_REG_ACC_REQ (/* Not Connected */), // : out -- Era un'interfaccia interna che ora va semplificata, + // lascia open + .CONF_REG_ADDR_OFFSET (/* Not Connected */), // : out -- Era un'interfaccia interna che ora va semplificata, + // lascia open + .CONF_REG_GROUP_ADDR (/* Not Connected */), // : out -- Era un'interfaccia interna che ora va semplificata, + // lascia open + .CONF_REG_WDATA (/* Not Connected */), // : out -- Era un'interfaccia interna che ora va semplificata, + // lascia open + .CROSSED_LCL_RESET (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .CROSSED_POWER_REARM_OUT (/* Not Connected */), // : out -- Lascia open + .CROSSED_RESET_OUT (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .FPEMO (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .FPRELM (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .HPC_ADDR (/* Not Connected */), // : out -- ASIC out pin, lascia pure open + .HPC_CMD_EN (/* Not Connected */), // : out -- ASIC out pin, lascia pure open + .HPC_INTERRUPT_SOURCES (/* Not Connected */), // : out -- Collezione di interrupt, lascia open + .HPC_PROTECTIONn (/* Not Connected */), // : out -- ASIC out pin, lascia pure open + .HPC_SMP (/* Not Connected */), // : out -- ASIC out pin, lascia pure open + .INH_MMA (/* Not Connected */), // : out -- Lascia open + .LLC_INTERRUPT_SOURCES (/* Not Connected */), // : out -- Collezione di interrupt, lascia open + .LLC_IRQ_FORCE_REGISTER (/* Not Connected */), // : out -- Lascia open + .LOC_AOCS_LCL_PRI_BUS_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .LOC_AOCS_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .LOC_HK_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .LOC_IO_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .LOC_MCPM_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .LOC_MCPM_RESET (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .LVDS_IF_TME_ENC_IOUT (/* Not Connected */), // : out -- Lascia open + .LVDS_IF_TME_ENC_IQCLK (/* Not Connected */), // : out -- Lascia open + .LVDS_IF_TME_ENC_QOUT (/* Not Connected */), // : out -- Lascia open + .PP0Busy_N (/* Not Connected */), // : out -- Lascia open + .PP1Busy_N (/* Not Connected */), // : out -- Lascia open + .PP2Busy_N (/* Not Connected */), // : out -- Lascia open + .PP3Busy_N (/* Not Connected */), // : out -- Lascia open + .PP4Busy_N (/* Not Connected */), // : out -- Lascia open + .PP5Busy_N (/* Not Connected */), // : out -- Lascia open + .PP6Busy_N (/* Not Connected */), // : out -- Lascia open + .PPS_OUT (/* Not Connected */), // : out -- Pin previsto per l'ASIC finale, ora lascia pure open + .REM_AOCS_LCL_PRI_BUS_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .REM_AOCS_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .REM_HK_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .REM_IO_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .REM_MCPM_ON_OFFn (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .RM_RECOVERY_RESET (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .RM_RESET (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .RS422_IF_TME_ENC_CLK (/* Not Connected */), // : out -- Connetti a ASIC pin + .RS422_IF_TME_ENC_OUT (/* Not Connected */), // : out -- Connetti a ASIC pin + .RS422_IF_TME_ENC_SYNC (/* Not Connected */), // : out -- Connetti a ASIC pin + .SYNC_TO_EXT_IF (/* Not Connected */), // : out -- Pin previsto per l'ASIC finale, ora lascia pure open + .TC_ONDOING (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .TC_STANDARD (/* Not Connected */), // : out -- IF da semplificare, lascia pure open + .TME_CLR_UNENC_CLK (/* Not Connected */), // : out -- Lascia open + .TME_CLR_UNENC_EODF_TO_ADAM (/* Not Connected */), // : out -- Lascia open + .TME_CLR_UNENC_EODF_TO_EXT (/* Not Connected */), // : out -- Lascia open + .TME_CLR_UNENC_OUT (/* Not Connected */), // : out -- Lascia open + .TME_CLR_UNENC_SYNC (/* Not Connected */), // : out -- Lascia open + .TME_Cn_S (/* Not Connected */), // : out -- Lascia open + .TME_REM_CLCWn_FSR_SEL (/* Not Connected */), // : out -- Lascia open + .TME_TIME_STROBE_TO_REM_OBT (/* Not Connected */), // : out -- Lascia open + .TME_UNENC_SYNC (/* Not Connected */) // : out -- Lascia open + ); + assign ext_reg_async_slv_data_in[StreamerAsyncIdx].error = '0; + end else begin: gen_no_streamer + end end else begin: gen_no_periph assign car_regs_hw2reg.periph_isolate_status.d = '0; assign car_regs_hw2reg.periph_isolate_status.de = '0; diff --git a/hw/carfield_pkg.sv b/hw/carfield_pkg.sv index f3fd6fe91..255d507e1 100644 --- a/hw/carfield_pkg.sv +++ b/hw/carfield_pkg.sv @@ -211,6 +211,7 @@ typedef struct packed { islands_properties_t pll; islands_properties_t padframe; islands_properties_t l2ecc; + islands_properties_t streamer; } regbus_cfg_t; typedef struct packed { @@ -218,6 +219,7 @@ typedef struct packed { byte_bt pll; byte_bt padframe; byte_bt l2ecc; + byte_bt streamer; } carfield_regbus_slave_idx_t; // Generate the number of AXI slave devices to be connected to the @@ -233,6 +235,7 @@ function automatic int unsigned gen_num_regbus_async_slave(regbus_cfg_t regbus_c if (regbus_cfg.pll.enable ) begin ret++; end if (regbus_cfg.padframe.enable) begin ret++; end if (regbus_cfg.l2ecc.enable ) begin ret++; end + if (regbus_cfg.streamer.enable) begin ret++; end return ret; endfunction @@ -240,7 +243,8 @@ localparam regbus_cfg_t CarfieldRegBusCfg = '{ pcrs: '{1, PcrsBase, PcrsSize}, pll: '{PllCfgEnable, PllCfgBase, PllCfgSize}, padframe: '{PadframeCfgEnable, PadframeCfgBase, PadframeCfgSize}, - l2ecc: '{L2EccCfgEnable, L2EccCfgBase, L2EccCfgSize} + l2ecc: '{L2EccCfgEnable, L2EccCfgBase, L2EccCfgSize}, + streamer: '{StreamerCfgEnable, StreamerCfgBase, StreamerCfgSize} }; localparam int unsigned NumSyncRegSlv = gen_num_regbus_sync_slave(CarfieldRegBusCfg); @@ -262,6 +266,8 @@ function automatic carfield_regbus_slave_idx_t carfield_gen_regbus_slave_idx(reg end else begin ret.padframe = NumTotalRegSlv + j; j++; end if (regbus_cfg.l2ecc.enable) begin ret.l2ecc = i; i++; end else begin ret.l2ecc = NumTotalRegSlv + j; j++; end + if (regbus_cfg.streamer.enable) begin ret.streamer = i; i++; + end else begin ret.streamer = NumTotalRegSlv + j; j++; end return ret; endfunction @@ -301,6 +307,12 @@ function automatic regbus_struct_t carfield_gen_regbus_map(int unsigned NumSlave ret.RegBusEnd[i] = regbus_cfg.l2ecc.base + regbus_cfg.l2ecc.size; if (i < NumSlave - 1) i++; end + if (regbus_cfg.streamer.enable) begin + ret.RegBusIdx[i] = idx.streamer; + ret.RegBusStart[i] = regbus_cfg.streamer.base; + ret.RegBusEnd[i] = regbus_cfg.streamer.base + regbus_cfg.streamer.size; + if (i < NumSlave - 1) i++; + end return ret; endfunction @@ -709,7 +721,8 @@ typedef enum int { AdvancedTimerIdx = 'd1, SystemWdtIdx = 'd2, CanIdx = 'd3, - HyperBusIdx = 'd4 + HyperBusIdx = 'd4, + StreamerIdx = 'd5 } carfield_peripherals_e; // Address map of peripheral system @@ -734,7 +747,10 @@ localparam carfield_addr_map_rule_t [NumApbMst-1:0] PeriphApbAddrMapRule = '{ end_addr: CanBase + CanSize }, // 4: Hyperbus '{ idx: HyperBusIdx, start_addr: HyperBusBase, - end_addr: HyperBusBase + HyperBusSize } + end_addr: HyperBusBase + HyperBusSize }, + // 5: Streamer + '{ idx: StreamerIdx, start_addr: StreamerApbBase, + end_addr: StreamerApbBase + StreamerApbSize } }; // Narrow reg types diff --git a/hw/configs/carfield_l2dual_secure_pulp_periph_can_streamer.sv b/hw/configs/carfield_l2dual_secure_pulp_periph_can_streamer.sv new file mode 100644 index 000000000..215dc1e72 --- /dev/null +++ b/hw/configs/carfield_l2dual_secure_pulp_periph_can_streamer.sv @@ -0,0 +1,95 @@ +// Copyright 2022 ETH Zurich and University of Bologna. +// Solderpad Hardware License, Version 0.51, see LICENSE for details. +// SPDX-License-Identifier: SHL-0.51 +// +// Yvan Tortorella + +package carfield_configuration; + +import cheshire_pkg::*; +/********************* + * AXI Configuration * + ********************/ +//L2, port 0 +localparam bit L2Port0Enable = 1; +localparam doub_bt L2Port0Base = 'h78000000; +localparam doub_bt L2Port0Size = 'h00200000; +// L2, port 1 +localparam bit L2Port1Enable = 1; +localparam doub_bt L2Port1Base = L2Port0Base + L2Port0Size; +localparam doub_bt L2Port1Size = L2Port0Size; +// Safety Island +localparam bit SafetyIslandEnable = 0; +localparam doub_bt SafetyIslandBase = 'h60000000; +localparam doub_bt SafetyIslandSize = 'h00800000; +// Ethernet +localparam bit EthernetEnable = 0; +localparam doub_bt EthernetBase = 'h20000000; +localparam doub_bt EthernetSize = 'h00001000; +// Peripherals +localparam bit PeriphEnable = 1; +localparam doub_bt PeriphBase = 'h20001000; +localparam doub_bt PeriphSize = 'h00009000; +// Spatz cluster +localparam bit SpatzClusterEnable = 0; +localparam doub_bt SpatzClusterBase = 'h51000000; +localparam doub_bt SpatzClusterSize = 'h00800000; +// PULP cluster +localparam bit PulpClusterEnable = 1; +localparam doub_bt PulpClusterBase = 'h50000000; +localparam doub_bt PulpClusterSize = 'h00800000; +// Security Island +localparam bit SecurityIslandEnable = 1; +localparam doub_bt SecurityIslandBase = 'h0; +localparam doub_bt SecurityIslandSize = 'h0; +// Mailbox +localparam bit MailboxEnable = 1; +localparam doub_bt MailboxBase = 'h40000000; +localparam doub_bt MailboxSize = 'h00001000; +/********************* + * APB Configuration * + ********************/ +// Can +localparam bit CanEnable = 1; +localparam doub_bt CanBase = 'h20001000; +localparam doub_bt CanSize = 'h00001000; +// Streamer +localparam bit StreamerEnable = 1; +localparam doub_bt StreamerApbBase = 'h20029000; +localparam doub_bt StreamerApbSize = 'h00008000; +// System Timer +localparam doub_bt SystemTimerBase = 'h20004000; +localparam doub_bt SystemTimerSize = 'h00001000; +// System Advanced Timer +localparam doub_bt SystemAdvancedTimerBase = 'h20005000; +localparam doub_bt SystemAdvancedTimerSize = 'h00001000; +// System Watchdog +localparam doub_bt SystemWatchdogBase = 'h20007000; +localparam doub_bt SystemWatchdogSize = 'h00001000; +// Hyperbus Config +localparam doub_bt HyperBusBase = 'h20009000; +localparam doub_bt HyperBusSize = 'h00001000; +/************************ + * RegBus Configuration * + ***********************/ +// Platform control registers +localparam doub_bt PcrsBase = 'h20010000; +localparam doub_bt PcrsSize = 'h00001000; +// PLL +localparam bit PllCfgEnable = 1; +localparam doub_bt PllCfgBase = 'h20020000; +localparam doub_bt PllCfgSize = 'h00001000; +// Padframe +localparam bit PadframeCfgEnable = 1; +localparam doub_bt PadframeCfgBase = 'h200A0000; +localparam doub_bt PadframeCfgSize = 'h00001000; +// L2 ECC +localparam bit L2EccCfgEnable = 1; +localparam doub_bt L2EccCfgBase = 'h200B0000; +localparam doub_bt L2EccCfgSize = 'h00001000; +// Streamer +localparam bit StreamerCfgEnable = StreamerEnable; +localparam doub_bt StreamerCfgBase = 'h20021000; +localparam doub_bt StreamerCfgSize = 'h00008000; + +endpackage diff --git a/target/sim/sim.mk b/target/sim/sim.mk index 4d9bc53d0..ebc600f9f 100644 --- a/target/sim/sim.mk +++ b/target/sim/sim.mk @@ -63,6 +63,7 @@ endif $(CAR_VSIM_DIR)/compile.carfield_soc.tcl: $(BENDER) script vsim $(common_targs) $(sim_targs) $(sim_defs) $(common_defs) $(safed_defs) --vlog-arg="$(RUNTIME_DEFINES)" --compilation-mode separate > $@ sed -i '2a\ + set VsimDir "$(CAR_VSIM_DIR)"\ set TCTMPATH "$(STREAMER_ROOT)"\ source $(STREAMER_ROOT)/astral.compile.tcl' $@ echo 'vlog "$(CHS_ROOT)/target/sim/src/elfloader.cpp" -ccflags "-std=c++11"' >> $@