How can I separate long statements into lines in Verilog

e19293001 picture e19293001 · Jul 17, 2012 · Viewed 11k times · Source

For example, I have a single long statement:

    $display("input_data: %x, 
              output_data: %x,
              result: %x",
              input_data,
              output_data,
              result);

How can I make it into single statement and multiple lines in Verilog?

Answer

toolic picture toolic · Jul 17, 2012

You need to break up the quoted string. Here is one way:

module tb;

initial begin
    integer input_data  = 1;
    integer output_data = 0;
    integer result      = 55;
    $display("input_data: %x "  , input_data,
             "output_data: %x " , output_data,
             "result: %x "      , result);
end

endmodule

Outputs:

input_data: 00000001 output_data: 00000000 result: 00000037