M
Marwan
Guest
Peace,
I have been trying to get this simple test setup to work so I can move
on to more complicated designs... but it has been taking lots of time
and just not working for me... if anyone can see what the problem is,
please comment...
The top level module which instantiates the unit under test.
*****************************************************************************
`timescale 1ns / 1ps
module test_top3();
wire [3:0] out;
integer row;// reg does not seem to work for me
integer col;//"""""
reg clk;
test5 inst1(
.row(row),
.col(col),
.clk(clk),
.out(out)
);
reg [3:0] memo5 [0:3][0:3];
initial
begin
clk = 0;
forever
begin
#2 clk = ~clk;
end
end
always@(posedge clk)
begin
for (row=0;row<=3;row=row+1)
begin
for (col=0;col<=3;col=col+1)
begin
memo5[row][col] = out;
end//for
end//for
$finish;
end
endmodule
************************************************************
The unit under test
*************************************************************
`timescale 1ns / 1ps
module test5(
row,
col,
clk,
out
);
reg [3:0] memt5 [0:3][0:3];
//inputs
input row;
wire [31:0] row;// as integer is default 32 bit on 32 bit systems
input col;
wire [31:0] col;
input clk;
//outputs
output out;
reg [3:0] out;
integer i,j,k;
initial
begin
k = 0;
for (i=0;i<=3;i=i+1)
begin
for (j=0;j<=3;j=j+1)
begin
memt5[j]=k;
k=k+1;
end
end
end//initial
always@(posedge clk)
begin
out <= memt5[row][col];
end
endmodule
I have been trying to get this simple test setup to work so I can move
on to more complicated designs... but it has been taking lots of time
and just not working for me... if anyone can see what the problem is,
please comment...
The top level module which instantiates the unit under test.
*****************************************************************************
`timescale 1ns / 1ps
module test_top3();
wire [3:0] out;
integer row;// reg does not seem to work for me
integer col;//"""""
reg clk;
test5 inst1(
.row(row),
.col(col),
.clk(clk),
.out(out)
);
reg [3:0] memo5 [0:3][0:3];
initial
begin
clk = 0;
forever
begin
#2 clk = ~clk;
end
end
always@(posedge clk)
begin
for (row=0;row<=3;row=row+1)
begin
for (col=0;col<=3;col=col+1)
begin
memo5[row][col] = out;
end//for
end//for
$finish;
end
endmodule
************************************************************
The unit under test
*************************************************************
`timescale 1ns / 1ps
module test5(
row,
col,
clk,
out
);
reg [3:0] memt5 [0:3][0:3];
//inputs
input row;
wire [31:0] row;// as integer is default 32 bit on 32 bit systems
input col;
wire [31:0] col;
input clk;
//outputs
output out;
reg [3:0] out;
integer i,j,k;
initial
begin
k = 0;
for (i=0;i<=3;i=i+1)
begin
for (j=0;j<=3;j=j+1)
begin
memt5[j]=k;
k=k+1;
end
end
end//initial
always@(posedge clk)
begin
out <= memt5[row][col];
end
endmodule