Digital Signal Processing Reference
In-Depth Information
used to help generate VHDL code. The LPM functions also support pipeline
options. Array multiply and divide hardware for more than a few bits requires
extensive hardware and a large FPGA.
LIBRARY IEEE ;
USE IEEE . STD_LOGIC_1164 . ALL ;
USE IEEE .STD_LOGIC_ARITH. ALL ;
USE IEEE .STD_LOGIC_UNSIGNED. ALL ;
LIBRARY lpm;
USE lpm.lpm_components. ALL ;
ENTITY mult IS
PORT ( A, B
: IN STD_LOGIC_VECTOR ( 7 DOWNTO 0 );
Product
: OUT STD_LOGIC_VECTOR ( 15 DOWNTO 0 ) );
END mult;
ARCHITECTURE a OF mult IS
I N
-- LPM 8x8 multiply function P = A * B
multiply: lpm_mult
GENERIC MAP ( LPM_WIDTHA
=> 8,
L
_ I
B
= > 8 ,
L
_ I
S
= > 1 6 ,
L
_ I
P
= > 1 6 ,
LPM_REPRESENTATION
=> "UNSIGNED" )
PORT MAP (
data => A,
datab => B,
result => Product );
END a;
Floating-point operations can be implemented on very large FPGAs; however,
performance is lower than current floating-point DSP and microprocessor
chips. The floating-point algorithms must be coded by the user in VHDL using
integer add, multiply, divide, and shift operations. The LPM_CLSHIFT
function is useful for the barrel shifter needed in a floating-point ALU. Some
floating point IP cores are starting to appear. Many FPGA vendors also have
optimized arithmetic packages for DSP applications such as FIR filters.
6.14 VHDL Synthesis Models for Memory
Typically, it is more efficient to call a vendor-specific function to synthesize
RAM. These functions typically use the FPGA's internal RAM blocks rather
than building a RAM using FPGA logic elements. The memory function in the
Altera toolset is the ALTSYNCRAM function. On the UP2 board's older
FPGA, the LPM_RAM_DQ memory function can also be used. The memory
can be set to an initial value using a separate memory initialization file with the
extension *.mif. A similar call, LPM_ROM, can be used to synthesize ROM.
If small blocks of multi-ported or other special-purpose RAM are needed, they
can be synthesized using registers with address decoders for the write operation
and multiplexers for the read operation. Additional read or write ports can be
Search WWH ::




Custom Search