⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 multiplier_patial_product_bak.v

📁 8*8乘法器及其测试:采用booth编码的乘法器:1. ultipler_quick_add_4 即4位的并行全加器
💻 V
字号:
//------------------------------------------------------

// file name : multiplier_patial_product

// module name : multiplier_patial_product.v

// author : hejun

// software : model sim

//------------------------------------------------------

`timescale 	 1ns/1ns

module multiplier_patial_product(
        x,
        y,
        pp1,
        pp2,
        pp3
        );


input [7:0] x;
input [7:0] y;
output [15:0] pp1;
output [15:0] pp2;
output [15:0] pp3;



wire [15:0] pp1;
wire [15:0] pp2;
wire [15:0] pp3;

wire [9:0] p;
wire [12:1] cout;
wire [15:0] shiftout_1;
wire [15:0] shiftout_2;
wire [15:0] shiftout_3;


assign p[0] = 1'b0;
assign p[8:1] = y[7:0];
assign p[9] = 1'b0;


multiplier_unit_4              multiplier_unit4_1(
   .y                             (p[3:0]),
   .x                             (x[3:0]),
   .shiftin                       (2'b11 & {~p[3],~p[3]} | 2'b00 & {p[3],p[3]}),
   .shiftout                      (shiftout_1[3:0]),                     
   .cin                           (1'b0),          
   .pp                            (pp1[3:0]),
   .cout                          (cout[1])
   );
  
  
multiplier_unit_4              multiplier_unit4_2(
   .y                             (p[3:0]),
   .x                             (x[7:4]),
   .shiftin                       (shiftout_1[3:2]),
   .shiftout                      (shiftout_1[7:4]),                     
   .cin                           (cout[1]),          
   .pp                            (pp1[7:4]),
   .cout                          (cout[2])
   );  
  

multiplier_unit_4              multiplier_unit4_3(
   .y                             (p[3:0]),
   .x                             (4'b0),
   .shiftin                       (shiftout_1[7:6]),
   .shiftout                      (shiftout_1[11:8]),                     
   .cin                           (cout[2]),          
   .pp                            (pp1[11:8]),
   .cout                          (cout[3])
   );    
   
   
multiplier_unit_4              multiplier_unit4_4(
   .y                             (p[3:0]),
   .x                             (4'b0),
   .shiftin                       (shiftout_1[11:10]),
   .shiftout                      (shiftout_1[15:12]),                     
   .cin                           (cout[3]),          
   .pp                            (pp1[15:12]),
   .cout                          (cout[4])
   );     
   
/*
multiplier_unit_4              multiplier_unit4_5(
   .y                             (p[6:3]),
   .x                             (({x[0],2'b00,p[3]} & {~p[6],~p[6],~p[6],~p[6]}) | ({~x[0],2'b11,~p[3]} & {p[6],p[6],p[6],p[6]})),
   .shiftin                       (2'b11 & {~p[6],~p[6]} | 2'b00 & {p[6],p[6]}),
   .shiftout                      (shiftout_2[3:0]),                     
   .cin                           (1'b0),          
   .pp                            (pp2[3:0]),
   .cout                          (cout[5])
   );     
*/

assign pp2[0] = p[3];
assign pp2[1] = 1'b0;
assign pp2[2] = 1'b0;
   

multiplier_unit_4              multiplier_unit4_5(
   .y                             (p[6:3]),
   .x                             (x[3:0]),
   .shiftin                       ((2'b11 & {~p[6],~p[6]}) | (2'b00 & {p[6],p[6]})),
   .shiftout                      (shiftout_2[6:3]),                     
   .cin                           (1'b0),          
   .pp                            (pp2[6:3]),
   .cout                          (cout[5])
   );     
   

multiplier_unit_4              multiplier_unit4_6(
   .y                             (p[6:3]),
   .x                             (x[7:4]),
   .shiftin                       (shiftout_2[6:5]),
   .shiftout                      (shiftout_2[10:7]),                     
   .cin                           (cout[5]),          
   .pp                            (pp2[10:7]),
   .cout                          (cout[6])
   );     
   
   
multiplier_unit_4              multiplier_unit4_7(
   .y                             (p[6:3]),
   .x                             (4'b0),
   .shiftin                       (shiftout_2[10:9]),
   .shiftout                      (shiftout_2[14:11]),                     
   .cin                           (cout[6]),          
   .pp                            (pp2[14:11]),
   .cout                          (cout[7])
   );     
   
assign pp2[15] =  p[6];

assign pp3[2:0] = 3'b000;
assign pp3[3] = p[6];
   
   
multiplier_unit_4              multiplier_unit4_10(
   .y                             (p[9:6]),
   .x                             ({x[1:0],2'b00}),
   .shiftin                       (2'b11),
   .shiftout                      (shiftout_3[7:4]),                     
   .cin                           (1'b0),          
   .pp                            (pp3[7:4]),
   .cout                          (cout[10])
   );     
     

multiplier_unit_4              multiplier_unit4_11(
   .y                             (p[9:6]),
   .x                             (x[5:2]),
   .shiftin                       (shiftout_3[7:6]),
   .shiftout                      (shiftout_3[11:8]),                     
   .cin                           (cout[10]),          
   .pp                            (pp3[11:8]),
   .cout                          (cout[11])
   );
   
   
multiplier_unit_4              multiplier_unit4_12(
   .y                             (p[9:6]),
   .x                             ({2'b00,x[7:6]}),
   .shiftin                       (shiftout_3[11:10]),
   .shiftout                      (shiftout_3[15:12]),                     
   .cin                           (cout[11]),          
   .pp                            (pp3[15:12]),
   .cout                          (cout[12])
   );     
       
 
endmodule     

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -