A
Ari Ari
Guest
I need to receive data from an array of input interfaces and send the
output to an array of output interfaces. The receive (send) is
implemented by calling a task called Receive (Send).
interface test_I;
logic req;
logic ack;
logic data;
task Receive (output logic d);
wait (req == 1);
ack = 1;
d = data;
wait (req == 0);
ack = 0;
endtask
task Send (input logic d);
req = 1;
data = d;
wait (ack == 1);
req = 0;
wait (ack == 0);
endtask
endinterface
module Receiver_16(test_I inputs [15:0], test_I outputs [15:0]);
integer i = 0;
logic [15:0] rData, sData;
always
begin
for (i=0 ; i<=15 ; i++)
inputs.Receive(rData); //Can't do this: Nonconstant index
into instance array 'inputs'
//Consume received data and generate sData
for (i=0 ; i<=15 ; i++)
outputs.Send(sData); //Can't do this: Nonconstant index
into instance array 'outputs'
end
endmodule
----
According to this
http://objectmix.com/verilog/189492-systemverilog-interface-arrays.html
this can be done only by using multiple always blocks or virtual
interfaces. Can someone tell me if these are the only options although
the compiler is told that are interfaces are of the same type? How can
I do this with virtual interfaces?
output to an array of output interfaces. The receive (send) is
implemented by calling a task called Receive (Send).
interface test_I;
logic req;
logic ack;
logic data;
task Receive (output logic d);
wait (req == 1);
ack = 1;
d = data;
wait (req == 0);
ack = 0;
endtask
task Send (input logic d);
req = 1;
data = d;
wait (ack == 1);
req = 0;
wait (ack == 0);
endtask
endinterface
module Receiver_16(test_I inputs [15:0], test_I outputs [15:0]);
integer i = 0;
logic [15:0] rData, sData;
always
begin
for (i=0 ; i<=15 ; i++)
inputs.Receive(rData); //Can't do this: Nonconstant index
into instance array 'inputs'
//Consume received data and generate sData
for (i=0 ; i<=15 ; i++)
outputs.Send(sData); //Can't do this: Nonconstant index
into instance array 'outputs'
end
endmodule
----
According to this
http://objectmix.com/verilog/189492-systemverilog-interface-arrays.html
this can be done only by using multiple always blocks or virtual
interfaces. Can someone tell me if these are the only options although
the compiler is told that are interfaces are of the same type? How can
I do this with virtual interfaces?