-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes: Various improvements and fixes
- Loading branch information
1 parent
6ad5695
commit 4456785
Showing
14 changed files
with
105 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,14 @@ | |
// Axel Vanoni <[email protected]> | ||
|
||
`include "common_cells/registers.svh" | ||
import idma_desc64_reg_pkg::idma_desc64_reg2hw_t; | ||
import idma_desc64_reg_pkg::idma_desc64_hw2reg_t; | ||
|
||
|
||
|
||
/// This module implements backpressure via ready/valid handshakes | ||
/// for the regbus registers and exposes it to the descriptor fifo | ||
module idma_desc64_reg_wrapper #( | ||
module idma_desc64_reg_wrapper | ||
import idma_desc64_reg_pkg::idma_desc64_reg2hw_t; | ||
import idma_desc64_reg_pkg::idma_desc64_hw2reg_t; #( | ||
parameter type reg_req_t = logic, | ||
parameter type reg_rsp_t = logic | ||
) ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
// Thomas Benz <[email protected]> | ||
|
||
`include "axi/typedef.svh" | ||
`include "idma/guard.svh" | ||
|
||
/// The iDMA backend implements an arbitrary 1D copy engine using the AXI4 protocol. | ||
module idma_backend #( | ||
|
@@ -478,7 +479,9 @@ module idma_backend #( | |
assign busy_o.eh_cnt_busy = 1'b0; | ||
|
||
end else begin : gen_param_error | ||
`IDMA_NONSYNTH_BLOCK( | ||
$fatal(1, "Unexpected Error Capability"); | ||
) | ||
end | ||
|
||
|
||
|
@@ -672,8 +675,7 @@ module idma_backend #( | |
//-------------------------------------- | ||
// Assertions | ||
//-------------------------------------- | ||
// pragma translate_off | ||
`ifndef VERILATOR | ||
`IDMA_NONSYNTH_BLOCK( | ||
initial begin : proc_assert_params | ||
axi_addr_width : assert(AddrWidth >= 32'd12) else | ||
$fatal(1, "Parameter `AddrWidth` has to be >= 12!"); | ||
|
@@ -693,7 +695,6 @@ module idma_backend #( | |
tf_len_width_max : assert(TFLenWidth <= AddrWidth) else | ||
$fatal(1, "Parameter `TFLenWidth` has to be <= `AddrWidth`!"); | ||
end | ||
`endif | ||
// pragma translate_on | ||
) | ||
|
||
endmodule : idma_backend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
// Thomas Benz <[email protected]> | ||
|
||
`include "common_cells/registers.svh" | ||
`include "idma/guard.svh" | ||
|
||
/// Handles AXI read and write error on the manager interface. | ||
/// Currently two modes are supported: | ||
|
@@ -297,7 +298,9 @@ module idma_error_handler #( | |
// the counter is 0 -> no transfer in the datapath. This is an impossible | ||
// state | ||
end else begin | ||
`IDMA_NONSYNTH_BLOCK( | ||
$fatal(1, "No active transfer to handle!"); | ||
) | ||
end | ||
end | ||
end | ||
|
@@ -330,7 +333,9 @@ module idma_error_handler #( | |
// the counter is 0 -> no transfer in the datapath. This is an impossible | ||
// state | ||
end else begin | ||
`IDMA_NONSYNTH_BLOCK( | ||
$fatal(1, "No active transfer to handle!"); | ||
) | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
// Thomas Benz <[email protected]> | ||
|
||
`include "common_cells/assertions.svh" | ||
`include "idma/guard.svh" | ||
|
||
/// Optimal implementation of a stream FIFO based on the common cells modules. | ||
module idma_stream_fifo #( | ||
|
@@ -36,13 +37,13 @@ module idma_stream_fifo #( | |
// Prevent Depth 0 and 1 | ||
//-------------------------------------- | ||
// Throw an error if depth is 0 or 1 | ||
// pragma translate off | ||
`IDMA_NONSYNTH_BLOCK( | ||
if (Depth < 32'd2) begin : gen_fatal | ||
initial begin | ||
$fatal(1, "FIFO of depth %d does not make any sense!", Depth); | ||
end | ||
end | ||
// pragma translate on | ||
) | ||
|
||
//-------------------------------------- | ||
// Spill register (depth 2) | ||
|
@@ -51,13 +52,13 @@ module idma_stream_fifo #( | |
if (Depth == 32'd2) begin : gen_spill | ||
|
||
// print info | ||
// pragma translate off | ||
`IDMA_NONSYNTH_BLOCK( | ||
if (PrintInfo) begin : gen_info | ||
initial begin | ||
$display("[%m] Instantiate spill register (of depth %d)", Depth); | ||
end | ||
end | ||
// pragma translate on | ||
) | ||
|
||
// spill register | ||
spill_register_flushable #( | ||
|
@@ -92,13 +93,13 @@ module idma_stream_fifo #( | |
if (Depth > 32'd2) begin : gen_fifo | ||
|
||
// print info | ||
// pragma translate off | ||
`IDMA_NONSYNTH_BLOCK( | ||
if (PrintInfo) begin : gen_info | ||
initial begin | ||
$info("[%m] Instantiate stream FIFO of depth %d", Depth); | ||
end | ||
end | ||
// pragma translate on | ||
) | ||
|
||
// stream fifo | ||
stream_fifo #( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2022 ETH Zurich and University of Bologna. | ||
// Solderpad Hardware License, Version 0.51, see LICENSE for details. | ||
// SPDX-License-Identifier: SHL-0.51 | ||
// | ||
// Thomas Benz <[email protected]> | ||
|
||
// Guard macros for non-synthesizable code | ||
|
||
`ifndef IDMA_GUARD_SVH_ | ||
`define IDMA_GUARD_SVH_ | ||
|
||
`define IDMA_NONSYNTH_BLOCK(__block) \ | ||
`ifndef TARGET_SYNTHESIS \ | ||
`ifndef TARGET_VERILATOR \ | ||
`ifndef TARGET_XSIM \ | ||
`ifndef VERILATOR \ | ||
`ifndef SYNTHESIS \ | ||
`ifndef XSIM \ | ||
/* pragma translate_off */ \ | ||
__block \ | ||
/* pragma translate_on */ \ | ||
`endif \ | ||
`endif \ | ||
`endif \ | ||
`endif \ | ||
`endif \ | ||
`endif | ||
|
||
`endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
// Michael Rogenmoser <[email protected]> | ||
|
||
`include "idma/typedef.svh" | ||
`include "idma/guard.svh" | ||
|
||
/// This is a wrapper for the new backend to emulate the old one | ||
module axi_dma_backend #( | ||
|
@@ -72,13 +73,11 @@ module axi_dma_backend #( | |
|
||
// This wrapper emulates the old (v.0.1.0) backend which is deprecated. Throw a warning here | ||
// to inform the user in simulation | ||
// pragma translate_off | ||
`ifndef VERILATOR | ||
`IDMA_NONSYNTH_BLOCK( | ||
initial begin : proc_deprecated_warning | ||
$warning("You are using the deprecated interface of the backend. Please update ASAP!"); | ||
end | ||
`endif | ||
// pragma translate_on | ||
) | ||
|
||
// Parameters unavailable to old backend | ||
localparam int unsigned TFLenWidth = AddrWidth; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
// Thomas Benz <[email protected]> | ||
|
||
`include "common_cells/registers.svh" | ||
`include "idma/guard.svh" | ||
|
||
/// ND midend for the iDMA. This module takes an n-dimensional transfer and splits it into | ||
/// individual 1d transfers handed to the backend. | ||
|
@@ -236,14 +237,12 @@ module idma_nd_midend #( | |
//-------------------------------------- | ||
// Assertions | ||
//-------------------------------------- | ||
// pragma translate_off | ||
`ifndef VERILATOR | ||
`IDMA_NONSYNTH_BLOCK( | ||
initial begin : proc_assert_params | ||
num_dim : assert(NumDim >= 32'd2) else | ||
$fatal(1, "Parameter `NumDim` has to be >= 2!"); | ||
end | ||
`endif | ||
// pragma translate_on | ||
) | ||
|
||
endmodule : idma_nd_midend | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
// Axel Vanoni <[email protected]> | ||
|
||
`include "common_cells/registers.svh" | ||
`include "idma/guard.svh" | ||
|
||
/// Hacky register interface to AXI converter | ||
module dma_reg_to_axi #( | ||
parameter type axi_req_t = logic, | ||
|
@@ -86,13 +88,13 @@ module dma_reg_to_axi #( | |
/* Ignore axi_rsp_i.r.last (ever only bursts of size 1) */ | ||
/* Ignore axi_rsp_i.r.user */ | ||
assign reg_rsp_o.error = '0; /* swallow errors */ | ||
|
||
/* check that we don't get any errors in the simulation */ | ||
// pragma translate_off | ||
`ifndef VERILATOR | ||
`IDMA_NONSYNTH_BLOCK( | ||
assert property (@(posedge clk_i) (axi_rsp_i.r_valid && axi_req_o.r_ready) |-> \ | ||
(axi_rsp_i.r.resp == axi_pkg::RESP_OKAY)); | ||
`endif | ||
// pragma translate_on | ||
) | ||
|
||
assign reg_rsp_o.ready = ( reg_req_i.write && axi_rsp_i.w_ready) || | ||
(!reg_req_i.write && axi_rsp_i.r_valid); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters