VHDL语言综合问题.docx

上传人:b****5 文档编号:6470579 上传时间:2023-01-06 格式:DOCX 页数:16 大小:103.48KB
下载 相关 举报
VHDL语言综合问题.docx_第1页
第1页 / 共16页
VHDL语言综合问题.docx_第2页
第2页 / 共16页
VHDL语言综合问题.docx_第3页
第3页 / 共16页
VHDL语言综合问题.docx_第4页
第4页 / 共16页
VHDL语言综合问题.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

VHDL语言综合问题.docx

《VHDL语言综合问题.docx》由会员分享,可在线阅读,更多相关《VHDL语言综合问题.docx(16页珍藏版)》请在冰豆网上搜索。

VHDL语言综合问题.docx

VHDL语言综合问题

所有程序的仿真都是采用QuartusII4.1编译的!

libraryieee;

useieee.std_logic_1164.all;

entityDFF3is

port(clk,d1:

instd_logic;

q1:

outstd_logic

);

endentity;

architectureoneofDFF3is

signala,b:

std_logic;

begin

process(clk)

begin

ifclk'eventandclk='1'then

a<=d1;

b<=a;

q1<=b;

endif;

endprocess;

endarchitecture;

进程中信号赋值的并行性!

libraryieee;

useieee.std_logic_1164.all;

entitytestis

port(clk,d1:

instd_logic;

q1:

outstd_logic

);

endentity;

architectureoneoftestis

begin

process(clk)

variableqq:

std_logic;

begin

ifclk'eventandclk='1'then

qq:

=d1;变量的顺序性

endif;

q1<=qq;

endprocess;

endarchitecture;

与设想的一样!

libraryieee;

useieee.std_logic_1164.all;

entitytestis

port(clk,d1:

instd_logic;

q1:

outstd_logic

);

endentity;

architectureoneoftestis

signalqq:

std_logic;

begin

process(clk)

--variableqq:

std_logic;

begin

ifclk'eventandclk='1'then

qq<=d1;进程中信号赋值的并行性!

endif;

q1<=qq;进程中信号赋值的并行性

endprocess;

endarchitecture;

图与设想的不一样,如果是并行赋值的话,应该再出一个寄存器才对嘛,体现不出来信号赋值的并行性!

我觉得书上说得进程中信号赋值的并行性有问题,应该是在相同的结构中的信号赋值语句才具有并行性!

例如:

ifclk'eventandclk='1'then

a<=d1;

b<=a;

q1<=b;

endif;

都是在ifclk'eventandclk='1'then后面的赋值语句,“a<=d1;b<=a;q1<=b;”具有相同的地位,才具有并行性。

process(clk)

--variableqq:

std_logic;

begin

ifclk'eventandclk='1'then

qq<=d1;进程中信号赋值的并行性!

endif;

q1<=qq;进程中信号赋值的并行性

endprocess;

中的信号d1和qq就没有并行性,应该还是顺序赋值的!

包括并行语句中的类似情况例如:

A<=b;b<=c;c<=d;最后的综合结果还是将d赋值给a;还是顺序执行的,并行语句的并行性应该是不同信号赋值语句之间的并行性例如:

a<=b;d<=d;f<=e;他们都是并行执行的!

对于有关联性的赋值语句应该还是顺序性的!

我觉得上面的问题应该用时序电路和组合电路的关系来解释比较恰当,时序电路是当前输入和当前状态的函数,而组合电路时当前输入的函数,进程中所谓的并行赋值语句应该是时序电路的原因,在同一个时刻,由于时序电路中的不完整条件语句,要有多个信号被同时锁存,所以才会产生信号赋值的并行性,而不是进程中的所有信号都是同时赋值的,进程中的组合电路的信号还是顺序赋值的!

多驱动源问题:

在解决了这个问题,应该就没什么问题了!

老师帮我一下!

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityconter1is

port(clk,enable,load,reset:

instd_logic;

datain:

instd_logic_vector(2downto0);

q:

outstd_logic_vector(2downto0)

);

endentity;

architecturebehvofconter1is

signalreg:

std_logic_vector(2downto0);

begin

process(clk,enable,reset,load)

begin

ifreset='1'thenreg<=(others=>'0');

elsifclk'eventandclk='1'then

ifload='1'thenreg<=datain;两个if语句对同一个信号源赋值,综合的电路是对的,并

endif;没有出现严重的错误!

但是load和enable的赋值优先级

ifenable='1'thenreg<=reg-1;却是看不出来的!

经过综合仿真后发现enable的优先级要

endif;比load高!

endif;

q<=reg;

endprocess;

endarchitecture;

在进程中的多驱动源问题:

例A

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitytestis

port(a:

instd_logic_vector(1downto0);

d,e,f:

instd_logic_vector(1downto0);

q:

outstd_logic_vector(1downto0)

);

endentity;

architectureoneoftestis

signals:

std_logic_vector(1downto0);

begin

process(a,d,e,f)

begin

ifa="00"thens<=d;

--elses<="00";

endif;

ifa="01"thens<=e;这应该也是进程中的顺序等价语句吧?

--elses<="00";

endif;

ifa="10"thens<=f;

--elses<="00";

endif;

q<=s;

endprocess;

endarchitecture;

但是并没有报错,也没说是多驱动源问题!

也没出现空的输入端!

奇怪!

加上else语句就会出现空的输入端!

不理解!

例B

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitytestis

port(a:

instd_logic_vector(1downto0);

d,e,f:

instd_logic_vector(1downto0);

q:

outstd_logic_vector(1downto0)

);

endentity;

architectureoneoftestis

signals:

std_logic_vector(1downto0);

begin

process(a,d,e,f)

begin

ifa="00"thens<=d;

