华中科技大学电子系郑朝霞 第3章 VerilogVerilogVerilog 基本语法主讲教师:郑朝霞硬件描述语言和数字系统设计华中科技大学电子系郑朝霞23.1 3.1 VerilogVerilogVerilog HDL HDL基本模块说明3.2 3.2 VerilogVerilogVerilog HDL HDL中的词汇约定3.3 3.3 VerilogVerilogVerilog HDL HDL 数据类型3.4 3.4 VerilogVerilogVerilog HDL HDL 运算符主要内容主要内容::华中科技大学电子系郑朝霞33.1 VerilogVerilog HDL HDL基本模块说明�module能够表示:�物理块,如IC或ASIC单元�逻辑块,如一个CPU设计的ALU部分�整个系统�每一个模块的描述从关键词module开始,有一个名称(如SN74LS74,DFF,ALU等等),由关键词endmodule结束。module是层次化设计的基本构件逻辑描述放在module内部华中科技大学电子系郑朝霞4 VerilogVerilog 模块(module)结构基本要素知识点:3.1.1 端口信息3.1.23.1.2 输入输入//输出说明3.1.3 逻辑功能描述华中科技大学电子系郑朝霞53.1.1 端口信息1,端口在模块名字后的括号中列出3,端口可以说明为input, output及inout2,端口等价于硬件的引脚(pin)�模块通过端口与外部通信华中科技大学电子系郑朝霞6Verilog 模块的结构由在module和endmodule 关键词之间的四个主要部分组成: - 1- 1. . 端口信息: module combination(a, b, c, d ); - 2- 2- 2. . 输入/输出说明 : input a, b, c ;input a, b, c ; output d ;output d ; -//-//-// 输入/输出端口信号类型声明,缺省为wire型 : - 3- 3- 3. . 内部信号: wire x; wire x; - 4- 4- 4. . 功能定义: assign d = a | x ; assign d = a | x ; assign x = ( b & ~c ); endmodule 3.1.2 端口说明华中科技大学电子系郑朝霞73.1.3 逻辑功能描述module mux2to1 (out, a, b, mux2to1 (out, a, b, selselsel);); input a, b, input a, b, selselsel;; output out; wire out; assign out=( assign out=(sel)?b:asel)?b:asel)?b:a;;endmodule两路选择器的RTL级描述1:华中科技大学电子系郑朝霞8两路选择器的RTL级描述2:module mux2to1 (out, a, b, mux2to1 (out, a, b, selselsel);); input a, b, input a, b, selselsel;; output out; regregreg out; out;always @( always @( selselsel or a or b) or a or...