Skip to content

Commit

Permalink
Initial idma integration
Browse files Browse the repository at this point in the history
requires pulp-platform/iDMA#47
not funtional due to pulp-platform/iDMA#48
  • Loading branch information
micprog committed Jun 21, 2024
1 parent 1cc316a commit 6213e7e
Show file tree
Hide file tree
Showing 7 changed files with 3,869 additions and 16 deletions.
35 changes: 27 additions & 8 deletions Bender.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ packages:
dependencies:
- common_cells
axi:
revision: fccffb5953ec8564218ba05e20adbedec845e014
version: 0.39.1
revision: 9402c8a9ce0a7b5253c3c29e788612d771e8b5d6
version: 0.39.3
source:
Git: https://github.com/pulp-platform/axi.git
dependencies:
Expand All @@ -33,6 +33,13 @@ packages:
- axi
- common_cells
- common_verification
axi_stream:
revision: 54891ff40455ca94a37641b9da4604647878cc07
version: 0.1.1
source:
Git: https://github.com/pulp-platform/axi_stream.git
dependencies:
- common_cells
clic:
revision: 3aa6f06eb03e6c74b6fead5b1d42318f49a3cf32
version: 3.0.0-rc1
Expand All @@ -42,8 +49,8 @@ packages:
- common_cells
- register_interface
common_cells:
revision: 2bd027cb87eaa9bf7d17196ec5f69864b35b630f
version: 1.32.0
revision: 0d67563b6b592549542544f1abc0f43e5d4ee8b4
version: 1.35.0
source:
Git: https://github.com/pulp-platform/common_cells.git
dependencies:
Expand Down Expand Up @@ -79,9 +86,21 @@ packages:
Git: https://github.com/pulp-platform/fpu_div_sqrt_mvp.git
dependencies:
- common_cells
idma:
revision: 95f366e56f7e772c283fb3c8b343afc4a3978375
version: 0.6.2
source:
Git: https://github.com/pulp-platform/idma.git
dependencies:
- axi
- axi_stream
- common_cells
- common_verification
- obi
- register_interface
obi:
revision: d04f1706ba5b7731bbc0a3a085e725e29fcc5b8e
version: 0.1.1
revision: 1aa411df145c4ebdd61f8fed4d003c33f7b20636
version: 0.1.2
source:
Git: https://github.com/pulp-platform/obi.git
dependencies:
Expand All @@ -98,8 +117,8 @@ packages:
- register_interface
- tech_cells_generic
register_interface:
revision: d7693be4aef1fc7e7eb2b00b41c42e87d959866c
version: 0.4.2
revision: ae616e5a1ec2b41e72d200e5ab09c65e94aebd3d
version: 0.4.4
source:
Git: https://github.com/pulp-platform/register_interface.git
dependencies:
Expand Down
3 changes: 3 additions & 0 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies:
obi: { git: "https://github.com/pulp-platform/obi.git", version: 0.1.1 }
unbent: { git: "https://github.com/pulp-platform/unbent.git", version: 0.1.6 }
axi_obi: { path: "future/axi_obi" }
idma: { git: "https://github.com/pulp-platform/idma.git", version: 0.6.2 }

sources:
# Level 1
Expand All @@ -35,11 +36,13 @@ sources:
files:
- rtl/safety_island_bootrom.sv
- rtl/cv32e40p_fpu_wrap.sv
- rtl/dma/safety_island_dma_generated.sv
- target: simulation
files:
- rtl/tb/tb_fs_handler.sv
- rtl/tb/riscv_pkg.sv
# Level 2
- rtl/dma/safety_island_dma.sv
- rtl/safety_core_wrap.sv
- rtl/soc_ctrl/safety_soc_ctrl_reg_top.sv
# Level 3
Expand Down
157 changes: 157 additions & 0 deletions rtl/dma/safety_island_dma.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
// Copyright 2024 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51

// Authors:
// - Michael Rogenmoser <michaero@iis.ee.ethz.ch>

