module instantiation

P

pat

Guest
what am i trying to do...
i have a top module and a child module (see below code).
i am trying to have the child module return (via output) a counter number
that changes in sequence to the parent module.

what i have done...
i have tied the ouput [7:0] to 8 different LEDs and using the counter and
delay in parent module, LEDs count in binary. trying my child module, only
bit 0 is toggled on/off

what is happen'...
the child module is not counting to the depth of the output [7:0]. it is
returning only 1 or 0 (toggles the LSB LED on and off only)

[b:c016cb9f67]here is the parent...[/b:c016cb9f67]
module top(clk, Out, Enable);

input clk;
output [7:0] Out;
input Enable;
reg [22:0] delay;
reg [7:0] test;
wire tapA0;

always @(posedge clk)
begin
if (Enable == 1)
begin
if (delay == 10)
test <= test + 1;
delay <= delay + 1;
end
else
test <= 0;
end

bottom first_lfsr (.clk(clk), .Enable(Enable), .delayA0(tapA0));

assign Out = tapA0;
endmodule

[b:c016cb9f67]here is the child...[/b:c016cb9f67]

module bottom (clk, Enable, delayA0);

input clk;
input Enable;

output [7:0] delayA0;
reg [20:0] delay2;
reg [7:0] test2;

always @(posedge clk)
begin
if (Enable == 1)
begin
if (delay2 == 10)
test2 <= test2 + 1;
delay2 <= delay2 + 1;
end
else
test2 <= 0;
end
assign delayA0 = test2;

endmodule

HOW DO I get the child to return the full resolution and not just the LSB as
1 or 0.

Thanks in advance
Patrick
 
You need to dimension tapA0 as an 8-bit wire.


"pat" <patrice_o@yahoo.com> wrote in message
news:q4L%c.218040$bp1.170817@twister.nyroc.rr.com...
what am i trying to do...
i have a top module and a child module (see below code).
i am trying to have the child module return (via output) a counter number
that changes in sequence to the parent module.

what i have done...
i have tied the ouput [7:0] to 8 different LEDs and using the counter and
delay in parent module, LEDs count in binary. trying my child module,
only
bit 0 is toggled on/off

what is happen'...
the child module is not counting to the depth of the output [7:0]. it is
returning only 1 or 0 (toggles the LSB LED on and off only)

[b:32256cfb32]here is the parent...[/b:32256cfb32]
module top(clk, Out, Enable);

input clk;
output [7:0] Out;
input Enable;
reg [22:0] delay;
reg [7:0] test;
wire tapA0;

always @(posedge clk)
begin
if (Enable == 1)
begin
if (delay == 10)
test <= test + 1;
delay <= delay + 1;
end
else
test <= 0;
end

bottom first_lfsr (.clk(clk), .Enable(Enable), .delayA0(tapA0));

assign Out = tapA0;
endmodule

[b:32256cfb32]here is the child...[/b:32256cfb32]

module bottom (clk, Enable, delayA0);

input clk;
input Enable;

output [7:0] delayA0;
reg [20:0] delay2;
reg [7:0] test2;

always @(posedge clk)
begin
if (Enable == 1)
begin
if (delay2 == 10)
test2 <= test2 + 1;
delay2 <= delay2 + 1;
end
else
test2 <= 0;
end
assign delayA0 = test2;

endmodule

HOW DO I get the child to return the full resolution and not just the LSB
as
1 or 0.

Thanks in advance
Patrick
 
That did it. thanks
i must have over looked that while i was taking a sip of coffee.

have a good day.

On Wed, 08 Sep 2004 22:31:17 +0000, John_H wrote:

You need to dimension tapA0 as an 8-bit wire.


"pat" <patrice_o@yahoo.com> wrote in message
news:q4L%c.218040$bp1.170817@twister.nyroc.rr.com...
what am i trying to do...
i have a top module and a child module (see below code).
i am trying to have the child module return (via output) a counter number
that changes in sequence to the parent module.

what i have done...
i have tied the ouput [7:0] to 8 different LEDs and using the counter and
delay in parent module, LEDs count in binary. trying my child module,
only
bit 0 is toggled on/off

what is happen'...
the child module is not counting to the depth of the output [7:0]. it is
returning only 1 or 0 (toggles the LSB LED on and off only)

[b:9a14b08538]here is the parent...[/b:9a14b08538]
module top(clk, Out, Enable);

input clk;
output [7:0] Out;
input Enable;
reg [22:0] delay;
reg [7:0] test;
wire tapA0;

always @(posedge clk)
begin
if (Enable == 1)
begin
if (delay == 10)
test <= test + 1;
delay <= delay + 1;
end
else
test <= 0;
end

bottom first_lfsr (.clk(clk), .Enable(Enable), .delayA0(tapA0));

assign Out = tapA0;
endmodule

[b:9a14b08538]here is the child...[/b:9a14b08538]

module bottom (clk, Enable, delayA0);

input clk;
input Enable;

output [7:0] delayA0;
reg [20:0] delay2;
reg [7:0] test2;

always @(posedge clk)
begin
if (Enable == 1)
begin
if (delay2 == 10)
test2 <= test2 + 1;
delay2 <= delay2 + 1;
end
else
test2 <= 0;
end
assign delayA0 = test2;

endmodule

HOW DO I get the child to return the full resolution and not just the LSB
as
1 or 0.

Thanks in advance
Patrick
 

Welcome to EDABoard.com

Sponsor

Back
Top