基于FPGA的32位双重进位跳跃进位链流水实现。
主要思想:将进位链算法分成若干步,并逐级暂存结果。实际上每一级即在一个时钟周期内完成,在时钟驱动下,逐级流水。
实现源码(不包括测试文件)
`timescale 1ns / 1ps
//
// Company:
// Engineer:
//
// Create Date: 20:00:03 06/13/2018
// Design Name: RanWang
// Module Name: dpjcc
// Project Name: Dpjcc_32
// Target Devices: Virtex4
// Tool versions: Xilinx ISE 8.2i&&Modelsim SE 10.1a
// Description: Using the FPGA parallel mechanism, the 32 level double packet hop carry chain six level pipelined adder is implemented.
//
// Dependencies: Do not rely on other modules.
//
// Revision 0.01 - File Created
// Additional Comments:
//
//
module dpjcc(clk,A,B,Cin,Cout,Sum);
input clk;
input [31:0]A;
input [31:0]B;
input Cin;
output Cout;
output [31:0]Sum;
reg [31:0] Sum;
reg Cout;
reg [31:0]C; //进位
reg [31:0]d; //小组的本地进位
reg [31:0]t; //小组的传递条件
reg [8:1]D; //大组的本地进位
reg [8:1]T; //大组的传递条件
//第一级暂存寄存器
reg [31:0]temp_A;
reg [31:0]temp_B;
reg [8:1]temp_D;
reg [8:1]temp_T;
reg [2:0]temp_C;
reg [31:0]temp_d;
reg [31:0]temp_t;
reg temp_Cin;
//第二级暂存寄存器
reg temp_Cin2;
reg [31:0]temp_d2;
reg [31:0]temp_t2;
reg [31:0]temp_A2;
reg [31:0]temp_B2;
reg [31:0]temp_C2;
//第三级暂存寄存器
reg [31:0]temp_A3;
reg [31:0]temp_B3;
reg [31:0]temp_C3;
reg temp_Cin3;