Improving Power Consumption

Status
Not open for further replies.

keyboardcowboy

Member level 3
Joined
Mar 4, 2010
Messages
55
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,715
I came across a verilog example of improving power consumption in a multiplier. The original code is

Code:
reg Enable;
reg [31:0] A, B, DataOut, MultOut, AddOut;
wire [31:0] A, B;
always@(posedge clock)
if (Enable == 1) DataOut <= MultOut;
else DataOut <= AddOut;
assign MultOut = A * B;
assign AddOut = A + B;

The assumption is

"Assume that signal enable is active (high) 20% of the time. Assume the adder consumes too little power that it is not worth to consider it for power optimization."

The optimized solution given is

Code:
reg Enable;
reg [31:0] A, B, DataOut, MultOut, AddOut;
wire [31:0] A, B;
always@(posedge clock)
if (Enable == 1) DataOut <= MultOut;
else DataOut <= AddOut;

[B]always@(posedge clock) begin
saveA <= A;
saveB <= B;
end
assign InA = Enable ? A : saveA;
assign InB = Enable ? B : saveB;
assign MultOut = InA * InB;[/B]

assign AddOut = A + B;

// dropping the save registers and replacing MultOUt inputs
with
// assign InA = Enable ? A : 32'h0;
// assign InB = Enable ? B : 32'h0;
// is viable too

I do not understand the part in bold in the solution code. A and B are saved as saveA, and saveB, and the multiplier is still multiplying them irrespective of the enable signal. How does this save power?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…