Forum Discussion

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

object assigned a value but never read - does this effect synthesis?

Hello,

I have the following small module which is intended to store the value 0xFF in a register when a button is pressed.


module connector_test(button, txd);
input button;
output reg txd;
reg  data;
always @(button) begin
    if(button==1'b0) begin
        txd <= 1'b0;
        data <= 8'hFF;
    end
    else begin
        txd <= 1'b1;
        data <= 8'b0;
    end
    
end
endmodule

I would expect the data register to be synthesized, but it seems to be completely disregarded and does not end up as part of the final circuit!

I get the following error during synthesis:

Warning (10036): Verilog HDL or VHDL warning at connector_test.v(5): object "data" assigned a value but never read

I'm not sure if the fact that the register is not read allows the synthesizer to assume that the logic is useless and automatically disregards it, or if something else is happening.

Any help in understanding this is appreciated!

-k

15 Replies

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

    Interesting, the Xilinx equivalent of noprune 'S' (for save) synthesizes correctly and uses 8 LUTS as indicated in the report. What's the solution to get this working in Quartus?

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

    I notice a possible misunderstanding. "noprune" is said to preserve registers with no fanout. data isn't a register, it's a (group of) combinational logic cell(s).

    I did my previous test with real registers, and they worked well.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Perhaps you're correct - could you elaborate a little more?

    I understand that declaring something as reg doesn't mean that it will be synthesized as an actual sequential element. The synthesizer could very well turn it into combinational logic - but how do you know that its being interpreted as a group of combinational cells? Since it hasn't made it into the final circuit - I'm not sure how to know what the synthesizer has interpreted it as.

    Secondly, you said that you used real registers - what exactly was this implementation? A look at the experimental code you used would be helpful for this.

    Thanks again.

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

    Real registers for which norpune works need a clock, generated e.g. by always @(posedge clk) block.