`include "idma/typedef.svh"

module safety_island_dma import safety_island_pkg::*; #(
// parameter safety_island_cfg_t SafetyIslandCfg = safety_island_pkg::SafetyIslandDefaultConfig,
parameter type reg_req_t = logic,
parameter type reg_rsp_t = logic,

/// OBI Request and Response channel type
parameter obi_pkg::obi_cfg_t ObiCfg = obi_pkg::ObiDefaultConfig,
parameter type obi_a_chan_t = logic,
parameter type obi_req_t = logic,
parameter type obi_rsp_t = logic
) (
input logic clk_i,
input logic rst_ni,
input logic test_mode_i,

/// Register configuration ports
input reg_req_t reg_req_i,
output reg_rsp_t reg_rsp_o,

// OBI ports
output obi_req_t [1:0] obi_req_o,
input obi_rsp_t [1:0] obi_rsp_i
);

localparam int unsigned TFLenWidth = 24;

`IDMA_TYPEDEF_FULL_REQ_T(idma_req_t, logic[ObiCfg.IdWidth-1:0], logic[ObiCfg.AddrWidth-1:0], logic[TFLenWidth-1:0])
`IDMA_TYPEDEF_FULL_RSP_T(idma_rsp_t, logic[ObiCfg.AddrWidth-1:0])

typedef struct packed {
obi_a_chan_t a_chan;
logic [0:0] padding;
} obi_read_a_chan_padded_t;

typedef union packed {
obi_read_a_chan_padded_t obi;
} read_meta_channel_t;

typedef struct packed {
obi_a_chan_t a_chan;
logic [0:0] padding;
} obi_write_a_chan_padded_t;

typedef union packed {
obi_write_a_chan_padded_t obi;
} write_meta_channel_t;


idma_req_t backend_req;
idma_rsp_t backend_rsp;
logic backend_req_valid,
backend_req_ready,
backend_rsp_valid,
backend_rsp_ready;

logic backend_busy;

logic [31:0] next_id, completed_id;

// reg_frontend
idma_reg32_1d #(
.NumRegs ( 1 ),
.NumStreams ( 1 ),
.IdCounterWidth ( 32 ),
.reg_req_t ( reg_req_t ),
.reg_rsp_t ( reg_rsp_t ),
.dma_req_t ( idma_req_t )
) i_frontend (
.clk_i,
.rst_ni,
.dma_ctrl_req_i( reg_req_i ),
.dma_ctrl_rsp_o( reg_rsp_o ),
.dma_req_o ( backend_req ),
.req_valid_o ( backend_req_valid ),
.req_ready_i ( backend_req_ready ),
.next_id_i ( next_id ),
.stream_idx_o (),
.done_id_i ( completed_id ),
.busy_i ( backend_busy ),
.midend_busy_i ('0)
);

idma_transfer_id_gen #(
.IdWidth ( 32 )
) i_transfer_id_gen (
.clk_i,
.rst_ni,

.issue_i ( backend_req & frontend_req ),
.retire_i ( backend_rsp_valid ),
.next_o ( next_id ),
.completed_o( completed_id )
);

assign backend_rsp_ready = 1'b1;

// Backend
idma_backend_rw_obi #(
.DataWidth ( ObiCfg.DataWidth ),
.AddrWidth ( ObiCfg.AddrWidth ),
.UserWidth ( ObiCfg.OptionalCfg.AUserWidth ),
.AxiIdWidth ( ObiCfg.IdWidth ),
.NumAxInFlight ( 3 ),
.BufferDepth ( 3 ),
.TFLenWidth ( TFLenWidth ),
.MemSysDepth ( 3 ),
.CombinedShifter ( 1'b0 ),
.RAWCouplingAvail ( 1'b1 ),
.MaskInvalidData ( 1'b1 ),
.HardwareLegalizer ( 1'b1 ),
.RejectZeroTransfers ( 1'b1 ),
.ErrorCap ( idma_pkg::NO_ERROR_HANDLING ),
.PrintFifoInfo ( 1'b0 ),
.idma_req_t ( idma_req_t ),
.idma_rsp_t ( idma_rsp_t ),
.idma_eh_req_t ( idma_pkg::idma_eh_req_t ),
.idma_busy_t ( idma_pkg::idma_busy_t ),
.obi_req_t ( obi_req_t ),
.obi_rsp_t ( obi_rsp_t ),
.read_meta_channel_t ( read_meta_channel_t ),
.write_meta_channel_t( write_meta_channel_t )
) i_backend (
.clk_i,
.rst_ni,
.testmode_i ( test_mode_i ),

.idma_req_i ( backend_req ),
.req_valid_i ( backend_req_valid ),
.req_ready_o ( backend_req_ready ),

.idma_rsp_o ( backend_rsp ),
.rsp_valid_o ( backend_rsp_valid ),
.rsp_ready_i ( backend_rsp_ready ),

.idma_eh_req_i ( '0 ),
.eh_req_valid_i ( '0 ),
.eh_req_ready_o (),

.obi_read_req_o ( obi_req_o[0] ),
.obi_read_rsp_i ( obi_rsp_i[0] ),

.obi_write_req_o( obi_req_o[1] ),
.obi_write_rsp_i( obi_rsp_i[1] ),

.busy_o ( backend_busy )
);

endmodule
Loading

0 comments on commit 6213e7e

Please sign in to comment.