- 11
- 0
- 约1.72万字
- 约 86页
- 2017-01-11 发布于湖北
- 举报
(2)case 语句 case (敏感表达式) 值1:块语句1 值2:块语句2 …… 值n: 块语句n default:块语句n+1 endcase (3)for循环语句 for (表达式1;表达式2;表达式3)块语句 module mux2_1(out1, a, b, sel) ; output out1; input a, b; input sel; assign out1= sel ? b : a; endmodule 数据流描述 a b sel out1 module mux2_1(out1, a, b, sel) ; output out1; input a, b; input sel; assign out1=(sel b) | (~sel a); endmodule 数据流描述 例2 用Verilog HDL语言描述2选1的数据选择器。 module mux2_1(out1, a, b, sel) ; output out1; input a, b; input sel; reg out1; always @(sel or a or b) begin if (sel) out1 = b; else out1 = a; end endmodule module mux2_1(out1, a, b, sel) ; output out1; input a, b; input sel; reg out1; always @(sel or a or b) begin case (sel) 1’b0 : out1 = a; 1’b1 : out1 = b; endcase end endmodule 行为描述 module mux2_1(out1,a,b,sel); output out1; input a,b,sel; not (sel_, sel); and (a1, a, sel_); and (b1, b, sel); or (out1, a1, b1); endmodule 结构描述 行为描述方式: 一般使用下述语句描述,可以对组合、时序逻辑电路建模。 1)initial 语句 2)always 语句 小结: 数据流描述方式: 一般使用assign语句描述,主要用于对组合逻辑电路建模。 结构描述方式: 一般使用Primitive(内部元件)、自定义的下层模块对电路描述。主要用于层次化设计中。 4 层次化设计方法举例 例3 请用层次化的方法设计一个4位全加器,框图如下: 4-bit Adder (add4.v) 1-bit Adder (addbit.v) 1-bit Adder (addbit.v) 1-bit Adder (addbit.v) 1-bit Adder (addbit.v) 实现方案如下: module addbit (a, b, ci, sum, co); input a, b, ci; output sum, co; wire a, b, ci, sum, co, n1, n2, n3; xor (n1, a, b,); xor (sum, n1, ci); and (n2, a, b); and (n3, n1, ci); or (co, n2, n3); endmodule 一些Verilog原型(Primitive) 列出结构化的元件 并按网表连接 1. 底层模块——1位全加器实例: 模块的调用方法 基本方式: 模块名 调用名(端口名表项) 调用方式一:位置对应调用方式 调
您可能关注的文档
- (精)2011安全讲座——最新.ppt
- (精)2011安全资料培训课件——最新.ppt
- (精)2011第13章电力系统继电保护 (13-2)——最新.ppt
- (精)2011风景园林历史与理论- 02 商周秦汉——最新.ppt
- (精)2011高考地理中国的地形和气候复习——最新.ppt
- (精)2011届高三二轮复习课件(浙江):第21讲 物质的检验与性质研究的实验设计——最新.ppt
- (精)2011届中考数学专题复习训练课件2——最新.ppt
- (精)2011年 3级无损检测人员复试 专题三 特种设备无损检测仪器设备校准或核查的探讨(谢常欢)——最新.ppt
- (精)2011年版国标安规宣贯课件(线路)——最新.ppt
- (精)2011年东风商用车融资租赁方案——最新.ppt
原创力文档

文档评论(0)