![数字设计基础双语课件(第11章)_第1页](http://file4.renrendoc.com/view/a784cf7dd4fd36d1fa4c4c463af9a85b/a784cf7dd4fd36d1fa4c4c463af9a85b1.gif)
![数字设计基础双语课件(第11章)_第2页](http://file4.renrendoc.com/view/a784cf7dd4fd36d1fa4c4c463af9a85b/a784cf7dd4fd36d1fa4c4c463af9a85b2.gif)
![数字设计基础双语课件(第11章)_第3页](http://file4.renrendoc.com/view/a784cf7dd4fd36d1fa4c4c463af9a85b/a784cf7dd4fd36d1fa4c4c463af9a85b3.gif)
![数字设计基础双语课件(第11章)_第4页](http://file4.renrendoc.com/view/a784cf7dd4fd36d1fa4c4c463af9a85b/a784cf7dd4fd36d1fa4c4c463af9a85b4.gif)
![数字设计基础双语课件(第11章)_第5页](http://file4.renrendoc.com/view/a784cf7dd4fd36d1fa4c4c463af9a85b/a784cf7dd4fd36d1fa4c4c463af9a85b5.gif)
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、 11. VHDL simulation 11.1 Simulation 11.2 VHDL simulation of dataflow code 11.3 Simulation of structural VHDL11.4 The uninitialized logic value 11.5 Delay modeling11.6 Test benches 1 11.1 SimulationVHDL descriptions must be simulated to confirm that they behave as required. Simulation allows us to a
2、pply inputs, and then trace how the rest of the circuit evolves with time as the influence of the new inputs propagates through towards the outputs. We can then compare the predicted outputs for our design to the desired outputs. If there are no differences then we can conclude that our design is co
3、rrect.2 11.2 VHDL simulation of dataflow code Event A change to a signal that is scheduled to take place at a certain time is called an event. The VHDL simulation proceeds by manipulating an event queue. Event queueA VHDL statement only executes when a value on the RHS changes. 1. Some terms on simu
4、lation3 11.2 VHDL simulation of dataflow code The VHDL description of a full adder ARCHITECTURE number3 OF fulladd IS SIGNAL n1, n2, n3, n4: STD_LOGIC;BEGIN n1 = x XOR y; - Statement 1 sum = cin XOR n1; - Statement 2 n2 = x AND y; - Statement 3 n3 = cin AND x; - Statement 4 n4 = y AND cin; - Stateme
5、nt 5 cout = n2 OR n3 OR n4; - Statement 6END ARCHITECTURE number3;2. Example for simulation4 11.2 VHDL simulation of dataflow code Assumed that all signals are initially at zero. Time = 0It has a list of the present value for each signal, any new value that has been scheduled to take place in future
6、, and the time at which the signal must assume this new value. 3. Process for simulation5 11.2 VHDL simulation of dataflow code All statements 1-6 are scanned simultaneously. The event on x triggers the execution of the statements:n1 = x XOR y; n2 = x AND y; n3 = cin AND x;Time = 10If the new value
7、is different from the old value, it is placed on the event queue. 6 11.2 VHDL simulation of dataflow code VHDL simulation uses an infinitesimal time intervalto keep track of the delays that happen to signals as they are assigned. At time 10+, n1 takes its new value, which triggers:sum = cin XOR n1;
8、Time = 10+7 11.2 VHDL simulation of dataflow code At time 10+2,sum takes its new value. Time = 10+2There are no statements with sum on the RHS, so no further statements are triggered. 8 11.3 Simulation of structural VHDLThe VHDL code for the adder is LIBRARY ieee;USE ieee.std_logic_1164.ALL;ENTITY a
9、dder IS PORT ( x, y: IN STD_LOGIC_VECTOR(3 DOWNTO 0); cin: IN STD_LOGIC; sum: OUT STD_LOGIC_VECTOR(3 DOWNTO 0); cout: OUT STD_LOGIC);END ENTITY adder;ARCHITECTURE structural OF adder IS SIGNAL carry: STD_LOGIC_VECTOR(4 DOWNTO 0);BEGIN c0: entity work.fulladd(dataflow) PORT MAP (x(0),y(0),cin,sum(0),
10、carry(1);9 11.3 Simulation of structural VHDL c1: entity work.fulladd(dataflow) PORT MAP (x(1),y(1),carry(1),sum(1),carry(2); c2: entity work.fulladd(dataflow) PORT MAP (x(2),y(2),carry(2),sum(2),carry(3); c3: entity work.fulladd(dataflow) PORT MAP (x(3),y(3),carry(3),sum(3),cout); END ARCHITECTURE
11、structural;ContinuedDuring simulation all statements are active at the same time, and will be triggered to execute and re-compute their output values if any of their input signals changes.10 11.4 The uninitialized logic value When a digital electronic device is switched on, all bits stored in flip-f
12、lops and memory will initially go to a random value which could be a 1 and could be a 0. This is the value that VHDL refers to as U. It is important for simulation to verify that these random initialization values do not corrupt the subsequent behavior of the device. Normally, the simulator will ini
13、tialize all internal signals to U instead of 0 and trigger an event on all signals. 1. The uninitialized logic value U 11 11.4 The uninitialized logic value The initial condition of the queue is:Time = 0At time 0+, signals n1 to n4 receive their new values. This triggers computing new values for sum
14、 and cout.2. Process for simulation12 11.4 The uninitialized logic value Time = 0+At time 0+2,sum and cout receive their new values.13 11.4 The uninitialized logic value In this case, the U value simply causes the internal signals and the output values to be unknown for an infinitesimal period of ti
15、me, and has had no lasting effect on any of the signals. Time = 0+214 11.5 Delay modelingReal logic gates have a delay: when we change the inputs, the corresponding output appears some time later. Exp1: a 2-input Ex-OR gate with a 5 ns gate delay LIBRARY ieee;USE ieee.std_logic_1164.ALL;ENTITY xor2
16、is PORT ( a, b: IN STD_LOGIC; c: OUT STD_LOGIC);END ENTITY xor2;ARCHITECTURE delayed OF xor2 ISBEGIN c = a XOR b AFTER 5 NS;END ARCHITECTURE delayed;15 11.5 Delay modelingSimulation of the XOR gate with delay 16 11.6 Test benches The goal of simulation is to verify that a design has the required fun
17、ctionality. This is accomplished by a VHDL test bench. 1. Test benchesA test bench is a VHDL description that takes a copy of a design, applies test inputs to the design and compares the outputs from the design with the required outputs. If the actual outputs match the required outputs for all input
18、 conditions then the design is judged to be correct.17 11.6 Test benches The general appearance of a VHDL test bench ENTITY testbench ISEND ENTITY testbench;ARCHITECTURE tb OF testbench IS Declare all the test signals that will be connect to the inputs and outputs of the device we are testingBEGIN P
19、lace one copy of the design under test, and wire its inputs and outputs up to test signals Generate test waveforms that are applied to the inputs Observe the outputs from the design and compare them with the required results. Report if any discrepancies are found.END ARCHITECTURE tb;18 11.6 Test ben
20、ches 2. The ASSERT statementThe ASSERT statement provides a way to tell the VHDL tools what conditions we believe ought to be true if the design is functioning correctly. Its syntax isASSERT condition REPORT message SEVERITY severityThe condition shows what should be happening. If the condition is f
21、alse, then a message is printed, and an error is generated of the stated severity. The severity can be NOTE, WARNING, ERROR, or FAILURE. 19 11.6 Test benches 3. A test bench for the 4-bit adderTest bench for the 4-bit adder circuit20 11.6 Test benches Generate the inputs PROCESSBEGIN FOR I IN 0 TO 15 LOOP FOR J IN 0 TO 15 LOOP - Set the inputs to the adder TestIn1 = CONV_STD_LOGIC_VECTOR(i,4); TestIn2 = CONV_STD_LOGIC_VECTOR(j,4); END LOOP; END LOOP;END PROCESS;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年锂辉石合作协议书
- 2025年气体检测设备合作协议书
- 2025年印刷品、记录媒介复制品合作协议书
- 2025年买卖个人房屋合同(4篇)
- 2025年临时工聘用合同协议标准版本(三篇)
- 山西省2024七年级道德与法治上册第二单元成长的时空第七课在集体中成长情境基础小练新人教版
- 2025年临时工解除合同样本(2篇)
- 2025年人防门制作安装工程施工合同模板(2篇)
- 2025年个人无息借款合同经典版(2篇)
- 2025年二人合作经营协议参考模板(三篇)
- 使用错误评估报告(可用性工程)模版
- 六年级语文下册阅读及参考答案(12篇)
- 《发展汉语(第二版)中级综合(Ⅰ)》第7课+课件
- 第四章《数列》复习小结示范公开课教学PPT课件【高中数学人教A版】
- GB/T 8944.1-2008纸浆成批销售质量的测定第1部分:浆板浆包及浆块(急骤干燥浆)浆包
- 苏教版(苏少版)九年级美术下册全册课件
- 2022年江苏省盐城市中考英语试题及参考答案
- 中国文化简介英文版(ChineseCultureintroduction)课件
- 文化差异与跨文化交际课件(完整版)
- 工程经济学完整版课件全套ppt教程
- 鼻空肠营养的护理及注意事项ppt
评论
0/150
提交评论