Hi All.
I am trying to create testbench for a generic sideband agent that does the job of driving interrupts (GPIO Signals)onto the DUT. The bus width is [256:0] and I have created 2 sub-buses for synchronous interrupt registers and 1 for asynchronous register, like:
**bit [SYNCA_MAX:SYNCA_MIN] syncinterrupt1;
bit [SYNCB_MAX:SYNCB_MAX] syncinterrupt2;
bit [ASYNC_MAX:ASYNC_MIN] asyncinterrupt;
**
From the environment I intend to create a configuration class for the agent and define the macros for the above signal bus widths, as well as values for those signals, and then pass down that value to the driver, sequencer, etc.
I am having difficulty visualizing how to exactly do that. So, the env has to be the only component capable of taking user input(i.e. bus widths and signal values) and every other component has to be generic. The user input gets passed down to the sequence item, the driver drives that sequence onto the DUT through the interface.
Following are portions of the code:
Interface:
interface sideband_if(input logic clk,reset);
define MAX_BUSWIDTH 256
define SYNCA_MAX 15 //[15:0]
define SYNCA_MIN 0
define SYNCB_MAX 45 //[45:16]
define SYNCB_MIN 16
define ASYNC_MAX 200 //[200:100]
`define ASYNC_MIN 100
//---------------------------------------
//declaring the signals
//---------------------------------------
logic [SYNCA_MAX:SYNCA_MIN] syncinterrupt1;
logic [SYNCB_MAX:SYNCB_MAX] syncinterrupt2;
logic [ASYNC_MAX:ASYNC_MIN] asyncinterrupt;
logic wr_en;
//---------------------------------------
//driver clocking block
//---------------------------------------
clocking driver_cb @(posedge clk);
default input #1 output #1;
inout syncinterrupt1;
inout syncinterrupt2;
output wr_en;
endclocking
//---------------------------------------
//driver modport
//---------------------------------------
modport DRIVER (clocking driver_cb,input clk,reset, logic asyncinterrupt);
endinterface
So the basic questions are:
How to pass down the sequence item bus widths and signal values inputted by the user into the environment, down to the sequence item and driver and interface, using config db? I will have a configuration class in the env where I take those values, but should I take them in format of an array? What then?I’m a student and a beginner and am having trouble visualizing.Thanks!