Verilog HDL语法请教module adder(cout,sum,a,b); //module name,port listoutput cout; //declationoutput sum;input a,b;wire cout,sum; //上面已经声明了,为什么这里还要声明.assign {cout,sum} = a + b;endmodule

来源:学生作业帮助网 编辑:作业帮 时间:2024/07/20 23:47:22
Verilog HDL语法请教module adder(cout,sum,a,b); //module name,port listoutput cout;    //declationoutput sum;input a,b;wire cout,sum;  //上面已经声明了,为什么这里还要声明.assign {cout,sum} = a + b;endmodule
xRn@~=pȩ;YrlvTURSHv&%qH51(/c߂YRr@ɳ3uLw n';OYȾX|uLv/yJ͇ Զ.9|lr:> O5}T}ö*)HNO~#\}>5K4дKmTN6dCT3Z9yN<"ME4tR_D-W+e/Do!;r\+ AX||S8%Y/ DG[p)G!#&V/0d^d>=d.*!d!!1Mば^LE%ZU=u߻B.,7Oof|8Oa$Tp ,*1]-^I.{j5 2~

Verilog HDL语法请教module adder(cout,sum,a,b); //module name,port listoutput cout; //declationoutput sum;input a,b;wire cout,sum; //上面已经声明了,为什么这里还要声明.assign {cout,sum} = a + b;endmodule
Verilog HDL语法请教
module adder(cout,sum,a,b); //module name,port list
output cout; //declation
output sum;
input a,b;
wire cout,sum; //上面已经声明了,为什么这里还要声明.
assign {cout,sum} = a + b;
endmodule

Verilog HDL语法请教module adder(cout,sum,a,b); //module name,port listoutput cout; //declationoutput sum;input a,b;wire cout,sum; //上面已经声明了,为什么这里还要声明.assign {cout,sum} = a + b;endmodule
wire是指变量的类型,告诉你是线型变量.reg则是寄存器型.
简单地说,如果是用在assign语句中,则可以不用再声明变量类型,因为默认的就是wire型.
如果是用在always语句中,则一定要声明变量类型,且一定是reg型,否则会报错.
你可以试试.
多用就知道了.