第5章门级建模.ppt_第1页
第5章门级建模.ppt_第2页
第5章门级建模.ppt_第3页
第5章门级建模.ppt_第4页
第5章门级建模.ppt_第5页
已阅读5页,还剩37页未读 继续免费阅读

下载本文档

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

文档简介

第5章门级建模 在门级抽象层次上 电路是用表示门的术语来描述的 如用and nand来描述 在verilog描述和电路的逻辑图之间存在着一一对应的关系 1 门的类型2 门的延迟 对于具有数字逻辑基础知识的用户很直观 5 1门的类型 与门和或门缓冲器 非门实例数组举例 5 1 1与门和或门 andnandornorxorxnor门的端口列表中的第一个端口必定是输出端口 其后为输入端口anda1 out in1 in2 ora2 out in1 in2 in3 nand out in1 in2 in3 in4 具有一个标量输出端和多个标量输入端 具体实例名 无具体实例名 5 1 2缓冲器 非门 基本缓冲器 非门 bufnotbuf和not可以具有多个输出端口 但只能具有一个输入端口 这个输入端口必须是实例端口表的最后一个 举例 bufb1 out1 out2 in 带控制端的缓冲器 非门 bufif1bufif0notfif1notfif0举例 bufif1 out in ctrl notfif0 out in ctrl 具有一个标量输入端和多个标量输出端 在某些情况下 例如当一个信号由多个驱动源驱动时 我们可以这样来设计驱动源 让它们的控制信号互相错开 从而避免一条信号线同时被两个源驱动 这时就需要使用这些带有控制端的缓冲器 非门来搭建电路 微处理器 微处理器 总线 存储器 接口电路和外设的逻辑关系 5 1 3实例数组 5 1 4举例 门级多路选择器四位脉动进位全加器 例一 门级多路选择器 4选1 功能说明 门级多路选择器 4选1 原理图设计块 门级多路选择器 4选1 门级语言描述设计块 modulemux41 out s1 s0 D0 D1 D2 D3 outputout inputD0 D1 D2 D3 inputs1 s0 wirens1 ns0 wirey0 y1 y2 y3 中间信号 内部连线 not ns1 s1 not ns0 s0 and y0 D0 ns1 ns0 y1 D1 ns1 s0 y2 D2 s1 ns0 y3 D3 s1 s0 or out y0 y1 y2 y3 endmodule 门级多路选择器 4选1 门级语言描述激励块 modulemux41stimulus regin0 in1 in2 in3 regs0 s1 wireout mux41mymux out s1 s0 in0 in1 in2 in3 initialbeginin0 1 in1 0 in2 1 in3 0 1 display in0 b in1 b in2 b in0 b n in0 in1 in2 in3 s1 0 s0 0 1 display s1 b s0 b out b n s1 s0 out s1 0 s0 1 1 display s1 b s0 b out b n s1 s0 out s1 1 s0 0 1 display s1 b s0 b out b n s1 s0 out s1 1 s0 1 1 display s1 b s0 b out b n s1 s0 out endendmodule in0 1 in1 0 in2 1 in3 0 s1 0 s0 0 out 1 s1 0 s0 1 out 0 s1 1 s0 0 out 1 s1 1 s0 1 out 0 例二 四位脉动进位全加器 模块实例化语句体现层次设计 一位全加器四位脉动进位全加器 一位全加器的原理图设计 一位全加器的门级描述 modulefadder1bit a b ci s cout inputa b ci outputs cout wirehadd1 hc1 hc2 中间信号 内部连线 xoru1 hadd1 a b u2 s hadd1 ci andu3 hc1 hadd1 ci u4 hc2 a b oru5 cout hc1 hc2 endmodule modulefadder1bittest wiresum cout rega b cin fadder1bitu1 a b cin sum cout initialbegin monitor hello time a bb bcin bsum bcout b a b cin sum cout 20a 0 b 0 cin 0 20a 0 b 0 cin 1 20a 0 b 1 cin 0 20a 0 b 1 cin 1 20a 1 b 0 cin 0 20a 1 b 0 cin 1 20a 1 b 1 cin 0 20a 1 b 1 cin 1 endinitial 300 finish endmodule 四位脉动进位全加器的原理图设计 四位脉动进位全加器的设计块 modulefadder4bit a b ci s cout input 3 0 a b inputci output 3 0 s outputcout wire 2 0 c1 fadder1bitu0 a 0 b 0 ci s 0 c1 0 u1 a 1 b 1 c1 0 s 1 c1 1 u2 a 2 b 2 c1 1 s 2 c1 2 u3 a 3 b 3 c1 2 s 3 cout endmodule 激励块 modulefadder4bitstimulus reg 3 0 a b regcin wire 3 0 sum wirecout fadder4bitfa a b cin sum cout initialbegin monitor time a d b d cin d sum d cout b n a b cin sum cout endinitialbegina 4 d0 b 4 d0 cin 1 d0 5a 4 d3 b 4 d4 5a 4 d2 b 4 d5 5a 4 d9 b 4 d9 5a 4 d10 b 4 d15 5a 4 d10 b 4 d5 cin 1 d1 endendmodule 0a 0 b 0 cin 0 sum 0 cout 0 5a 3 b 4 cin 0 sum 7 cout 0 10a 2 b 5 cin 0 sum 7 cout 0 15a 9 b 9 cin 0 sum 2 cout 1 20a 10 b 15 cin 0 sum 9 cout 1 25a 10 b 5 cin 1 sum 0 cout 1 5 2门延迟 上升 下降和关断延迟最小 典型 最大延迟 上升 下降和关断延迟 上升延迟 在门的输入发生变化的情况下 门的输出从0 X Z变化为1所需的时间 下降延迟 指门的输出从1 X Z变化为0所需的时间 关断延迟 指门的输出从0 1 X变化为Z所需的时间 如果值变化到不确定值X 则所需的时间可以看成是以上三种延迟值中最小的那个 and delay time a1 out i1 i2 and rise val fall val a1 out i1 i2 and rise val fall val turnoff val a1 out i1 i2 and 5 a1 out i1 i2 and 4 6 a1 out i1 i2 and 3 4 5 a1 out i1 i2 最小 典型 最大延迟 仿真 最小延迟 设计者预期逻辑门所具有的最小延迟最大延迟 设计者预期逻辑门所具有的最大延迟典型延迟 设计者预期逻辑门所具有的典型延迟 and 2 3 4 3 4 5 4 5 6 a3 out i1 i2 元件例化语句 自上而下层次化设计的重要途径 实质 引入一种连接关系 连接底层模块底层模块种类 Verilog设计模块 FPGA元件库中的元件 其他HDL语音的设计模块 IP核格式 例化元件端口 例化元件外接端口名 hadderu2 a e b cin co f so sum 4 连接方式 端口名关联法位置关联法hadderu1 ain bin e d 5 4习题 modulemy or out1 a b inputa b outputout1 wireo1 o2 nandn1 o1 a nandn2 o2 b nandn3 out1 o1 o2 endmodule modulemy and out2 a b inputa b outputout2 wireo1 nandn4 o1 a b nandn5 out1 o1 endmodule modulemy not out3 a inputa outputout3 nandn6 out3 a endmodule 5 1 modulemy xor z x y inputx y outputz wirenx ny z1 z2 my not nx x my not ny y my and z1 nx y z2 ny x my or z z1 z2 endmodule moduletestxor regx y wirez my xorx1 z x y initialbeginx 0 y 0 1display x by bz b x y z x 0 y 1 1display x by bz b x y z x 1 y 0 1display x by bz b x y z x 1 y 1 1display x by bz b x y z endmodule 5 2 modulefadd a b cin sum c out inputa b cin outputsum c out wirena ab ncin wirem1 m2 m3 m4 m5 m6 m7 anda1 m1 a b cin a2 m2 na b ncin a3 m3 a nb ncin a4 m4 na na cin andb1 m5 a b b2 m6 a cin b3 m7 b cin notn1 na a n2 nb b n3 ncin cin orr1 sum m1 m2 m3 m4 orr2 c out m5 m6 m7 endmodule 5 3 1设计块 modulefaddtest wiresum cout rega b cin faddu1 a b cin sum cout initialbegin monitor hello time a bb bcin bsum bcout b a b cin sum cout 20a 0 b 0 cin 0 20a 0 b 0 cin 1 20a 0 b 1 cin 0 20a 0 b 1 cin 1 20a 1 b 0 cin 0 20a 1 b 0 cin 1 20a 1 b 1 cin 0 20a 1 b 1 cin 1 endinitial 300 finish endmodule 5 3 2激励块 设计块modulesr latch q qbar set reset outputq qbar inputset reset nor 1n1 qbar set q nor 1n2 q reset qbar endmodule 激励块 验证块moduletop wireq qbar regset reset sr latch 1m1 q qbar set reset initialbegin monitor time set b reset b q b n set reset q set 0 reset 0 5reset 1 5reset 0 5set 1 endendmodule 5 4 modulemux21buf in1 in0 s out inputin1 in0 inputs outp

温馨提示

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

评论

0/150

提交评论