This website uses cookies. By using this site, you consent to the use of cookies. For more information, please take a look at our Privacy Policy.
Home > FPGA Technical Tutorials > Design Recipes for FPGAs Using Verilog and VHDL > Multiplication > Simple Multiplication using VHDL

TABLE OF CONTENTS

Xilinx FPGA FPGA Forum

Simple Multiplication using VHDL

FONT SIZE : AAA

As we have seen in the previous example, there is a method of implementing multiplication operations using a “first principles” approach and it is incredibly hungry in terms of both resources and time (taking n shifts to complete a multiplication would lead to a really slow device). 

There is, however, an alternative approach with many modern FPGAs that include multiplier blocks as part of the design. These are custom multiplication blocks already in place on the FPGA and this allows the specific multiply function to be implemented directly in the VHDL. 

We can therefore convert the std_logic_vector signals into signed signals and then apply the product equation directly using the following VHDL (remember a and b are the two inputs, both of type std_logic_vector, and product is the output, also of type std_logic_vector). 

1 Product <= std_logic_vector( signed(a) ∗ signed(b) );

Clearly this is much more efficient VHDL than the previous model, but also remember that it is necessary to declare the IEEE numeric standard library:

1 Use ieee.numeric_std.all;

This allows the use of the signed variable types. The complete model using this approach is much more compact and is shown below:

1 library ieee;

2 use IEEE.std_logic_1164.all;

3 use ieee.numeric_std.all;

4

5 entity mult_sign is

6 generic(top : natural := 15);

7 port (

8 clk : in std_logic;

9 nrst : in std_logic;

10 a : in std_logic_vector (top downto 0);

11 b : in std_logic_vector (top downto 0);

12 product : out std_logic_vector (2∗top+1 downto 0)

13 );

14 end entity mult_sign;

15

16 architecture behavior of mult_sign is

17 begin

18 p1 : process (a,b)

19 begin

20 product <= std_logic_vector(signed(a) ∗ signed(b));

21 end process p1;

22 end architecture behavior;

The resulting synthesis output is much more compact. Clearly the number of IO blocks (IOBs) will remain the same, but the usage internally on the FPGA will be much reduced:

Number of ports : 66

Number of nets : 128

Number of instances : 65

Number of references to this view : 0

Total accumulated area :

Number of Block Multipliers : 1

Number of gates : 0

Number of accumulated instances : 65

Number of global buffers used: 0

***********************************************

Device Utilization for 2VP2fg256

***********************************************

Resource Used Avail Utilization

-----------------------------------------------

IOs 66 140 47.14%

Global Buffers 0 16 0.00%

Function Generators 0 2816 0.00%

CLB Slices 0 1408 0.00%

Dffs or Latches 0 3236 0.00%

Block RAMs 0 12 0.00%

Block Multipliers 1 12 8.33%

Clearly, for this device, there are 12 multipliers available, and we have used only one, so the utilization of the remainder of the device is zero. This does lead to the ability to implement certain lower order filters very effectively using devices such as these.

  • XCV300-4PQG240C

    Manufacturer:Xilinx

  • FPGA Virtex Family 322.97K Gates 6912 Cells 250MHz 0.22um Technology 2.5V 240-Pin HSPQFP EP
  • Product Categories:

    Lifecycle:Obsolete -

    RoHS:

  • XC2V2000-5FGG676C

    Manufacturer:Xilinx

  • FPGA Virtex-II Family 2M Gates 24192 Cells 750MHz 0.15um Technology 1.5V 676-Pin FBGA
  • Product Categories: FPGAs (Field Programmable Gate Array)

    Lifecycle:Obsolete -

    RoHS:

  • XC3090-70PQ160C

    Manufacturer:Xilinx

  • FPGA XC3000 Family 6K Gates 320 Cells 70MHz 5V 160-Pin PQFP
  • Product Categories:

    Lifecycle:Obsolete -

    RoHS: No RoHS

  • XCS30XL-4TQG144I

    Manufacturer:Xilinx

  • XCS30XL-4TQG144I - NOT RECOMMENDED for NEW DESIGN
  • Product Categories: CPLD/FPGA

    Lifecycle:Obsolete -

    RoHS: -

  • XC3090A-7PG175B

    Manufacturer:Xilinx

  • Xilinx QFP
  • Product Categories:

    Lifecycle:Any -

    RoHS: -

Need Help?

Support

If you have any questions about the product and related issues, Please contact us.