8位乘法器.doc_第1页
8位乘法器.doc_第2页
8位乘法器.doc_第3页
8位乘法器.doc_第4页
8位乘法器.doc_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

8位乘法器一:8位乘法器的源程序:module mult8( p, a, b); parameter size = 8; input size:1 a, b; output 2* size:1 p; reg 2* size:1 p;always ( a or b) Begin:mult integer index; p = 0;for(index=1; index=size; index=index+1) if (bindex=1) p = p + (a(index); endendmodule二:8位乘法器的测试代码:timescale 1ns/1nsinclude mult8.vmodule tb_mult8;reg8:1 ina,inb;wire16:1 p;mult8 tb_mult8(p,ina,inb);initialbegin#10 ina=$random%255;inb=$random%255;#10 ina=$random%255;inb=$random%255;#10 ina=$random%255;inb=$random%255;#10 $finish;endinitial $monitor($time,%d*%d=%d,ina,inb,p);endmodule三:Transcript显示结果:# Reading D:/altera/91/modelsim_ase/tcl/vsim/pref.tcl # Loading project adder# reading D:altera91modelsim_asewin32aloem/./modelsim.ini# Loading project mult# reading D:altera91modelsim_asewin32aloem/./modelsim.ini# Loading project mult# Compile of mult8.v was successful.# Compile of tb_mult8.v failed with 1 errors.# 2 compiles, 1 failed with 1 error. # Compile of tb_mult8.v was successful.# Compile of mult8.v was successful.# Compile of tb_mult8.v was successful.# 2 compiles, 0 failed with no errors. vsim work.tb_mult8# vsim work.tb_mult8 # Loading work.tb_mult8# * Error: (vsim-3033) E:/mult/tb_mult8.v(11): Instantiation of initial$monitor failed. The design unit was not found.# Region: /tb_mult8# Searched libraries:# E:multwork# Error loading design# Compile of mult8.v was successful.# Compile of tb_mult8.v was successful.# 2 compiles, 0 failed with no errors. vsim work.tb_mult8# vsim work.tb_mult8 # Loading work.tb_mult8# * Error: (vsim-3033) E:/mult/tb_mult8.v(11): Instantiation of initial$monitor failed. The design unit was not found.# Region: /tb_mult8# Searched libraries:# E:multwork# Error loading design# Compile of mult8.v was successful.# Compile of mult8.v was successful.# Compile of mult8.v was successful.# Compile of mult8.v was successful.# Compile of mult8.v was successful.# Compile of tb_mult8.v was successful.# 2 compiles, 0 failed with no errors. vsim work.tb_mult8# vsim work.tb_mult8 # Loading work.tb_mult8# Loading work.mult8# * Error: (vsim-3033) E:/mult/tb_mult8.v(12): Instantiation of initial$monitor failed. The design unit was not found.# Region: /tb_mult8# Searched libraries:# E:multwork# Error loading design# Compile of mult8.v was successful.# Compile of mult8.v was successful.# Compile of tb_mult8.v was successful.# 2 compiles, 0 failed with no errors. vsim work.tb_mult8# vsim work.tb_mult8 # Loading work.tb_mult8# Loading work.mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (16 or 16) does not match connection size (8) for port p.# Region: /tb_mult8/tb_mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (8 or 8) does not match connection size (4) for port a.# Region: /tb_mult8/tb_mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (8 or 8) does not match connection size (4) for port b.# Region: /tb_mult8/tb_mult8add wave sim:/tb_mult8/*run -all# 0 x* x= x# 10 0*10= x# * Note: $finish : E:/mult/tb_mult8.v(10)# Time: 20 ns Iteration: 0 Instance: /tb_mult8# 1# Break in Module tb_mult8 at E:/mult/tb_mult8.v line 10quit -sim# Compile of mult8.v was successful.# Compile of mult8.v was successful.# Compile of tb_mult8.v was successful.# 2 compiles, 0 failed with no errors. vsim work.tb_mult8# vsim work.tb_mult8 # Loading work.tb_mult8# Loading work.mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (16 or 16) does not match connection size (8) for port p.# Region: /tb_mult8/tb_mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (8 or 8) does not match connection size (4) for port a.# Region: /tb_mult8/tb_mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (8 or 8) does not match connection size (4) for port b.# Region: /tb_mult8/tb_mult8add wave sim:/tb_mult8/*run -all# 0 x* x= x# 10 0*10= x# * Note: $finish : E:/mult/tb_mult8.v(10)# Time: 20 ns Iteration: 0 Instance: /tb_mult8# 1# Break in Module tb_mult8 at E:/mult/tb_mult8.v line 10quit -sim# Compile of mult8.v was successful.# Compile of mult8.v was successful.# Compile of tb_mult8.v was successful.# 2 compiles, 0 failed with no errors. vsim work.tb_mult8# vsim work.tb_mult8 # Loading work.tb_mult8# Loading work.mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (16 or 16) does not match connection size (8) for port p.# Region: /tb_mult8/tb_mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (8 or 8) does not match connection size (4) for port a.# Region: /tb_mult8/tb_mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (8 or 8) does not match connection size (4) for port b.# Region: /tb_mult8/tb_mult8add wave sim:/tb_mult8/*run -all# 0 x* x= x# 10 0*10= x# 20 8*12= x# 30 8*13= x# * Note: $finish : E:/mult/tb_mult8.v(12)# Time: 40 ns Iteration: 0 Instance: /tb_mult8# 1# Break in Module tb_mult8 at E:/mult/tb_mult8.v line 12quit -sim# Compile of mult8.v was successful.# Compile of mult8.v was successful.# Compile of tb_mult8.v was successful.# 2 compiles, 0 failed with no errors. vsim work.tb_mult8# vsim work.tb_mult8 # Loading work.tb_mult8# Loading work.mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (16 or 16) does not match connection size (8) for port p.# Region: /tb_mult8/tb_mult8add wave sim:/tb_mult8/*run -all# 0 x* x= x# 10 128* 42= 0# 20 232* 92= 96# 30 72* 77=168# * Note: $finish : E:/mult/tb_mult8.v(12)# Time: 40 ns Iteration: 0 Instance: /tb_mult8# 1# Break in Module tb_mult8 at E:/mult/tb_mult8.v line 12quit -sim# Compile of mult8.v was successful.# Compile of tb_mult8.v was successful.# 2 compiles, 0 failed with no errors. vsim work.tb_mult8# vsim work.tb_mult8# Loading work.tb_mult8# Loading work.mult8# * Warning: (vsim-3015) E:/mult/tb_mult8.v(6): PCDPC - Port size (16 or 16) does not match connection size (8) for port p.# Region: /tb_mult8/tb_mult8add wave sim:/tb_mult8/*run -all# 0 x* x= x# 10 128* 42= 0# 20 232* 9

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论