Skip to content

Utilization

Steven Herbst edited this page Aug 12, 2020 · 11 revisions

Augu 12, 2020

Using part xc7z020clg400-1 (i.e., FPGA on the PYNQ_Z1 board)

Vivado 2020.1

  • Fixed-point:
    • ADD (input range 10, output range 20)
      • WIDTH 25: 24 LUTs
      • WIDTH 24: 23 LUTs
      • WIDTH 26: 25 LUTs
    • ADD_CONST (input range 10, output range 20, constant is 4.56)
      • LONG=25, SHORT=18: 11 LUTs
    • MUL (input range 10, output 100)
      • A, B, C @ 25 bits: 2 DSPs
      • A @ 25, B @ 18, C @ 25: 1 DSP
      • A @ 25, B @ 19, C @ 25: 1 DSP
      • A @ 25, B @ 20, C @ 25: 87 LUTs, 1 DSP
      • A @ 26, B @ 18, C @ 25: 1 DSP
      • A @ 27, B @ 18, C @ 25: 62 LUTs, 1 DSP
      • A @ 19, B @ 19, C @ 25: 1 DSP
      • A @ 20, B @ 20, C @ 25: 69 LUTs, 1 DSP
    • MUL_CONST (input range 10, output range 50, constant is 4.56)
      • LONG_WIDTH=25, SHORT_WIDTH=18: 1 DSP
  • HardFloat:
    • ADD
      • EXP=8, WIDTH=24: 492 LUTs
      • EXP=8, WIDTH=25: 507 LUTs
      • EXP=8, WIDTH=23: 506 LUTs
      • EXP=9, WIDTH=24: 496 LUTs
      • EXP=7, WIDTH=24: 498 LUTs
    • ADD_CONST (constant is 4.56)
      • EXP=8, WIDTH=24: 378 LUTs
    • MUL
      • EXP=8, WIDTH=24: 313 LUTs, 3 DSPs
      • EXP=8, WIDTH=23: 187 LUTs, 2 DSPs
      • EXP=8, WIDTH=25: 348 LUTs, 3 DSPs
      • EXP=8, WIDTH=22: 177 LUTs, 2 DSPs
      • EXP=8, WIDTH=21: 168 LUTs, 2 DSPs
      • EXP=8, WIDTH=20: 238 LUTs, 1 DSP
      • EXP=8, WIDTH=19: 215 LUTs, 1 DSP
      • EXP=8, WIDTH=18: 169 LUTs, 1 DSP
      • EXP=7, WIDTH=24: 321 LUTs, 3 DSPs
      • EXP=9, WIDTH=24: 311 LUTs, 3 DSPs
    • MUL_CONST (constant is 4.56)
      • EXP=8, WIDTH=24: 238 LUTs, 3 DSPs

Sample code for ADD and MUL (modified by hand to run each case):

`timescale 1ns / 1ps
//`define HARD_FLOAT
//`define HARD_FLOAT_EXP_WIDTH 8
//`define HARD_FLOAT_SIG_WIDTH 24
`include "svreal.sv"

module top #(
    parameter integer `WIDTH_PARAM_REAL(a) = 25,
    parameter integer `WIDTH_PARAM_REAL(b) = 18,
    parameter integer `WIDTH_PARAM_REAL(c) = 25
) (
    `INPUT_REAL(a),
    `INPUT_REAL(b),
    `OUTPUT_REAL(c)
);
    localparam real `RANGE_PARAM_REAL(a) = 10;
    localparam integer `EXPONENT_PARAM_REAL(a) = 
        `CALC_EXP(`RANGE_PARAM_REAL(a), `WIDTH_PARAM_REAL(a));

    localparam real `RANGE_PARAM_REAL(b) = 10;
    localparam integer `EXPONENT_PARAM_REAL(b) = 
        `CALC_EXP(`RANGE_PARAM_REAL(b), `WIDTH_PARAM_REAL(b));

    localparam real `RANGE_PARAM_REAL(c) = 100;
    localparam integer `EXPONENT_PARAM_REAL(c) = 
        `CALC_EXP(`RANGE_PARAM_REAL(c), `WIDTH_PARAM_REAL(c));

    `MUL_INTO_REAL(a, b, c);
endmodule

Sample code for ADD_CONST and MUL_CONST (modified by hand to run each case):

`timescale 1ns / 1ps
//`define HARD_FLOAT
//`define HARD_FLOAT_EXP_WIDTH 8
//`define HARD_FLOAT_SIG_WIDTH 24
`include "svreal.sv"

module top #(
    parameter integer `WIDTH_PARAM_REAL(a) = 25,
    parameter integer `WIDTH_PARAM_REAL(b) = 25
) (
    `INPUT_REAL(a),
    `OUTPUT_REAL(b)
);
    localparam real `RANGE_PARAM_REAL(a) = 10;
    localparam integer `EXPONENT_PARAM_REAL(a) = 
        `CALC_EXP(`RANGE_PARAM_REAL(a), `WIDTH_PARAM_REAL(a));

    localparam real `RANGE_PARAM_REAL(b) = 20;
    localparam integer `EXPONENT_PARAM_REAL(b) = 
        `CALC_EXP(`RANGE_PARAM_REAL(b), `WIDTH_PARAM_REAL(b));

    `ADD_CONST_INTO_REAL(4.56, a, b);
endmodule
Clone this wiki locally