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/05/11 15:29:15
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 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型,否则会报错.
你可以试试.
多用就知道了.