Error in Modelsim: 'Address_me' already declared in this scope (FIR_TestBench) at /home/user1/CAD/final/final/FIR_TestBench.v(33).

Status
Not open for further replies.

mohamis288

Full Member level 3
Joined
Mar 1, 2022
Messages
165
Helped
0
Reputation
0
Reaction score
1
Trophy points
18
Activity points
1,234
Hello,

I am compiling testbench file in modelsim. My Testbench Verilog code is here:

Code:
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////


// Module Name: FIR_TB






module FIR_TestBench;


parameter N = 8;


reg clk, reset;
reg [N-1:0] my_data_in;
wire [N-1:0] my_data_out;


FIR_Filter inst0(clk, reset, my_data_in, my_data_out);


// input sine wave data
initial
$readmemb("signal.data", RAMM);


// Create the RAM
reg [N-1:0] RAMM [31:0];


// create a clock
initial
clk = 0;
always
#10 clk = ~ clk; 


// Read RAMM data and give to design
always@(posedge clk)
    my_data_in <= RAMM[Address_me];
    
// Address_me counter
reg [4:0] Address_me;


initial
Address_me = 1;
always@(posedge clk)
begin
    if (Address_me == 31)
        Address_me = 0;
    else
        Address_me = Address_me + 1;
end     


endmodule

But this error will be shown:

Code:
** Error: /home/user1/CAD/final/final/FIR_TestBench.v(33): (vlog-2730) Undefined variable: 'Address_me'.
** Error (suppressible): /home/user1/CAD/final/final/FIR_TestBench.v(36): (vlog-2388) 'Address_me' already declared in this scope (FIR_TestBench) at /home/user1/CAD/final/final/FIR_TestBench.v(33).

'Address_me' has been defined once. What does it say?

Best regard
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…