首页|嵌入式系统|显示技术|模拟IC/电源|元件与制造|其他IC/制程|消费类电子|无线/通信|汽车电子|工业控制|医疗电子|测试测量
首页 > 分享下载 > 常用文档 > 8bit乘法器-Verilog程序

8bit乘法器-Verilog程序

资料介绍
8bit乘法器

1. 完成加法的程序:
module my_mult_data (reset,clock,mul,muld,load,sh,ad,m,product);
input reset;
input clock;
input load;
input sh;
input ad;
input [7:0] mul;
input [7:0] muld;
output m;
output [15:0] product;
reg [16:0] acc;
wire [8:0] sum;
wire m;
assign m=acc[0];
assign sum={1'b0,muld}+acc[15:8];
always @(posedge clock or posedge reset)
if(reset==1)
acc<=17'd0;
else if(load==1)
acc<={9'd0,mul};
else if(ad==1)
acc[16:8]<=sum;
else if(sh==1)
acc<={1'b0,acc[16:1]};
assign product=acc[15:0];
endmodule
2. 控制逻辑的程序:
module my_mult_ctl(reset,,clock,start,m,load,sh,ad,done);
input reset;
input clock;
input start;
标签:乘法器程序
8bit乘法器-Verilog程序
本地下载

评论