数字电路设计之低功耗设计方法一:bus总线翻转
2014-06-30 12:24
323 查看
Businveter:就是IO的输入输出的变化会导致大量的动态功耗,若采用一个inveter位表示一个输入输出是否需要翻转,可以使得IO翻转大大减少,从而动态功耗也就降低了。具体的操作就是当hanming距离大于bus的bit数加上inveter的位数的变化位数的一半的时候那就翻转,invetert置为1。Haming距离就是前一个输出与当前输出的需要翻转的个数。
首先是没有Bus-inveter的verilog:
module Busconveter(
clk,
bus_input,
bus_output
);
input wire clk;
input wire [15:0]bus_input;
output reg [15:0]bus_output;
always@(posedge clk)
bus_output <= bus_input;
endmodule
接着是有Bus-invetert技术的代码:
module Bus_inveter(
clr,
clk,
bus_input,
bus_output,
inveter
);
input wire clr;
input wire clk;
input wire [15:0]bus_input;
output reg [15:0]bus_output;
output reg inveter;
reg [15:0]temp;
reg [3:0]count;
always@(posedge clk,posedge clr) //如果count(Hamming distance)>Bus_input and pre_output,翻转
if(clr)
begin
bus_output <= 16'b0;
end
else
begin
if(inveter == 1)
begin
bus_output <= ~bus_input;
end
else
begin
bus_output <= bus_input;
end
end
always@(posedge clk,posedge clr)
if(clr)
begin
count <= 4'b0;
inveter <= 1'b0;
end
else
begin
count = 0;
if((bus_input[0]^temp[0]) == 1'b1)
count = count + 1;
if((bus_input[1]^temp[1]) == 1'b1)
count = count + 1;
if((bus_input[2]^temp[2]) == 1'b1)
count = count + 1;
if((bus_input[3]^temp[3]) == 1'b1)
count = count + 1;
if((bus_input[4]^temp[4]) == 1'b1)
count = count + 1;
if((bus_input[5]^temp[5]) == 1'b1)
count = count + 1;
if((bus_input[6]^temp[6]) == 1'b1)
count = count + 1;
if((bus_input[7]^temp[7]) == 1'b1)
count = count + 1;
if((bus_input[8]^temp[8]) == 1'b1)
count = count + 1;
if((bus_input[9]^temp[9]) == 1'b1)
count = count + 1;
if((bus_input[10]^temp[10]) == 1'b1)
count = count + 1;
if((bus_input[11]^temp[11]) == 1'b1)
count = count + 1;
if((bus_input[12]^temp[12]) == 1'b1)
count = count + 1;
if((bus_input[13]^temp[13]) == 1'b1)
count = count + 1;
if((bus_input[14]^temp[14]) == 1'b1)
count = count + 1;
if((bus_input[15]^temp[15]) == 1'b1)
count = count + 1;
begin
if(count >= 8)
begin
inveter <= 1'b1;
end
else
begin
inveter <= 1'b0;
end
end
end
always@(posedge clk,posedge clr)
if(clr)
temp <= 16'b0;
else
temp <= bus_output;
endmodule
仿真代码:
module test;
// Inputs
reg clr;
reg clk;
reg [15:0] bus_input;
// Outputs
wire [15:0] bus_output;
wire inveter;
// Instantiate the Unit Under Test (UUT)
Bus_inveter uut (
.clr(clr),
.clk(clk),
.bus_input(bus_input),
.bus_output(bus_output),
.inveter(inveter)
);
always #50 clk = ~clk;
initial begin
$dumpfile("Bus_conveter.vcd");
$dumpvars(1,test.uut);
// Initialize Inputs
bus_input = 0;
clk = 0;
clr = 1;
// Wait 100 ns for global reset to finish
#100;
clr = 0;
bus_input = 16'hffff;
#100;
bus_input = 16'heeee;
#100;
bus_input = 16'h1111;
#100;
bus_input = 16'h1100;
#100;
bus_input = 16'hffec;
#100;
bus_input = 16'h0000;
#100;
bus_input = 16'hedef;
#100;
bus_input = 16'h1234;
#100;
bus_input = 16'h4356;
#100;
bus_input = 16'h7870;
#100;
bus_input = 16'h2e34;
#100;
bus_input = 16'hc311;
#100;
bus_input = 16'h2313;
#100;
bus_input = 16'h2313;
#100;
bus_input = 16'h1111;
#100;
bus_input = 16'hffff;
#100;
bus_input = 16'h2222;
#100;
bus_input = 16'h12de;
#100;
bus_input = 16'hffff;
#100;
bus_input = 16'hf11f;
#100;
bus_input = 16'hf11f;
// Add stimulus here
end
endmodule
首先是没有Bus-inveter的verilog:
module Busconveter(
clk,
bus_input,
bus_output
);
input wire clk;
input wire [15:0]bus_input;
output reg [15:0]bus_output;
always@(posedge clk)
bus_output <= bus_input;
endmodule
接着是有Bus-invetert技术的代码:
module Bus_inveter(
clr,
clk,
bus_input,
bus_output,
inveter
);
input wire clr;
input wire clk;
input wire [15:0]bus_input;
output reg [15:0]bus_output;
output reg inveter;
reg [15:0]temp;
reg [3:0]count;
always@(posedge clk,posedge clr) //如果count(Hamming distance)>Bus_input and pre_output,翻转
if(clr)
begin
bus_output <= 16'b0;
end
else
begin
if(inveter == 1)
begin
bus_output <= ~bus_input;
end
else
begin
bus_output <= bus_input;
end
end
always@(posedge clk,posedge clr)
if(clr)
begin
count <= 4'b0;
inveter <= 1'b0;
end
else
begin
count = 0;
if((bus_input[0]^temp[0]) == 1'b1)
count = count + 1;
if((bus_input[1]^temp[1]) == 1'b1)
count = count + 1;
if((bus_input[2]^temp[2]) == 1'b1)
count = count + 1;
if((bus_input[3]^temp[3]) == 1'b1)
count = count + 1;
if((bus_input[4]^temp[4]) == 1'b1)
count = count + 1;
if((bus_input[5]^temp[5]) == 1'b1)
count = count + 1;
if((bus_input[6]^temp[6]) == 1'b1)
count = count + 1;
if((bus_input[7]^temp[7]) == 1'b1)
count = count + 1;
if((bus_input[8]^temp[8]) == 1'b1)
count = count + 1;
if((bus_input[9]^temp[9]) == 1'b1)
count = count + 1;
if((bus_input[10]^temp[10]) == 1'b1)
count = count + 1;
if((bus_input[11]^temp[11]) == 1'b1)
count = count + 1;
if((bus_input[12]^temp[12]) == 1'b1)
count = count + 1;
if((bus_input[13]^temp[13]) == 1'b1)
count = count + 1;
if((bus_input[14]^temp[14]) == 1'b1)
count = count + 1;
if((bus_input[15]^temp[15]) == 1'b1)
count = count + 1;
begin
if(count >= 8)
begin
inveter <= 1'b1;
end
else
begin
inveter <= 1'b0;
end
end
end
always@(posedge clk,posedge clr)
if(clr)
temp <= 16'b0;
else
temp <= bus_output;
endmodule
仿真代码:
module test;
// Inputs
reg clr;
reg clk;
reg [15:0] bus_input;
// Outputs
wire [15:0] bus_output;
wire inveter;
// Instantiate the Unit Under Test (UUT)
Bus_inveter uut (
.clr(clr),
.clk(clk),
.bus_input(bus_input),
.bus_output(bus_output),
.inveter(inveter)
);
always #50 clk = ~clk;
initial begin
$dumpfile("Bus_conveter.vcd");
$dumpvars(1,test.uut);
// Initialize Inputs
bus_input = 0;
clk = 0;
clr = 1;
// Wait 100 ns for global reset to finish
#100;
clr = 0;
bus_input = 16'hffff;
#100;
bus_input = 16'heeee;
#100;
bus_input = 16'h1111;
#100;
bus_input = 16'h1100;
#100;
bus_input = 16'hffec;
#100;
bus_input = 16'h0000;
#100;
bus_input = 16'hedef;
#100;
bus_input = 16'h1234;
#100;
bus_input = 16'h4356;
#100;
bus_input = 16'h7870;
#100;
bus_input = 16'h2e34;
#100;
bus_input = 16'hc311;
#100;
bus_input = 16'h2313;
#100;
bus_input = 16'h2313;
#100;
bus_input = 16'h1111;
#100;
bus_input = 16'hffff;
#100;
bus_input = 16'h2222;
#100;
bus_input = 16'h12de;
#100;
bus_input = 16'hffff;
#100;
bus_input = 16'hf11f;
#100;
bus_input = 16'hf11f;
// Add stimulus here
end
endmodule
相关文章推荐
- 数字电路设计之低功耗设计方法六:旁路(by-passing)
- 数字电路设计之低功耗设计方法二:memory-partition
- 数字电路设计之低功耗设计方法三:操作数隔离
- 一种低功耗触摸按键应用的设计方法
- 总线设备驱动框架程序 及 struct device中消失的bus_id的取代方法
- [转贴]寄存器传输级的低功耗设计方法
- linux--bus驱动-初级--只实现bus总线程序模块设计
- 数字电路设计之低功耗设计方法五:门控
- 数字电路设计之低功耗设计方法四:预计算
- 1030-platform总线体现C语言的面相对象设计方法
- 寄存器传输级的低功耗设计方法
- 低功耗设计一之Bus-invert
- 【低功耗设计学习笔记】(一)Bus Invert
- 软件低功耗设计方法
- 总线设备驱动框架程序 及 struct device中消失的bus_id的取代方法
- 数据库设计方法、规范与技巧(转)
- activereport设计时绑定数据库的方法
- 数据库设计中的敏捷方法
- 数据库设计方法、规范与技巧(推荐)
- 四种网络游戏外挂的设计方法 作者:mprogramer