Using same Agent with different I/F

Hi all,

I have a simple agent which I would like to use on similar yet different Interfaces.

The driver/monitor functionality is a rd-req and ack with data , the only difference is that one interface is returning data on 1 output bus and second I/f has several buses of data output.

what would be the right approach in that case ?

I thought of maybe implementing the driving/monitoring logic in the I/F itself, so i would have 2 types of I/Fs with same agent instantiated twice.

thanks in advance,
Guy L.

In reply to guy.levi:

The key question is what you mean with ‘similar yet different’. Is it the same functional interface with the same general protocol or not and are they independent.

If you have independent interfaces with the same protocol you need 2 instances of the same agents. Doing like this does not limit the reuse aspect.

In reply to guy.levi:

Of course parameters would be a solution. You could declare soemthing like this for your data:

logic [DATA_WIDTH-1:0] data [NOB];
where DATA_WIDTH and NOB are parameters. But I do not know the details if this would make sense.
But 2 instances of your agent are needed.

In reply to chr_sue:

thanks again.
I thought about it, but my DATA width is not the same for the 3 buses. each bus has different width. I guess I could use the MAX width of the 3 buses.

In reply to guy.levi:

I guess its better to declare 2 interfaces , and having one config class in agent which will tell which variant to use .
Your config class will look something like this

bit variant ; 
interface_0 vif_0;
interface_1 vif_1;

In top component , say env you have 2 agent instantiation
—In agent instance 1 pass config ( variant =0 , interface_0)
—In agent instance 2 pass config ( variant=1 , interface_1)
env code :

cfg0.variant=0;
cfg0.interface_0 = this.vif0;
cfg1.variant=1;
cfg1.interface_1 = this.vif1;
agent0.cfg = cfg0;
agent1.cfg = cfg1

This is all about connectivity and in your driver and monitor use variant bit to differentiate the code on requirement basis like below

wait(vif.req) 
if(variant==0) rdata = vif_0.data;
else rdata = vif_1.data;

In reply to nikhilverif:

great!
thanks for the help ;)

In reply to guy.levi:

I have had success at creating base agents that support the control handshake of ready/valid or req/ack type protocols. Ideally the agent and the interface are parameterized by data payload type which is a packed struct. Then for a specific derivation of the agent, solidify the struct to the exact one you wish to use for the data payload.

Also there can be reuse between both the master and slave sides of the agent. The item, interface, and monitor can be reused but the drivers on the master/slave side need to be different. One can even have the agent configurable as master or slave and have the appropriate driver and sequencing choose at build time.

Next, the agent can be unit tested, with master and slave instantiated and connected up back-to-back in a simple, stand-alone testbench.