1

I am making two modules, a serializer and a deserializer and i am trying to connect serializer output to the deserializer input. but the point is i have an unusual problem and the temp variables i defined don't change and they have x value. can any body help me with this?

this is the serializer definition:

module serializer (clk, validInput, inputData, outputData, validOutput);

    input clk, validInput;
    input [0:9] inputData;
    output reg outputData;
    output  reg validOutput;

and there some code after that and the deserializer looks like:

module deserializer( input clk, inputBit, validInput,
                     output reg validOutput,
                     output reg [0:9] outputData);

and the controller code is :

module controller(  input clk, validInput,
                    input [0:9] inputData,
                    output [0:9] outputData,
                    output validOutput);
    wire tmpValid = 1, tmpData = 1;



    deserializer dsrilz(
        .clk(clk),
        .inputBit(tmpData),
        .validInput(tmpValid),
        .validOutput(validOutput),
        .outputData(outputData));

    serializer srilz (
        .clk(clk),
        .validInput(validInput),
        .inputData(inputData),
        .outputData(tmpData),
        .validOutput(tmpValid));

endmodule

the problem is when i change tmpData from serializer to another value than the one i gave it at the start (now giving zero while it's value defined in controller is 1), other than becoming zero, it becomes x. does any body know what should i do to solve it?

2 Answers 2

2

The line wire tmpValid = 1, tmpData = 1; doesn't initialize the nets, it applies continuous assignment.

A wire can have multiple drivers. When the drivers send conflicting data (at least one 1 driver and one 0 driver) then the net results in an X.

Simple solution. change wire tmpValid = 1, tmpData = 1; to wire tmpValid, tmpData;

1

If I understand correctly, you are driving tmpData from the serializer (from its outputData port), but you are also initializing the tmpData signal inside the controller. In other words, you are creating multiple drivers with the same strength, which will resolve to 1 while they are both driving 1, but will resolve to x when they are driving opposite values.

What you need to do is initialize outputData and validOutput inside the serializer and don't give tmpValid or tmpData initial values in the controller.

wire tmpValid, tmpData;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.