Reputation: 341
I have the following code:
module X;
wire [11:0] mga [0:15];
// other code omitted here for clarity
reg [11:0] globalStartAddresses [0:15];
reg [11:0] globalEndAddresses [0:15];
localMMU mmu[0:15](clock, globalStartAddresses, globalEndAddresses, mrw, mdi, mdo, mga);
task dispatcher;
// parameters
output reg dataReady;
input readWrite;
input [7:0] dataIn;
output reg [7:0] dataOut;
input [11:0] globalAddress;
// local variables
integer x, selected;
begin
for(x=0; x<16; x=x+1) begin
if(globalAddress >= globalStartAddresses[x] && globalAddress <= globalEndAddresses[x]) selected=x;
end
mrw[selected]=readWrite;
mdi[selected]=dataIn;
assign mga[selected]=globalAddress;
if(readWrite==1)
wait(mdo[selected]!=0);
else
wait(mdo[selected]!=dataIn);
dataOut=mdo[selected];
end
endtask
endmodule
I get 2 errors in the code:
(I am using VeritakWin 3.84F) Please tell me how can I rectify these 2 problems. Thanks.
Upvotes: 0
Views: 1689
Reputation: 987
globalStartAddresses
and globalEndAddresses
are both of type array
but array
can not be passed directly between two modules. You must flatten the array
into a vector
and then pass it to a module. The problem is answered here :
Left hand side of procedural continuous assignment can not be of type wire
while in continuous assignment, left hand side must be just of type wire
. As a solution, change mga
type to reg
. The same problem answered here:
Upvotes: 1