multi.v

来自「verilog语言写的8位CPU源代码」· Verilog 代码 · 共 28 行

V
28
字号
`timescale 1ns/10psmodule mulit(result,op_a,op_b,MUE);input [7:0] op_a,op_b;input MUE;output [15:0]result;reg [15:0] result;reg[7:0] shift_opb,shift_opa;always@(op_a or op_b or MUE)	begin		result=0;		shift_opa=op_a;		shift_opb=op_b;		if(MUE=='b1)			begin 			if(shift_opb[0]) result[8:0]=result[8:0]+shift_opa ;			if(shift_opb[1]) result[9:1]=result[9:1]+shift_opa;			if(shift_opb[2]) result[10:2]=result[10:2]+shift_opa;			if(shift_opb[3]) result[11:3]=result[11:3]+shift_opa;			if(shift_opb[4]) result[12:4]=result[12:4]+shift_opa;			if(shift_opb[5]) result[13:5]=result[13:5]+shift_opa;			if(shift_opb[6]) result[14:6]=result[14:6]+shift_opa;			if(shift_opb[7]) result[15:7]=result[15:7]+shift_opa;		end		else result=0;	endendmodule

⌨️ 快捷键说明

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