qinzongqing的个人空间 https://blog.eetop.cn/930914 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

乘法器设计

已有 658 次阅读| 2013-4-25 21:13

3位二进制乘3位二进制思路:
3位乘3位得6位;
例如 110 * 011 = 010010

       000_110
+     001_100
-----------------------
       010_010
读入数据 3次移位判断 输出  用了5个时钟周期得到一个结果 100M/5=20M

module mul_ser (clk, x, a, y,rst); 

  input         clk;
  input   rst;
  input  [2:0]  x, a;
  output [5:0] y;
  reg    [5:0] y;
  reg [1:0] state;
  
  reg  [2:0] count;
  reg  [5:0] p, t;        // Double bit width
  reg  [2:0] a_reg;
  parameter s0=0, s1=1, s2=2;
  
  always @(posedge clk or posedge rst) //-> Multiplier in behavioral style
if(rst) state <= 3'b0;
else begin : States
case (state) 
s0 : begin         // Initialization step 
a_reg <= a;
state <= s1;
count = 0;
p <= 0;             // Product register reset
t <= {{3{1'b0}},x}; // Set temporary shift register
  end                                           // to x
s1 : begin          // Processing step
if (count == 3'd3)   // Multiplication ready
state <= s2;
else         // Note that MaxPlusII does not does 
begin      // not allow variable bit selects, 
if (a_reg[0] == 1) // see (LRM Sec. 4.2.1)
begin
p <= p + t;      // Add 2^k
end
a_reg <= a_reg >> 1;// Use LSB for the bit select
t <= t << 1;
count = count + 1;
state <= s1;
end
end
s2 : begin       // Output of result to y and
y <= p;        // start next multiplication
state <= s0;
end
endcase  
  end

endmodule

点赞

全部作者的其他最新日志

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 1

    粉丝
  • 0

    好友
  • 0

    获赞
  • 3

    评论
  • 193

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-28 20:35 , Processed in 0.022327 second(s), 13 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部