计算机系统综合课程设计VerilogHDL语言初步要点.ppt

计算机系统综合课程设计VerilogHDL语言初步要点.ppt

  1. 1、本文档共236页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
P.* 例:调用门元件实现4选一数据选择器。 module mux4_1a(out,in1,in2,in3,in4,cntrl1,cntrl2); output out; input in1,in2,in3,in4,cntrl1,cntrl2; wire notcntrl1,notcntrl2,w,x,y,z; not (notcntrl1,cntrl2), (notcntrl2,cntrl2); P.* and (w,in1,notcntrl1,notcntrl2), (x,in2,notcntrl1,cntrl2), (y,in3,cntrl1,notcntrl2), (z,in4,cntrl1,cntrl2); or (out,w,x,y,z); endmodule 二. 行为描述 P.* 行为描述的目标不是对电路的具体硬件结构进行说明,仅从电路的行为和功能的角度来描述某一电路模块。 对设计者来说,采用的描述级别越高,设计越容易。所以从容易设计的角度,在电路设计中,除非一些关键路径的设计采用结构描述外,一般更多地采用行为描述方式。 P.* 例:用case语句实现4选一数据选择器。 module mux4_1b(out,in1,in2,in3,in4,cntrl1,cntrl2); output out; input in1,in2,in3,in4,cntrl1,cntrl2; reg out; always@(in1 or in2 or in3 or in4 or cntrl1 or cntrl2) P.* case({cntrl1,cntrl2}) 2b00:out=in1; 2b01:out=in2; 2b10:out=in3; 2b11:out=in4; default:out=2bx; endcase endmodule 三. 数据流描述(RTL级描述) P.* 数据流描述方式与布尔表达式比较类似,在这种描述方式中,电路不再被描述为逻辑单元之间的连接,而是被描述为一系列赋值语句。通常,在数据流描述方式中使用的是持续赋值语句assign。 P.* 三. 数据流描述(RTL级描述) 例:数据流方式描述的4选一数据选择器 module mux4_1c(out,in1,in2,in3,in4,cntrl1,cntrl2); output out; input in1,in2,in3,in4,cntrl1,cntrl2; assign out=(in1 ~cntrl1 ~cntrl2)| (in2 ~cntrl1 cntrl2)| (in3 cntrl1 ~cntrl2)| (in4 cntrl1 cntrl2); endmodule §7 Verilog HDL设计 P.* 组合逻辑电路举例 1. 三态门 P.* module tri_1(in,en,out); input in,en; output out; tri out; bufif1 b1(out,in,en); //注意三态门端口的排列顺序 endmodule P.* 用数据流方式描述的三态门: module tri_2(out,in,en); output out; input in,en; assign out = en ? in : bz; endmodule 2. 译码器 P.* module decoder_38(out,in); output[7:0] out; input[2:0] in; reg[7:0] out; always @(in) begin P.* case(in) 3d0: out=8 3d1: out=8 3d2: out=8 3d3: out=8 3d4: out=8 3d5: out=8 3d6: out=8 3d7: out=8 endcase end endmodule 3. 8-3优先编码器 P.* module encoder8_3(none_on,outcode,a,b,c,d,e,f,g,h); output none_on; output[2:0] outcode; input a,b,c,d,e,f,g,h; reg[3:0] outtemp; assign {none_on,outco

文档评论(0)

挑战不可能 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档