labfirst.v

来自「Manual for DSP sp3 for students who do c」· Verilog 代码 · 共 81 行

V
81
字号
`timescale 1ns / 1ps//////////////////////////////////////////////////////////////////////////////////// Company: // Engineer: // // Create Date:    16:22:54 01/21/2009 // Design Name: // Module Name:    labfirst // Project Name: // Target Devices: // Tool versions: // Description: //// Dependencies: //// Revision: // Revision 0.01 - File Created// Additional Comments: ////////////////////////////////////////////////////////////////////////////////////




module labfirst(cin, a, b, sum, cout);    input cin;    input a;    input b;    output sum;    output cout;	 reg sum , cout;	 	 always @ (cin , a , b) begin	 	 if (a == 1 && b == 1 && cin == 1) begin 		sum = 1 ;		cout = 1;		end 
	
	else if (a == 1 && b == 1 && cin == 0) begin 		sum = 0 ;		cout = 1;		end	 	 else if (a == 1  && b == 0 && cin == 0) begin 		sum = 1 ;		cout = 0;		end 
	 
	 else if (a == 1 && b == 0 && cin == 1) begin 		sum = 0 ;		cout = 1;		end 
	else if (a == 0  && b == 1 && cin == 0) begin 		sum = 1 ;		cout = 0;		end 	 	 else if (a == 0 && b == 1 && cin == 1) begin 		sum = 0 ;		cout = 1;		end 
			else if (a == 0 && b == 0 && cin == 1) begin 		sum = 1 ;		cout = 0;		end 				else if (a == 0 && b == 0 && cin == 0) begin 		sum = 0 ;		cout = 0;		end 		endendmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?