elses<="00";

endif;

ifa="01"thens<=e;

elses<="00";

endif;

ifa="10"thens<=f;

elses<="00";

endif;

q<=s;

endprocess;

endarchitecture;

例A和例B也是多驱动源问题,差别就是有没有else语句,也就是完整条件语句和不完整条件语句的差别,我觉得例A应该和例B出现同样的情况!

但综合结果却是大相径庭!

为什么?

怎么才能说得通?

例1:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitytestis

port(a,b,c:

instd_logic_vector(1downto0);

d,e,f:

instd_logic_vector(1downto0);

q:

outstd_logic_vector(1downto0)

);

endentity;

architectureoneoftestis

signals:

std_logic_vector(1downto0);

begin

process(a,d,e,f)

begin

ifa="00"thens<=d;

elses<="ZZ";

endif;

ifb="01"thens<=e;

elses<="ZZ";

endif;

ifc="10"thens<=f;

elses<="ZZ";

--endif;

endif;

q<=s;

endprocess;

endarchitecture;

例2:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitytestis

port(a,b,c:

instd_logic_vector(1downto0);

d,e,f:

instd_logic_vector(1downto0);

q:

outstd_logic_vector(1downto0)

);

endentity;

architectureoneoftestis

signals:

std_logic_vector(1downto0);

begin

process(a,d,e,f)

begin

ifa="00"thens<=d;

--elses<="ZZ";

endif;

ifb="01"thens<=e;这应该也是进程中的顺序等价语句吧?

--elses<="ZZ";

endif;

ifc="10"thens<=f;

--elses<="ZZ";

--endif;

endif;

q<=s;

endprocess;

endarchitecture;

例1和例2都是在进程中的多驱动源赋值语句但是例1不能综合或者说综合出来的结果不正确,例2却能综合,综合后的结果赋值优先级从高到低依次是c,b,a;虽然从程序上看不出谁的优先级要高,但是它的综合结果却比例1好多了!

我本来想例2应该和例1出现相同的情况,因为都是多驱动源问题,但是例2的结果出乎我的预料,为什么?

怎样才能讲通?

(例1是EDA课本上的例题)

并行语句中的多驱动源问题:

libraryieee;

useieee.std_logic_1164.all;

entitytristate1is

port(input3,input2,input1,input0:

instd_logic;

enable:

instd_logic_vector(1downto0);

output:

outstd_logic

);

endentity;

architectureoneoftristate1is

begin

process(enable,input3)

variablea:

std_logic;

begin

ifenable="00"thenoutput<=input3;

elseoutput<='Z';

endif;

endprocess;

process(enable,input2)

begin

ifenable="01"thenoutput<=input2;

elseoutput<='Z';

endif;

endprocess;

process(enable,input1)

begin

ifenable="10"thenoutput<=input1;

elseoutput<='Z';

endif;

endprocess;

process(enable,input0)

begin

ifenable="11"thenoutput<=input0;

elseoutput<='Z';

endif;

endprocess;

endarchitecture;

如果改成下面的样子,居然同样能综合,下面应该是一个严重的多驱动源问题,因为enable,a,b,c可以同时满足条件,三个输入会同时加到输出,应该会产生竞争冒险吧?

综合后的电路图也有这个毛病!

libraryieee;

useieee.std_logic_1164.all;

entitytristate1is

port(input3,input2,input1,input0:

instd_logic;

a,b,c,enable:

instd_logic_vector(1downto0);

output:

outstd_logic

);

endentity;

architectureoneoftristate1is

begin

process(enable,input3)

begin

ifenable="00"thenoutput<=input3;

elseoutput<='Z';

endif;

endprocess;

process(a,input2)

begin

ifa="01"thenoutput<=input2;

elseoutput<='Z';

endif;

endprocess;

process(b,input1)

begin

ifb="10"thenoutput<=input1;

elseoutput<='Z';

endif;

endprocess;

process(c,input0)

begin

ifc="11"thenoutput<=input0;

elseoutput<='Z';

endif;

endprocess;

endarchitecture;

为什么下面去掉else语句后就出现多驱动源问题的错误呢?

libraryieee;

useieee.std_logic_1164.all;

entitytristate1is

port(input3,input2,input1,input0:

instd_logic;

enable:

instd_logic_vector(1downto0);

output:

outstd_logic

);

endentity;

architectureoneoftristate1is

begin

process(enable,input3)

variablea:

std_logic;

begin

ifenable="00"thenoutput<=input3;

--elseoutput<='Z';

endif;

endprocess;

process(enable,input2)

begin

ifenable="01"thenoutput<=input2;

--elseoutput<='Z';

endif;

endprocess;

process(enable,input1)

begin

ifenable="10"thenoutput<=input1;

--elseoutput<='Z';

endif;

endprocess;

process(enable,input0)

begin

ifenable="11"thenoutput<=input0;

--elseoutput<='Z';

endif;

endprocess;

endarchitecture;

Error:

Can'tresolvemultipleconstantdriversfornetoutputattristate1.vhd(24)

Error:

Constantdriverattristate1.vhd(30)

Error:

Can'telaborateuserhierarchy

Error:

QuartusIIAnalysis&Synthesiswasunsuccessful.3errors,3warnings

Error:

Processingended:

SatSep2222:

53:

072007

Error:

Elapsedtime:

00:

00:

00

Error:

QuartusIIFullCompilationwasunsuccessful.3errors,3warnings

进程中不完整条件语句可以综合,结构体中完整条件语句可以综合,

不完整条件语句构成时序电路,完整条件语句构成组合电路!

进程一般用于时序电路,具有顺序性,结构体一般用于组合电路,具有并行性!

是不是有什么联系?

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1