数字设计基础双语课件(第10章)_第1页
数字设计基础双语课件(第10章)_第2页
数字设计基础双语课件(第10章)_第3页
数字设计基础双语课件(第10章)_第4页
数字设计基础双语课件(第10章)_第5页
已阅读5页,还剩22页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 10. Behavioral and Structural Descriptions 10.1 An example 10.2 The dataflow description10.3 Structural VHDL10.4 Processes10.5 Sequential and concurrent VHDL1 10.1 An example Example: a Four-bit adder sum = x + y;Describe a 4-bit adder in VHDL 1111110011101010100110110010100110000000Carry outSumCar

2、ry inyx2 10.1 An example Circuit diagram 3 10.2 The dataflow descriptiona behavioral description of the full adder LIBRARY ieee;USE ieee.std_logic_1164.ALL;ENTITY fulladd IS PORT ( x, y, cin: IN STD_LOGIC; sum, cout: OUT STD_LOGIC);END ENTITY fulladd;ARCHITECTURE simple OF fulladd ISBEGIN sum = cin

3、XOR x XOR y; cout = ( x AND y ) OR ( cin AND x ) OR ( y AND cin );END ARCHITECTURE simple;4 10.2 The dataflow description1. Local signals Full adder circuit with the internal nodes n1, n2, n3, n4 are the internal nodes of the circuit 5 10.2 The dataflow descriptionARCHITECTURE number3 OF fulladd IS

4、SIGNAL n1, n2, n3, n4: STD_LOGIC;BEGIN n1 = x XOR y; sum = cin XOR n1; n2 = x AND y; n3 = cin AND x; n4 = y AND cin; cout = n2 OR n3 OR n4;END ARCHITECTURE number3;the VHDL description is changed toLocal signals n1, n2, n3 and n4 as part of the description 6 10.2 The dataflow description2. Concurren

5、t processing ARCHITECTURE number3 OF fulladd IS SIGNAL n1, n2, n3, n4: STD_LOGIC;BEGIN n1 = x XOR y; sum = cin XOR n1; n2 = x AND y; n3 = cin AND x; n4 = y AND cin; cout = n2 OR n3 OR n4;END ARCHITECTURE number3;Lets Consider the two descriptions (1)7 10.2 The dataflow descriptionARCHITECTURE number

6、4 OF fulladd IS SIGNAL n1, n2, n3, n4: STD_LOGIC;BEGIN sum = cin XOR n1; cout = n2 OR n3 OR n4; n1 = x XOR y; n2 = x AND y; n3 = cin AND x; n4 = y AND cin;END ARCHITECTURE number4;(2)8 10.2 The dataflow descriptionAlthough they are written in a different order, they do exactly the same thing. Unlike

7、 programming languages, VHDL normally monitors all statements at the same time, and executes a statement when one of its right hand side (RHS) values changes. This is called concurrent execution.Concurrent execution9 10.2 The dataflow description3. Dataflow VHDL In the jargon of VHDL, the style of c

8、oding that the outputs and inputs are related through Boolean or arithmetic operators and all statements operate concurrently, is called dataflow.10 10.3 Structural VHDL1. The work library When designs are compiled they are placed into a library ready to be used by other designs. By default, the cur

9、rent working library is called work.When compiled, it is added to the work library. ARCHITECTURE simple OF fulladd ISBEGIN sum = cin XOR x XOR y; cout x(0), y=y(0), cin=cin, sum=sum(0), cout=carry(1);This is called named association. With named association, the order doesnt matter.18 10.4 Processes

10、1. Sensitivity listsARCHITECTURE simple OF fulladd IS -1BEGIN -2 cout = ( x AND y ) OR ( cin AND x ) OR ( y AND cin ); -3 sum = cin XOR x XOR y; -4END ARCHITECTURE simple; -5Statement 3 will run whenever a right hand side value changes. So it runs when x, y or cin changes. In the jargon of VHDL, sta

11、tement 3 is sensitive to signals x, y, cin. Its sensitivity list is x, y, cin. A change in a signal is called an event on that signal. So statement 3 runs whenever there is an event on a signal on its sensitivity list.19 10.4 Processes Statements 3 and 4 are concurrent, i.e. they are both active at

12、the same time, and are triggered by an event on a signal on their sensitivity lists.2. The structure of a process PROCESS ( sensitivity list )BEGIN Statement 1; Statement 2; Statement 3;END PROCESS;20 10.4 Processes (1) The process waits until it is triggered by an event on one of the signals in its

13、 sensitivity list.(2) When it is triggered it executes each of the statements in its body sequentially.(3) During execution of the process, all signal values are frozen and are not updated or changed in any way during the execution of the process(4) The LHS signals all receive their new value after

14、the process has suspended its execution.21 10.4 Processes VHDL description in processes ARCHITECTURE all_in_one OF fulladd IS BEGIN PROCESS (x, y, cin) BEGIN cout = ( x AND y ) OR ( cin AND x ) OR ( y AND cin ); sum = cin XOR x XOR y; END PROCESS; END ARCHITECTURE all_in_one; 22 10.4 Processes 3. Th

15、e WAIT statement Instead of using a sensitivity list, we can the timing of execution of a process by using a WAIT statement. ARCHITECTURE using_wait OF fulladd IS BEGIN PROCESS BEGIN WAIT ON x, y, cin; cout = ( x AND y ) OR ( cin AND x ) OR ( y AND cin ); sum = cin XOR x XOR y; END PROCESS; END ARCH

16、ITECTURE using_wait; 23 10.5 Sequential and concurrent VHDL1. Sequential and concurrent conditionals (1)Sequential IF blockIF condition_1 THEN sequence of statements;ELSIF condition_2 THEN sequence of statements;ELSE sequence of statements;END IF;24 10.5 Sequential and concurrent VHDL(2) Concurrent

17、WHEN statement a = value1 WHEN condition1 ELSE value2 WHEN conditon2 ELSE value3;25 10.5 Sequential and concurrent VHDL2. Sequential and concurrent selectionENTITY declaration a 4-input multiplexer LIBRARY ieee;USE ieee.std_logic_1164.all;ENTITY mux4to1 IS PORT ( address: IN STD_LOGIC_VECTOR(1 DOWNTO 0); data: IN STD_LOGIC_VECTOR(3 DOWNTO 0); y: out STD_LOGIC);END mux4to1;26 10.5 Sequential and concurrent VHDLThe operation of selecting one of the data lines to the output y depending on the value of address is accomplished in concurrent VHDL using a SELECT state

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论