Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog module hierarchy causing problems

Status
Not open for further replies.

ktsangop

Junior Member level 1
Joined
Apr 2, 2008
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,424
Hi there!
I have a question regarding verilog.

I have a very simple shift register like code like this :
Code:
module eleos_sub(NOCclk,in2,full3);
input NOCclk,in2;
output full3;
reg [7:0] mem=8'b0;
reg full3reg;
assign full3=full3reg;


always @ (posedge NOCclk)
begin
    if (mem[7]!=1'b1)
    begin
        mem=mem<<1;
        mem[0]=in2;
    end
    else if (mem[7]==1'b1) full3reg=1'b1;
end

endmodule
Input is serial (10101010) and as the first input is always 1, it is full when mem[7] = 1.
When it's full the full output is set to 1. This works fine on its own. (cool.jpg)

BUT...when i put this code inside another module (top) things get weird.
This is the top module :
Code:
module eleos (NOCclk,sin,full);
input NOCclk,sin; output full; wire in1,full2; reg in1_reg;
assign in1=in1_reg;
assign full=full2;

eleos_sub ss2 (NOCclk,in1,full2);

always @ (posedge NOCclk)
begin
    in1_reg=sin;
end
endmodule

I just want to pass the value of sin to the first module as input and get the full signal output.
The serial input bits are 10101010. But the first value that gets into the mem register is x. (notcool.jpg)

It's very strange ...or i am missing something really fundamental.

Please take a look at the pics and help me if you can.

Thanks in advance!!!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top