Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
13 years ago

Need help with Verilog sending values

I failed to send values between 2 modules. Please help me fix it:


// top.v
module top;
src s(
.value (value)
);
wire value;
des d(
.value (value)
);
endmodule
// src.v
module src(value);
output value;
assign value = "Hello";
endmodule
// des.v
module des(value);
input value;
$display("%s", value);         // Display nothing
endmodule

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Just a guess, but move your wire statement to the top, before it is used, i.e.,

    
    module top;
    wire value;
     
    src s(
    .value (value)
    );
    des d(
    .value (value)
    );
    endmodule
    

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    That didn't work. :p

    --- Quote End ---

    Why don't you post your code and the code for your testbench.

    If you don't have a testbench, then its time to write one :)

    Test the testbench using Modelsim, and then synthesize your design using Quartus.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Erm, looking back at your original code, you are trying to transmit a string via a single wire. I don't think you can do that in Verilog. You need to look for a Verilog example of how to use strings, I think you need a multibit wire ... but I don't code much in Verilog.

    Cheers,

    Dave
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for the tip. That was a multibit issue, and I just worked that out. :)