
DSP Function Usage Guide for iCE40 Devices
9
VHDL
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
ENTITY mult8x8_inoutreg_unsigned IS
PORT (
clk: IN STD_LOGIC;
prod : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
a_in : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
b_in : IN STD_LOGIC_VECTOR(7 DOWNTO 0)
);
END mult8x8_inoutreg_unsigned;
ARCHITECTURE arch OF mult8x8_inoutreg_unsigned IS
SIGNAL a_reg : STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL b_reg : STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL mult_out : STD_LOGIC_VECTOR(15 DOWNTO 0);
BEGIN
mult_out <= ("00000000" & a_reg * b_reg);
PROCESS (clk)
BEGIN
IF (clk'EVENT AND clk = '1') THEN
a_reg <= a_in;
b_reg <= b_in;
prod <= mult_out;
END IF;
END PROCESS;
END arch;
Instantiation DSP Primitive – SB_MAC16
In order to implement various function in the DSP block, users are required to instantiate the SB_MAC16 block in
their top level HDL code. Different combination of ports are connected to the user logic for various functions.
Table 3 provides a summary of port connections in instantiation based on functions that are required to be imple-
mented. The column on the left provides various signals that are needed to be port mapped during HDL instantia-
tion. The top row provides various functions that can be implemented. The cross references cells indicate whether
the port connection is Signal or Default.
The term “Signal” means that this is one of the signals that user will have to port map to, while implementing the
function. The “Default” implies that this port has to be connected to its default value during port mapping.
The default value of a port can be referenced from Table 1.
In certain cases, the DSP block can have two independent functions, for example two 8x8 multipliers, generating
two 16-bit outputs. Such cases are referenced as Top and Bottom Signals in the table below. In such cases, one of
the 8x8 multipliers can be implemented using Top Signals, and other using Bottom Signals.