How to pass data between two module?

L

lei

Guest
Hi all:
I have 2 modules, one display digits on LED, another receives data
from serial port, The LED module has been tested, it can show correct
digit , if I hardcoded a data inside that module in a reg type data.
So I wrote a top level module like this:

module(..)

receiver recv(clk, rx_data...); // receive data from serial port.
led show(clk, rx_data...); //display the data.

endmodule

The result is that if I transfer a character, I can see the LED
flashes, but it's not display correct value, There could be some other
bugs inside the receiver module, but I wonder, since the rx_data is a
net type, the data will not be retained after receive, so it will not
stay inside the LED module? (the rx_data has been declared as reg type
inside the LED module though).

How do I solve this problem?
Thanks
lei
 
On Fri, 30 May 2008 21:44:49 -0700 (PDT), lei <leisun124@gmail.com>
wrote:

Hi all:
I have 2 modules, one display digits on LED, another receives data
from serial port, The LED module has been tested, it can show correct
digit , if I hardcoded a data inside that module in a reg type data.
So I wrote a top level module like this:

module(..)

receiver recv(clk, rx_data...); // receive data from serial port.
led show(clk, rx_data...); //display the data.

endmodule

The result is that if I transfer a character, I can see the LED
flashes, but it's not display correct value, There could be some other
bugs inside the receiver module, but I wonder, since the rx_data is a
net type, the data will not be retained after receive, so it will not
stay inside the LED module? (the rx_data has been declared as reg type
inside the LED module though).

How do I solve this problem?
Thanks
lei
Comments:
Have you simulated the recv module? That would answer the question
about whether rx_data persists.
Have you allowed for the inversion in the RS232 interface chip?
Have you specified somewhere
wire [7:0]rx_data?
(assuming rx_data is 8 bits wide)
 

Welcome to EDABoard.com

Sponsor

Back
Top