关键路径的选取
来源:互联网 发布:pdf转jpg mac版 编辑:程序博客网 时间:2024/04/28 11:08
这是一篇我的心得,写verilog的心得,啊,对于学习verilog设计FPGA的同学一定会有帮助的啊!
本人就例子来教大家怎样提取关键路径:
先解释一下什么叫关键路径
所谓关键路径就是,在电路中频繁调用,而且延迟过长,
或者产生意外的几率比较大的线路。
1:组合电路中的关键路径提取:
q=a&b&c|d&e&b;
这个很简单了,估计大家都会的,因为b的传输要两级,
可以简单的提取b作为一级的:
q=(a&c|d&e)&b
2: always——block中的关键路径提取:
always中关键路径的提取一般用分步法提取,请看下面一个
always——block,
always@(in)
begin
if(!a)
if(c&&(!b&&e))
out=out1;
else out=out2;
else if(b&&e) out =out1;
end
这里面e是关键路径,我们可以分两个步骤提取关键路径
(1) 当e=1的时候有:
if(!a)
if(c&&(!b))
out=out1;
else out=out2;
(2)当e=0的时候有:
if(!a) out=out2;
因此这个always可以写成这个样子:
always@(in)
begin
if(e)
if(!a)
if(c&&(!b))
out=out1;
else out=out2;
else if(!a) out=out2;
end
这是中间形式,还要写成最终形式:
定义两个临时变量,为了在综合时候,被综合掉,要定义他们
为输出端口(output)——切记!!!
output out_temp1,out_temp2;
out_temp1=a?outc&&(!b))?out1ut2;
out_temp2=a?outut2;
assign out=e?out_temp1ut_temp2;
好了,这个已经提取成功!~
再来看第三个例子,在应用中经常用到的啊
3。FSM中的关键路径的提取:关于状态机,这是FPGA设计必备的基础,编码方式有很多中比如:one——hot,or one--cool
还有就是组合电路和时序 电路的写法,这里主要讲关键路径的提取至于状态机的写法,还是查阅一下资料啊!
FSM中关键路径的提取方法一般是先将要提取的关键路径去掉
然后将原来FSM中的next-state用另外一个符号代替,作为次FSM 的输入,即有主从两个FSM。
来看一下这个简单的状态机啊:
parameter s0=0;
parameter s1=1;
parameter s2=2;
parameter s3=3;
input in1,in2,in3,set;
reg[1:0] nextstate,currentstate;
always@(in1 or in2 or in3 or currentstate)
begin
nextstate=s0;// start state
case(currentstate)
s0: if(in1&&!set)
nextstate=s1;
else if(set) nextstate=s2;
s1:if(in2&&set)
nextstate=s3;
else if(!set) nextstate=s2;
s2:if(set) nexstate=s3;
s3:if(in3) nextstate=s0;
default:nextstate=s0;
endcase
end
好,现在来看第一步,将状态机中的关键路径去掉,这里的关键路径为set,试想如果状态从s0一路到s3,都是set在起作用,如果有一个不小心的毛刺产生,就会执行错误的行为,所以这里的set为关键路径。
提取后的状态机如下:
reg[1:0]temp;
always@(in1 or in2 or in3 or currentstate)
begin
nextstate=s0;// start state
temp=s0;
case(currentstate)
s0: if(in1)
temp=s1;
s1:if(in2)
temp=s3;
s2: temp=temp;
s3:if(in3) temp=s0;
default:temp=s0;
endcase
end
第二步:
always2(temp or currentstate or set)
begin
case(currentstate)
s0:if(!set)
nextstate=temp
else nextstate=s2;
s1: if(set)
nextstate=temp;
else nextstate=s2;
s2:if(set) nextstate=s3;
else nextstate=temp;
s3: nextstate=temp;
default:nextstate=temp;
endcase
end
本人就例子来教大家怎样提取关键路径:
先解释一下什么叫关键路径
所谓关键路径就是,在电路中频繁调用,而且延迟过长,
或者产生意外的几率比较大的线路。
1:组合电路中的关键路径提取:
q=a&b&c|d&e&b;
这个很简单了,估计大家都会的,因为b的传输要两级,
可以简单的提取b作为一级的:
q=(a&c|d&e)&b
2: always——block中的关键路径提取:
always中关键路径的提取一般用分步法提取,请看下面一个
always——block,
always@(in)
begin
if(!a)
if(c&&(!b&&e))
out=out1;
else out=out2;
else if(b&&e) out =out1;
end
这里面e是关键路径,我们可以分两个步骤提取关键路径
(1) 当e=1的时候有:
if(!a)
if(c&&(!b))
out=out1;
else out=out2;
(2)当e=0的时候有:
if(!a) out=out2;
因此这个always可以写成这个样子:
always@(in)
begin
if(e)
if(!a)
if(c&&(!b))
out=out1;
else out=out2;
else if(!a) out=out2;
end
这是中间形式,还要写成最终形式:
定义两个临时变量,为了在综合时候,被综合掉,要定义他们
为输出端口(output)——切记!!!
output out_temp1,out_temp2;
out_temp1=a?outc&&(!b))?out1ut2;
out_temp2=a?outut2;
assign out=e?out_temp1ut_temp2;
好了,这个已经提取成功!~
再来看第三个例子,在应用中经常用到的啊
3。FSM中的关键路径的提取:关于状态机,这是FPGA设计必备的基础,编码方式有很多中比如:one——hot,or one--cool
还有就是组合电路和时序 电路的写法,这里主要讲关键路径的提取至于状态机的写法,还是查阅一下资料啊!
FSM中关键路径的提取方法一般是先将要提取的关键路径去掉
然后将原来FSM中的next-state用另外一个符号代替,作为次FSM 的输入,即有主从两个FSM。
来看一下这个简单的状态机啊:
parameter s0=0;
parameter s1=1;
parameter s2=2;
parameter s3=3;
input in1,in2,in3,set;
reg[1:0] nextstate,currentstate;
always@(in1 or in2 or in3 or currentstate)
begin
nextstate=s0;// start state
case(currentstate)
s0: if(in1&&!set)
nextstate=s1;
else if(set) nextstate=s2;
s1:if(in2&&set)
nextstate=s3;
else if(!set) nextstate=s2;
s2:if(set) nexstate=s3;
s3:if(in3) nextstate=s0;
default:nextstate=s0;
endcase
end
好,现在来看第一步,将状态机中的关键路径去掉,这里的关键路径为set,试想如果状态从s0一路到s3,都是set在起作用,如果有一个不小心的毛刺产生,就会执行错误的行为,所以这里的set为关键路径。
提取后的状态机如下:
reg[1:0]temp;
always@(in1 or in2 or in3 or currentstate)
begin
nextstate=s0;// start state
temp=s0;
case(currentstate)
s0: if(in1)
temp=s1;
s1:if(in2)
temp=s3;
s2: temp=temp;
s3:if(in3) temp=s0;
default:temp=s0;
endcase
end
第二步:
always2(temp or currentstate or set)
begin
case(currentstate)
s0:if(!set)
nextstate=temp
else nextstate=s2;
s1: if(set)
nextstate=temp;
else nextstate=s2;
s2:if(set) nextstate=s3;
else nextstate=temp;
s3: nextstate=temp;
default:nextstate=temp;
endcase
end
- 关键路径的选取
- 数字电路中关键路径的选取
- 数字电路中关键路径的选取
- 图的关键路径
- 关键路径的实现
- 图的关键路径
- 图的关键路径
- 图的关键路径
- 关键路径的计算
- 图的关键路径
- 图的关键路径
- 图的关键路径
- 图的关键路径算法
- AOE图的关键路径
- AOE网上的关键路径
- 求图的关键路径
- AOE网上的关键路径
- AOE网上的关键路径
- jdk1.4的正则表达式使用介绍
- 《Photoshop CS3专家讲堂视频教程》(个人收集)
- 新的开始
- Java语言特点及开发工具JDK
- JDK 和 J2EE 的安装
- 关键路径的选取
- php技巧
- 第四次作业
- JDK1.4中工具有哪些改变
- 黑客攻击步骤-如何获得IP
- J2SE1.4的I/O新特性
- 16岁少年网站骗来25万英镑,背负100多项罪名
- JDK1.4下实现访问WIN32注册表
- 顺序队列的基本操作