mul8_unsigned multipliter

李亚民老师更注重硬件设计思想的训练。
他给出的硬件设计方法更贴近底层硬件,下面看看他的设计思想:
                                                                                                                                   a7a6a5a4a3a2a1a0
                                                                                                                           *       b7b6b5b4b3b2b1b0
                                                                                                                  --------------------------------------------------
                                                                                                                 a7b0  a6b0  a5b0  a4b0  a3b0  a2b0  a1b0  a0b0
                                                                                                      a7b1  a6b1   a5b1  a4b1  a3b1  a2b1  a1b1  a0b1
                                                                                           a7b2  a6b2  a5b2   a4b2   a3b2  a2b2  a1b2  a0b2
                                                                                 a7b3  a6b3  a5b3  a4b3   a3b3   a2b3  a1b3  a0b3
                                                                       a7b4  a6b4  a5b4  a4b4  a3b4   a2b4   a1b4  a0b4
                                                            a7b5  a6b5   a5b5  a4b5  a3b5  a2b5   a1b5   a0b5
                                                 a7b6  a6b6   a5b6   a4b6  a3b6  a2b6  a1b6   a0b6
      +                              a7b7  a6b7  a5b7    a4b7   a3b7  a2b7  a1b7  a0b7
-----------------------------------------------------------------------------------------------------------------------------------------------------------

 1 //date :2013/6/20
 2 //designer :pengxiaoen
 3 //function : unsigned 8 bit  multipliter
 4 
 5 module mul8_unsigned (
 6                      a_in,b_in,
 7                             result
 8                             );
 9 input [7:0] a_in, b_in;
10 output [15:0] result ;
11 
12 wire [7:0] ab0 = b_in[0] ?  a_in : 8'd0;
13 wire [7:0] ab1 = b_in[1] ?  a_in : 8'd0;
14 wire [7:0] ab2 = b_in[2] ?  a_in : 8'd0;
15 wire [7:0] ab3 = b_in[3] ?  a_in : 8'd0;
16 wire [7:0] ab4 = b_in[4] ?  a_in : 8'd0;
17 wire [7:0] ab5 = b_in[5] ?  a_in : 8'd0;
18 wire [7:0] ab6 = b_in[6] ?  a_in : 8'd0;
19 wire [7:0] ab7 = b_in[7] ?  a_in : 8'd0;
20 
21 assign result = ( ({8'b0,ab0[7:0]}        + 
22                    {7'b0,ab1[7:0],1'b0})  +
23                        ({6'b0,ab2[7:0],2'b0}   +
24                        {5'b0,ab3[7:0],3'b0})  +
25                         ({4'b0,ab4[7:0],4'b0}   +
26                          {3'b0,ab5[7:0],5'b0})  +
27                         ({2'b0,ab6[7:0],6'b0}   +
28                          {1'b0,ab7[7:0],7'b0})
29                     );
30                     
31 endmodule


这种设计思想很好,但是这个就有点悲剧了
图片
一共用了126个逻辑单元
特权的16bit unsigned multipliter 才用了103个。
吴厚航 PK 李亚民 ,呵呵,不知道怎么样去比较这两个设计思想的优缺点,求指点啊

李老师说如果没有加括号,就也许会顺序执行,但是我加了和么有加么有区别啊

posted on 2013-06-20 23:14  清霜一梦  阅读(568)  评论(0编辑  收藏  举报