在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 2866|回复: 6

[求助] 实习生求助

[复制链接]
发表于 2011-12-5 13:17:15 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
今天刚到一个公司实习,主管叫我设计一个2级的16*16的乘法器 用booth算法 我刚毕业一点都不会 也不好意思问主管 同事也都不熟 不知道该怎么办啊 苦恼啊 对asic这方面我基本什么都不知道 不知道从哪开始学起 希望各位指导一下 谢谢了
 楼主| 发表于 2011-12-5 13:44:13 | 显示全部楼层
跪求verilog代码啊 没有代码 思路也可以啊
 楼主| 发表于 2011-12-5 14:37:34 | 显示全部楼层
可以推荐点什么资料么 或者书籍之类的 我回去温习温习啊
发表于 2011-12-5 21:52:09 | 显示全部楼层
booth不难啊...《计算机组成原理》上有介绍,不过只是算法介绍。
看懂算法,然后搜点源码读懂,自己写上注释,这是最快完成你领导任务得方法了...
发表于 2011-12-6 16:32:46 | 显示全部楼层
// 借你一个, 出来混总要还的~~~
//-----------------------------------------------------------------------------
//
// This is a Booth recoded 8x8 multiplier producing a 16-bit product.
//
// Shift and add are done in the same cycle
//
// Paul Chow
// Department of Electrical and Computer Engineering
// University of Toronto
//
// October 2004
//
// $Id: booth.v,v 1.4 2004/11/04 16:37:50 pc Exp pc $
//
//-----------------------------------------------------------------------------

module booth(
             iClk,      // input clock
             iReset_b,  // reset signal
             iGo,       // indicates inputs are ready
             oDone,     // indicates that the result is ready
             iMer,      // 8-bit multiplier
             iMand,     // 8-bit multiplicand
             oProduct   // 16-bit product
             );

    input iClk,iReset_b,iGo;
    input [7:0] iMer,iMand;
    output oDone;
    output [15:0] oProduct;


    // State names

    parameter        WaitForGoState = 0,
                InitState = 1,
                AddShiftState = 2,
                DoneState =3;

    reg [1:0] PresentState, NextState;

    reg [1:0] NumShifts;

    reg [18:0] Product;
    reg [9:0] Sum;


//-----------------------------------------------------------------------------
//  This is the main FSM controller
//-----------------------------------------------------------------------------

    always @(iGo,PresentState,NumShifts)
        
    begin :  Controller
        case (PresentState)

            WaitForGoState:
                if (iGo)
                    NextState = InitState;
                else
                    NextState = WaitForGoState;

            InitState:
                NextState = AddShiftState;

            AddShiftState:
                if (NumShifts == 2'b00)
                    NextState = DoneState;
                else
                    NextState = AddShiftState;

            DoneState:
                NextState = DoneState;

            default:
                NextState = InitState;
        endcase //  PresentState
    end // Controller;
   


    always @(posedge iClk or negedge iReset_b)
   
    begin //  StateRegs
        if (!iReset_b)
            PresentState <= WaitForGoState;
        else
            PresentState <= NextState;
    end // StateRegs;


//-----------------------------------------------------------------------------
//  This does the addition of the appropriate version of the multiplicand
//-----------------------------------------------------------------------------

    reg [9:0] Mand1,Mand2;

    always @(Product,iMand)
        
    begin //  Adder
        Mand1 = {iMand[7],iMand[7],iMand};  // sign extend to 10 bits
        Mand2 = Mand1<<1;

        case (Product[2:0])
            3'b000:
                Sum = Product[18:9];
            3'b001:
                Sum = Product[18:9] + Mand1;
            3'b010:
                Sum = Product[18:9] + Mand1;
            3'b011:
                Sum = Product[18:9] + Mand2;
            3'b100:
                Sum = Product[18:9] - Mand2;
            3'b101:
                Sum = Product[18:9] - Mand1;
            3'b110:
                Sum = Product[18:9] - Mand1;
            default:
                Sum = Product[18:9];
        endcase  //  Product[2:0]
    end // Adder


//-----------------------------------------------------------------------------
//  This is the Product register and counter
//-----------------------------------------------------------------------------

    always @(posedge iClk)
        
    begin //  ProdReg
            case (PresentState)

                WaitForGoState:
                    ;
                InitState:
                  begin
                    Product[18:9] <= 10'b0000000000;
                    Product[8:1] <= iMer;
                    Product[0] <= 1'b0;
                    NumShifts <= 2'b11;
                  end

                AddShiftState:
                  begin
                    //---------------------------------------------------------
                    //  This takes the Sum, sign extends it to 12 bits and
                    //  puts that into the top part of the Product register,
                    //  effectively shifting it at the same time.  The bottom
                    //  part of the register is loaded with a shifted value of
                    //  the previous contents in that part.
                    //  The counter is also updated here.
                    //---------------------------------------------------------
                    Product[18:7] <= {Sum[9],Sum[9],Sum};
                    Product[6:0] <= Product[8:2];
                    NumShifts <= NumShifts - 2'b01;
                  end
                DoneState:
                ;
            endcase //  PresentState

    end //ProdReg;

   
//-----------------------------------------------------------------------------
//  The output product and done signal.
//-----------------------------------------------------------------------------

    assign oProduct = Product[16:1];

    assign oDone = (PresentState == DoneState) ? 1'b1:1'b0;

endmodule  // of booth
发表于 2018-11-27 22:14:45 | 显示全部楼层
学习中。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

×

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

GMT+8, 2024-5-19 18:58 , Processed in 0.030190 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表