verilogsynthesis

When designing digital circuits, which is more power efficient, an if-statement or a multiplication (particular case)?


I'm currently writing the code of a hardware accelerator in Verilog 2001, and a question has arisen to which I could not find an answer (maybe I don't know how to search for it):

  1. There's a simple sequential logic:
always @(posedge clk) begin
   reg_q <= reg_d;
end
  1. There's a FSM doing some stuff:
always @* begin
   ...
   reg_d = reg_q;
   case(...) begin
      ...
   end
   ...
end

And here is the question:

  1. I have a simple 1-bit register A that under certain circumstances alternates between 1 and 0.

  2. The next state of the register reg_q depends on some variable foo and its dependency coincides with the bit change of A. So, there are two things I could do but I don't know whether they are the same or they can produce some differences, let's say in the power consumption of the accelerator, or the area of the circuit. Will it generate the same circuit upon synthesis? Below the two options:

Multiplication:

reg_d = reg_q + (foo)*(A)

If-statement:

reg_d = reg_q
if(A) begin
   reg_d = reg_q + (foo)
end

It's my first time asking here and I'm sorry if it's a repeated or non-relevant question.


Solution

  • This is all combinational logic, it generates the same boolean equations resulting in the same hardware. As long as you don't write code that creates additional latches, there will be no differences in power/area.