




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、2021/3/10讲解:XX1 n 应用 数字信号处理和数字通信 n 地位 影响系统的运行速度 n 实现 l 并行乘法器 l 移位相加乘法器 l 查找表乘法器 l 加法树乘法器 2021/3/10讲解:XX2 9.2.1 并行乘法器 l 结构 用乘法运算符描述 由EDA软件综合 l 优点 运算速度快 l 缺点 耗用资源多 2021/3/10讲解:XX3 【例9.4】8位并行乘法器 module mult( outcome, a, b); parameter size = 8; inputsize:1 a, b; / 源操作数 output2*size:1 outcome; / 乘积 assig
2、n outcome = a*b; / 相乘 endmodule 2021/3/10讲解:XX4 8位并行乘法器RTL图 2021/3/10讲解:XX5 9.2.2 移位相加乘法器 l 结构 移位寄存器 加法器 l 优点 耗用资源少 2021/3/10讲解:XX6 【例9.16】8位二进制数的乘法 module mult_for( outcome, a, b ); parameter size = 8; inputsize:1 a, b; output2*size:1 outcome; reg2*size:1 outcome; integer i; 2021/3/10讲解:XX7 always
3、( a or b ) begin outcome = 4h0; for( i = 1; i = size; i = i+1 ) if( bi ) outcome = outcome + ( a (i-1) ); end endmodule 2021/3/10讲解:XX8 乘法器的功能仿真波形图 2021/3/10讲解:XX9 9.2.3 查找表乘法器 l 结构 操作数:地址 乘积:存储器 l 优点 运算速度快 l 缺点 耗用存储资源多 2021/3/10讲解:XX10 l 设计思路 n 4位查找表乘法器 Y = AB A = A122+A2 B = B122+B2 则 Y = ( A122+A
4、2 )( B122+B2 ) = A1B124 + A1B222 + A2B122 + A2B2 2021/3/10讲解:XX11 n 8位查找表乘法器 Y = AB A = A124+A2 B = B124+B2 则 Y = ( A124+A2 )( B124+B2 ) = A1B128 + A1B224 + A2B124 + A2B2 2021/3/10讲解:XX12 【例9.5】 88查找表乘法器 /* 22查找表乘法器 */ module lookup( out, a, b, clk ); output3:0 out; / 乘积 input1:0 a, b; / 操作数 input c
5、lk; reg3:0 out; reg3:0 address; / 存储器地址 2021/3/10讲解:XX13 always ( posedge clk ) begin address = a, b ; case( address ) 4h0:out = 4b0000; 4h1:out = 4b0000; 4h2:out = 4b0000; 4h3:out = 4b0000; 4h4:out = 4b0000; 4h5:out = 4b0001; 4h6:out = 4b0010; 4h7:out = 4b009; 2021/3/10讲解:XX14 4h8:out = 4b0000; 4h9
6、:out = 4b0010; 4ha:out = 4b0100; 4hb:out = 4b090; 4hc:out = 4b0000; 4hd:out = 4b009; 4he:out = 4b090; 4hf:out = 4b1001; default: out = 4bx; endcase end endmodule 2021/3/10讲解:XX15 /* 44查找表乘法器 */ module mult4x4( out, a, b, clk ); output7:0 out; / 乘积 input3:0 a, b; / 操作数 input clk; reg7:0 out; reg1:0 f
7、irsta, firstb; / 操作数高2位 reg1:0 seconda, secondb; / 操作数低2位 wire3:0 outa, outb, outc, outd; / 乘积每2位1组 2021/3/10讲解:XX16 always ( posedge clk ) begin firsta = a3:2; seconda = a1:0; firstb = b3:2; secondb = b1:0; end 2021/3/10讲解:XX17 lookup m1( outa, firsta, firstb, clk ), / 元件调用 m2( outb, firsta, second
8、b, clk ), m3( outc, seconda, firstb, clk ), m4( outd, seconda, secondb, clk ); always ( posedge clk ) begin out = ( outa 4 ) + ( outb 2 ) / 乘积 + ( outc 2 ) + outd; end endmodule 2021/3/10讲解:XX18 4位查找表乘法器仿真波形图 2021/3/10讲解:XX19 /* 88查找表乘法器 */ module mult8x8( out, a, b, clk ); output15:0 out; / 乘积 inpu
9、t7:0 a, b; / 操作数 input clk; reg15:0 out; reg3:0 firsta, firstb; / 操作数高4位 reg3:0 seconda, secondb; / 操作数低4位 wire7:0 outa, outb, outc, outd; / 乘积每8位1组 2021/3/10讲解:XX20 always ( posedge clk ) begin firsta = a7:4; seconda = a3:0; firstb = b7:4; secondb = b3:0; end 2021/3/10讲解:XX21 mult4x4 n1( outa, firs
10、ta, firstb, clk ), / 元件调用 n2( outb, firsta, secondb, clk ), n3( outc, seconda, firstb, clk ), n4( outd, seconda, secondb, clk ); always ( posedge clk ) begin out = ( outa 8 ) + ( outb 4 ) / 乘积 + ( outc 4 ) + outd; end endmodule 2021/3/10讲解:XX22 8位查找表乘法器仿真波形图 2021/3/10讲解:XX23 9.2.4 加法树乘法器 l 结构 底层:乘法器
11、 高层:多级加法器 l 优点 1个时钟周期完成 2021/3/10讲解:XX24 加法树乘法器结构框图 81乘法器 a128 b7 81乘法器 a64 b6 加 法 器 81乘法器 a32 b5 81乘法器 a16 b4 加 法 器 81乘法器 a8 b3 81乘法器 a4 b2 加 法 器 81乘法器 a2 b1 81乘法器 a b0 加 法 器 加 法 器 加 法 器 加 法 器 y=ab 2021/3/10讲解:XX25 【例9.6】8位加法树乘法器 module add_tree( out, a, b, clk ); output15:0 out; / 乘积 input7:0 a, b
12、; / 操作数 input clk; wire15:0 out; wire15:0 out1, c1; / 加法器和 wire13:0 out2; wire11:0 out3, c2; wire9:0 out4; 2021/3/10讲解:XX26 reg14:0 temp0; / 最高位乘积 reg13:0 temp1; reg12:0 temp2; reg11:0 temp3; reg10:0 temp4; reg9:0 temp5; reg8:0 temp6; reg7:0 temp7; / 最低位乘积 2021/3/10讲解:XX27 /* 81乘法器 */ function7:0 mu
13、lt8x1; input7:0 operand; input sel; begin mult8x1 = ( sel ) ? ( operand ) : 8b00000000; end endfunction 2021/3/10讲解:XX28 /* 操作数b各位与操作数a相乘 */ always ( posedge clk ) begin temp7 = mult8x1( a, b0 ); temp6 = ( mult8x1( a, b1 ) ) 1; temp5 = ( mult8x1( a, b2 ) ) 2; temp4 = ( mult8x1( a, b3 ) ) 3; temp3 =
14、( mult8x1( a, b4 ) ) 4; temp2 = ( mult8x1( a, b5 ) ) 5; temp1 = ( mult8x1( a, b6 ) ) 6; temp0 = ( mult8x1( a, b7 ) ) 7; end 2021/3/10讲解:XX29 /* 加法器树运算 */ assign out1 = temp0 + temp1; assign out2 = temp2 + temp3; assign out3 = temp4 + temp5; assign out4 = temp6 + temp7; assign c1 = out1 + out2; assig
15、n c2 = out3 + out4; assign out = c1 + c2; endmodule 2021/3/10讲解:XX30 8位加法树乘法器仿真波形图 2021/3/10讲解:XX31 四种乘法器的比较 2021/3/10讲解:XX32 2021/3/10讲解:XX33 【例9.30】乘累加器(MAC) module MAC( out, opa, opb, clk, clr ); output15:0 out; input7:0 opa, opb; input clk, clr; wire15:0 sum; reg15:0 out; 2021/3/10讲解:XX34 function15:0 mult; input7:0 opa, opb; reg 15:0 result; integer i; begin result = opa0 ? opb : 0; for(i = 1; i = 7; i = i+1) begin if( opai = 1
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 影视录放设备产品定位考核试卷
- 2025年市场操纵行为的法律责任分析试题及答案
- 2025年全新证券从业资格证考试备考试题及答案
- 窗帘结构与安装技巧考核试卷
- 环境监测数据在决策中的作用考核试卷
- 北美风格电视墙施工方案
- 银行从业资格证考试的专业试题及答案
- 电气工程设备操作与维护方法技巧考核试卷
- 礼仪用品企业战略规划考核试卷
- 残疾人体育赛事参与考核试卷
- (新版)碳排放管理员(高级)职业鉴定考试题库(含答案)
- 配电工程项目规范
- 地铁典型事故案例分析
- 浙江省幼儿园教育装备要求规范(试行)
- GB/T 43934-2024煤矿土地复垦与生态修复技术规范
- 方案光伏发电项目吊装方案
- 矿井火灾事故抢险救援
- 药品研发合作协议书
- ANPQP概要-主要表单介绍及4M变更流程
- 2023年山东司法警官职业学院招聘考试真题
- 氯乙酸安全技术说明书MSDS
评论
0/150
提交评论