版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、 12. Describe sequential systems in VHDL 12.1 Defining clocks, flip-flops and registers 12.2 Register Transfer Level (RTL) Coding12.3 Sequential logic 1 12.1 Defining clocks, flip-flops & registers 1. Defining a clock signal PROCESSBEGIN clock = 0;WAIT FOR 10 NS; clock = 1WAIT FOR 10 NS;END PROCESS;
2、There are many ways to define a clock. For example:Simulation waveform 2 12.1 Defining clocks, flip-flops & registers 2. The D-type flip-flopLIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;ENTITY dff IS PORT ( d, clock: IN STD_LOGIC; Q: OUT STD_LOGIC);END ENTITY dff;ARCHITECTURE correct OF dff ISBEGIN PROC
3、ESS (clock) BEGIN IF ( rising_edge(clock) ) THEN q = d; END IF; END PROCESS;END ARCHITECTURE correct;3 12.1 Defining clocks, flip-flops & registers 3. The D-type flip-flop with reset If the Reset is synchronous, then it is ignored until the rising edge of the clock. When the rising edge comes, if Re
4、set=1 then q goes to 0. If Reset=0, then the flip-flop exhibits normal behavior, i.e. q=d. (1)If the Reset is synchronous4 12.1 Defining clocks, flip-flops & registers LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL; - D-type flip-flopENTITY dff IS PORT ( d : IN STD_LOGIC; - Data input clock: IN STD_LOGIC;
5、 - Clock input reset: IN STD_LOGIC; - Reset input Q : OUT STD_LOGIC); - OutputEND ENTITY dff;ENTITY definition 5 12.1 Defining clocks, flip-flops & registers ARCHITECTURE synch_reset OF dff ISBEGIN PROCESS (clock) BEGIN IF ( rising_edge(clock) ) THEN IF ( reset=1 ) THEN q = 0; ELSE q = d; END IF; EN
6、D IF; END PROCESS;END ARCHITECTURE synch_reset;Architecture declaration6 12.1 Defining clocks, flip-flops & registers If the Reset is asynchronous, then it takes immediate effect, no matter what the clock is doing. This means that the flip-flop is always sensitive to its Reset input. (2)If the Reset
7、 is asynchronous7 12.1 Defining clocks, flip-flops & registers ARCHITECTURE asynch_reset OF dff ISBEGIN PROCESS (clock, reset) BEGIN IF ( reset=1 ) THEN q = 0; ELSIF ( rising_edge(clock) ) THEN q = d; END IF; END PROCESS;END ARCHITECTURE asynch_reset;Architecture declaration should be:8 12.2 Registe
8、r Transfer Level Coding1. VHDL description of a registered adderARCHITECTURE behavioral OF adder ISBEGIN sum = a + b;END ARCHITECTURE behavioral;Behavioral description9 12.2 Register Transfer Level CodingAn obvious way to describe the adder with registered output is to instantiate 4 flip-flops at th
9、e output:ARCHITECTURE registered OF adder ISBEGIN sum sum(0), clock=clock, q=reg_sum(0) ); g2: ENTITY work.dff(correct) PORT MAP ( d=sum(1), clock=clock, q=reg_sum(1) ); g3: ENTITY work.dff(correct) PORT MAP ( d=sum(2), clock=clock, q=reg_sum(2) ); g4: ENTITY work.dff(correct) PORT MAP ( d=sum(3), c
10、lock=clock, q=reg_sum(3) );END ARCHITECTURE registered;10 12.2 Register Transfer Level Coding2. Register Transfer Level VHDLIf we want a reset signal, that can asynchronously reset the adder output to zero, the code should be:ARCHITECTURE rtl2 OF adder IS BEGIN PROCESS (clock, reset) BEGIN IF ( rese
11、t=1 ) THEN reg_sum 0); ELSIF ( rising_edge(clock) ) THEN reg_sum = a + b; end if; END PROCESS; END ARCHITECTURE rtl2;11 12.2 Register Transfer Level CodingThis style of coding is called register transfer level coding. We are using assignments to signals, but wrapping them up in processes triggered b
12、y the clock (and reset signal) in order to make it clear on what clock cycle the outputs should assume their values. 12 12.2 Register Transfer Level Coding3. VHDL variables A VHDL variable can only exist inside a process, and will assume its new value immediately whenever an assignment occurs. Like
13、c and f in the following circuit. 13 12.2 Register Transfer Level CodingARCHITECTURE fig12-10 OF adder ISBEGIN PROCESS (clock) VARIABLE e, f: SIGNED ( 31 DOWNTO 0 ); BEGIN IF ( rising_edge(clock) ) THEN c := a + b; f := d + e; sum = c + f; END IF; END PROCESS;END ARCHITECTURE fig12-10;Code listing using variables 14 12.3 Sequential logic 000001010011100101110111A Binar
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2026学年河南省洛阳市初中数学七年级期末下册点睛提升黑金考题附答案
- PCR混采检测专项考核试题及详细答案
- 铜冶炼吹炼工安全操作规程
- 2026年配电箱线路绝缘检测理论与实操模拟试卷及答案
- 2025-2026学年江苏省南通市初中历史七年级期末上册高分黑金试卷详细参考解析
- OUM运营管理岗位实操考核试题(含详细答案)
- 帕金森病吞咽障碍饮水安全照护规范共识
- 线上处方药学审核要点专家共识(2025版)
- 老旧厂区拆除及场地平整施工方案
- 中级刨工理论考试题库及答案
- 初中入团考试题型及答案
- 河北省房屋建筑和市政基础设施工程施工招标文件示范文本(2025版)
- 江苏省苏州市六区联考2024-2025学年八年级上学期期末考试物理试题(含答案)
- 《多模式镇痛篇》课件
- 吉林大学《基础英语1》2023-2024学年第一学期期末试卷
- 【MOOC】颈肩腰腿痛中医防治-暨南大学 中国大学慕课MOOC答案
- 档案柜拆装、搬运及档案搬迁项目投标方案(技术方案)
- 建筑结构荷载规范DBJ-T 15-101-2022
- 手术安全核查标准流程
- 北师大版五年级数学上册第四单元《多边形的面积》课件
- GRR-计数型(范例填写)
评论
0/150
提交评论