-2

Let's say I've following code:

always_ff @(posedge clk, negedge rst) begin
   if (~rst) begin
      bad_singal <= '0;
      good_signal <= '0;
   end else begin
      // do something
      // bad_signal is not used here or anywhere in design. 
      if (some condition)
         good_signal <= 1'b1;
   end
end

What will happen to bad_signal in synthesis? Will the synthesis tool optimize away the flop as it's not used anywhere in the design?

Lundin
  • 195,001
  • 40
  • 254
  • 396
newbie
  • 4,639
  • 10
  • 32
  • 45

3 Answers3

4

If a signal or register doesn't drive anything, then yes -- any competent synthesis tool will trim it away, regardless of how it is set. Many synthesis tools will report a warning when this occurs.

1

It should infer a latch technically.

0

If it not used it will be optimized away. If it is used somewhere it will be tied to the ground since its value is always 0.

Alper Kucukkomurler
  • 1,706
  • 2
  • 13
  • 19