VHDL input is not a globally static - vhdl

library ieee;
use ieee.std_logic_1164.all;
entity alu_1bit is
port (
i_OPERATION : in std_logic_vector(1 downto 0); -- entrada de operação (controle de operação)
i_INV_BIT : in std_logic;
i_CARRY_IN : in std_logic;
i_A : in std_logic;
i_B : in std_logic;
i_LESS : in std_logic;
o_RESULT : out std_logic;
o_CARRY_OUT : out std_logic);
end alu_1bit;
architecture arch_1 of alu_1bit is
component full_adder is
port (
i_CIN : in std_logic;
i_DIN0 : in std_logic;
i_DIN1 : in std_logic;
o_DOUT : out std_logic;
o_COUT : out std_logic);
end component;
component mux4 is
port(i_SEL : in std_logic_vector(1 downto 0);
i_DIN0 : in std_logic;
i_DIN1 : in std_logic;
i_DIN2 : in std_logic;
i_DIN3 : in std_logic;
o_DOUT : out std_logic);
end component;
signal w_B : std_logic;
signal w_C : std_logic;
signal w_D : std_logic;
signal w_OUTFA : std_logic;
begin
w_B <= i_INV_BIT xor i_B;
w_C <= i_A and i_B;
w_D <= i_A or i_B;
u_1 : full_adder port map (i_CIN => i_CARRY_IN,
i_DIN0 => i_A,
i_DIN1 => w_B,
o_DOUT => w_OUTFA,
o_COUT => o_CARRY_OUT);
u_2 : mux4 port map(i_SEL => i_OPERATION,
i_DIN0 => w_C,
i_DIN1 => w_D,
i_DIN2 => w_OUTFA,
i_DIN3 => i_LESS,
o_DOUT => o_RESULT);
end arch_1;
I'm trying to simulate this on Quartus ModelSim but is giving me the following error on ModelSim.
Error: .../alu_1bit_msb.vhd(53): (vcom-1436) Actual expression (infix expression) of formal "i_DIN0" is not globally static.
Error: .../alu_1bit_msb.vhd(54): (vcom-1436) Actual expression (infix expression) of formal "i_DIN1" is not globally static.
I've already removed the logic expression out of the port map of mux4, i used a signal do this...
Full addder code:
library ieee;
use ieee.std_logic_1164.all;
entity full_adder is
port (
i_CIN : in std_logic;
i_DIN0 : in std_logic;
i_DIN1 : in std_logic;
o_DOUT : out std_logic;
o_COUT : out std_logic);
end full_adder;
architecture arch_1 of full_adder is
begin
o_DOUT <= i_CIN xor i_DIN0 xor i_DIN1;
o_COUT <= (i_CIN and i_DIN0) or
(i_CIN and i_DIN1) or
(i_DIN0 and i_DIN1);
end arch_1;
MUX4 code:
library ieee;
use ieee.std_logic_1164.all;
entity mux4 is
port (
i_SEL : in std_logic_vector(1 downto 0);
i_DIN0 : in std_logic;
i_DIN1 : in std_logic;
i_DIN2 : in std_logic;
i_DIN3 : in std_logic;
o_DOUT : out std_logic);
end mux4;
architecture arch_1 of mux4 is
begin
o_DOUT <= i_DIN0 when i_SEL = "00" else
i_DIN1 when i_SEL = "01" else
i_DIN2 when i_SEL = "10" else
i_DIN3;
end arch_1;
alu32 code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_misc.all;
entity alu_32bit is
port (
i_OPERATION : in std_logic_vector(1 downto 0);
i_INV_BIT : in std_logic;
i_A : in std_logic_vector(31 downto 0);
i_B : in std_logic_vector(31 downto 0);
o_RESULT : out std_logic_vector(31 downto 0);
o_ZERO : out std_logic;
o_OVERFLOW : out std_logic);
end alu_32bit;
architecture arch_1 of alu_32bit is
component alu_1bit is
port (
i_OPERATION : in std_logic_vector(1 downto 0);
i_INV_BIT : in std_logic;
i_CARRY_IN : in std_logic;
i_A : in std_logic;
i_B : in std_logic;
i_LESS : in std_logic;
o_RESULT : out std_logic;
o_CARRY_OUT : out std_logic);
end component;
component alu_1bit_msb is
port (
i_OPERATION : in std_logic_vector(1 downto 0); -- entrada de operação (controle de operação)
i_INV_BIT : in std_logic;
i_CARRY_IN : in std_logic;
i_A : in std_logic;
i_B : in std_logic;
i_LESS : in std_logic;
o_RESULT : out std_logic;
o_SET : out std_logic;
o_OVERFLOW : out std_logic);
end component;
signal w_RESULT : std_logic_vector(31 downto 0);
signal w_CARRY : std_logic_vector(30 downto 0);
signal w_SET : std_logic;
begin
o_RESULT <= w_RESULT;
o_ZERO <= NOT (or_reduce(w_RESULT));
u_0: alu_1bit port map (i_OPERATION => i_OPERATION,
i_INV_BIT => i_INV_BIT,
i_CARRY_IN => i_INV_BIT,
i_A => i_A(0),
i_B => i_B(0),
i_LESS => w_SET,
o_RESULT => w_RESULT(0),
o_CARRY_OUT => w_CARRY(0));
f_0: for i in 1 to (30) generate
u_1: alu_1bit port map (i_OPERATION => i_OPERATION,
i_INV_BIT => i_INV_BIT,
i_CARRY_IN => w_CARRY(i-1),
i_A => i_A(i),
i_B => i_B(i),
i_LESS => '0',
o_RESULT => w_RESULT(i),
o_CARRY_OUT => w_CARRY(i));
end generate f_0;
u_2: alu_1bit_msb port map (i_OPERATION => i_OPERATION,
i_INV_BIT => i_INV_BIT,
i_CARRY_IN => w_CARRY(30),
i_A => i_A(31),
i_B => i_B(31),
i_LESS => '0',
o_RESULT => w_RESULT(31),
o_SET => w_SET,
o_OVERFLOW => o_OVERFLOW);
end arch_1;
alu_1bit_msb code :
library ieee;
use ieee.std_logic_1164.all;
entity alu_1bit_msb is
port (
i_OPERATION : in std_logic_vector(1 downto 0);
i_INV_BIT : in std_logic;
i_CARRY_IN : in std_logic;
i_A : in std_logic;
i_B : in std_logic;
i_LESS : in std_logic;
o_RESULT : out std_logic;
o_SET : out std_logic;
o_OVERFLOW : out std_logic);
end alu_1bit_msb;
architecture arch_1 of alu_1bit_msb is
component full_adder is
port (
i_CIN : in std_logic;
i_DIN0 : in std_logic;
i_DIN1 : in std_logic;
o_DOUT : out std_logic;
o_COUT : out std_logic);
end component;
component mux4 is
port(i_SEL : in std_logic_vector(1 downto 0);
i_DIN0 : in std_logic;
i_DIN1 : in std_logic;
i_DIN2 : in std_logic;
i_DIN3 : in std_logic;
o_DOUT : out std_logic);
end component;
signal w_B : std_logic;
signal w_OUTFA : std_logic;
signal w_COUT : std_logic;
begin
w_B <= i_INV_BIT XOR i_B;
o_SET <= w_OUTFA;
o_OVERFLOW <= (w_COUT XOR i_CARRY_IN) AND i_OPERATION(1);
u_1: full_adder port map (i_CIN => i_CARRY_IN,
i_DIN0 => i_A,
i_DIN1 => w_B,
o_DOUT => w_OUTFA,
o_COUT => w_COUT);
u_2: mux4 port map(
i_SEL => i_OPERATION,
i_DIN0 => i_A AND i_B,
i_DIN1 => i_A OR i_B,
i_DIN2 => w_OUTFA,
i_DIN3 => i_LESS,
o_DOUT => o_RESULT);
end arch_1;

Do you realize you didn't post alu_1bit_msb.vhd in your question originally while showing us error messages for it? The confusion on your audience's part is pardonable. A file name isn't required to bear any relationship to declarations found within.
In any event the fix you put in alu_1bit should also be put in alu_1bit_msb:
architecture arch_1 of alu_1bit_msb is
component full_adder is
port (
i_CIN : in std_logic;
i_DIN0 : in std_logic;
i_DIN1 : in std_logic;
o_DOUT : out std_logic;
o_COUT : out std_logic);
end component;
component mux4 is
port(i_SEL : in std_logic_vector(1 downto 0);
i_DIN0 : in std_logic;
i_DIN1 : in std_logic;
i_DIN2 : in std_logic;
i_DIN3 : in std_logic;
o_DOUT : out std_logic);
end component;
signal w_B : std_logic;
signal w_C: std_logic; -- added
signal w_D: std_logic; -- added
signal w_OUTFA : std_logic;
signal w_COUT : std_logic;
begin
w_B <= i_INV_BIT XOR i_B;
o_SET <= w_OUTFA;
w_C <= i_A and i_B; -- added
w_D <= i_A or i_B; -- added
o_OVERFLOW <= (w_COUT XOR i_CARRY_IN) AND i_OPERATION(1);
u_1: full_adder port map (i_CIN => i_CARRY_IN,
i_DIN0 => i_A,
i_DIN1 => w_B,
o_DOUT => w_OUTFA,
o_COUT => w_COUT);
u_2: mux4 port map(
i_SEL => i_OPERATION,
i_DIN0 => w_C, -- was i_A AND i_B,
i_DIN1 => w_D, -- was i_A OR i_B,
i_DIN2 => w_OUTFA,
i_DIN3 => i_LESS,
o_DOUT => o_RESULT);
end arch_1;
Your arch_1 of alu_1bit_msb analyzes (alu_1bit_msb.vhd should compile with vcom).
After that if you have a different problem ask a different question, and please provide an MCVe so the problem can be reproduced.

Related

HDMI Pass Through with RGB Switch Filter

I'm very new to VHDL and FPGAs, and have hit a rock. Im currently working on video filters on the zybo z7-10, and started off using this guide to create a HDMI passthrough on the board:
https://github.com/dpaul24/hdmi_pass_through_ZyboZ7-10?_ga=2.34188391.796043983.1579510279-2100398226.1578999679
So after getting that working all i want to do is be able to effect the video output. To do this, I tried to set the rgb 24 bit vectors last 8 bits to 0, removing all blue from the output. If i try the following code (with or without the process block) i get a syntax error on the "if" statement line
process is
begin
if sw ='0' then
vid_pData(7 downto 0) <= sw
end if;
end process;
The issue is I don't seem to be able to put this anywhere in the code without causing an error. Can someone explain what's happening here?
Full code below:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
library UNISIM;
use UNISIM.VComponents.all;
entity hdmi_pass_top is
Port (
sysclk_i : in std_logic; -- 125MH System Clock Input
async_reset_i : in std_logic; -- Reset switch on board
-- HDMI In/Rx
tmds_rx_clk_p_i : in std_logic;
tmds_rx_clk_n_i : in std_logic;
tmds_rx_data_p_i : in std_logic_vector(2 downto 0);
tmds_rx_data_n_i : in std_logic_vector(2 downto 0);
hdmi_rx_hpd_o : out std_logic := '1'; -- HPD must be driven
-- I2C
sda_io : inout std_logic;
scl_io : inout std_logic;
-- HDMI Out/Tx
tmds_tx_clk_p_o : out std_logic;
tmds_tx_clk_n_o : out std_logic;
tmds_tx_data_p_o : out std_logic_vector(2 downto 0);
tmds_tx_data_n_o : out std_logic_vector(2 downto 0);
sw : in std_logic
);
end hdmi_pass_top;
architecture hdmi_pass_top_arc of hdmi_pass_top is
component dvi2rgb_0
port (
TMDS_Clk_p : in std_logic;
TMDS_Clk_n : in std_logic;
TMDS_Data_p : in std_logic_vector(2 downto 0);
TMDS_Data_n : in std_logic_vector(2 downto 0);
RefClk : in std_logic;
aRst : in std_logic;
vid_pData : out std_logic_vector(23 downto 0);
vid_pVDE : out std_logic;
vid_pHSync : out std_logic;
vid_pVSync : out std_logic;
PixelClk : out std_logic;
aPixelClkLckd : out std_logic;
SDA_I : in std_logic;
SDA_O : out std_logic;
SDA_T : out std_logic;
SCL_I : in std_logic;
SCL_O : out std_logic;
SCL_T : out std_logic;
pRst : in std_logic
);
end component;
component rgb2dvi_0
PORT (
TMDS_Clk_p : out std_logic;
TMDS_Clk_n : out std_logic;
TMDS_Data_p : out std_logic_vector(2 downto 0);
TMDS_Data_n : out std_logic_vector(2 downto 0);
aRst : in std_logic;
vid_pData : in std_logic_vector(23 downto 0);
vid_pVDE : in std_logic;
vid_pHSync : in std_logic;
vid_pVSync : in std_logic;
PixelClk : in std_logic
);
end component;
component clk_wiz_0
port
(-- Clock in ports
-- Clock out ports
clk_out1 : out std_logic;
-- Status and control signals
reset : in std_logic;
locked : out std_logic;
clk_in1 : in std_logic
);
end component;
signal vid_pData : std_logic_vector(23 downto 0);
signal vid_pVDE : std_logic;
signal vid_pHSync : std_logic;
signal vid_pVSync : std_logic;
signal pixelclk : std_logic;
signal locked : std_logic;
signal clk_200M : std_logic;
signal pixel_clk_sync_rst : std_logic;
signal sda_i : std_logic;
signal sda_o : std_logic;
signal sda_t : std_logic;
signal scl_i : std_logic;
signal scl_o : std_logic;
signal scl_t : std_logic;
begin
clkwiz_inst : clk_wiz_0
port map (
-- Clock out ports
clk_out1 => clk_200M,
-- Status and control signals
reset => async_reset_i,
locked => locked,
-- Clock in ports
clk_in1 => sysclk_i
);
dvi2rgb_inst : dvi2rgb_0
port map (
TMDS_Clk_p => tmds_rx_clk_p_i,
TMDS_Clk_n => tmds_rx_clk_n_i,
TMDS_Data_p => tmds_rx_data_p_i,
TMDS_Data_n => tmds_rx_data_n_i,
RefClk => clk_200M,
aRst => async_reset_i, --Active high asynchronous RefClk reset
vid_pData => vid_pData,
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk,
aPixelClkLckd => open, --
SDA_I => sda_i,
SDA_O => sda_o,
SDA_T => sda_t,
SCL_I => scl_i,
SCL_O => scl_o,
SCL_T => scl_t,
pRst => '0' -- Active high PixelClk synchronous reset
);
SDA_IOBUF_inst: IOBUF
generic map(
DRIVE => 12,
IOSTANDARD => "DEFAULT",
SLEW => "SLOW"
)
port map(
O => sda_i, -- Buffer output
IO => sda_io, -- Buffer inout port(connect directly to top-level port)
I => sda_o, -- Bufferinput
T => sda_t -- 3-state enable input,high=input,low=output
);
SCL_IOBUF_inst: IOBUF
generic map(
DRIVE => 12,
IOSTANDARD => "DEFAULT",
SLEW => "SLOW"
)
port map(
O => scl_i, -- Buffer output
IO => scl_io, -- Buffer inout port(connect directly to top-level port)
I => scl_o, -- Buffer input
T => scl_t -- 3-state enable input,high=input,low=output
);
rgb2dvi_inst : rgb2dvi_0
port map (
TMDS_Clk_p => tmds_tx_clk_p_o,
TMDS_Clk_n => tmds_tx_clk_n_o,
TMDS_Data_p => tmds_tx_data_p_o,
TMDS_Data_n => tmds_tx_data_n_o,
aRst => async_reset_i,
vid_pData => vid_pData,
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk
);
end hdmi_pass_top_arc;
EDIT: changed my if statement to
vid_pData(7 downto 0) <= "00000000" when sw = '0';
and it got rid of the error but the implementation failed. The failure is:
[DRC MDRV-1] Multiple Driver Nets: Net
dvi2rgb_inst/U0/GenerateBUFG.ResyncToBUFG_X/vid_pData[0] has multiple
drivers: vid_pData_reg[0]/Q, and
dvi2rgb_inst/U0/GenerateBUFG.ResyncToBUFG_X/poData_reg[0]/Q.
You're not writing software, you're designing hardware. Your extra code drives signal vid_pData. So, does component dvi2rgb_0. So you have two drivers on that signal. A short circuit in other words.
Also, you do not say what value vid_pData should take if sw is not equal to '0'. Therefore, you will get latches in your hardware. (Google "inferring a latch".)
You need a new signal, eg:
signal vid_pData_new : std_logic_vector(23 downto 0);
then you need to assign a value for both sw equals '0' and '1', otherwise you will get a latch:
vid_pData_new(7 downto 0) <= vid_pData(23 downto 8) & "00000000" when sw = '0' else vid_pData;
The & operator is the concatenation operator. Finally, you need to drive component rgb2dvi_0 with your new signal:
rgb2dvi_inst : rgb2dvi_0
port map (
TMDS_Clk_p => tmds_tx_clk_p_o,
TMDS_Clk_n => tmds_tx_clk_n_o,
TMDS_Data_p => tmds_tx_data_p_o,
TMDS_Data_n => tmds_tx_data_n_o,
aRst => async_reset_i,
vid_pData => vid_pData_new, -- <-----------------
vid_pVDE => vid_pVDE,
vid_pHSync => vid_pHSync,
vid_pVSync => vid_pVSync,
PixelClk => pixelclk
);
Can you see what has been done here? We have inserted a new piece of hardware that drives the new signal vid_pData_new and have specified its value for both possible values of sw. We must do this, otherwise we will get latches. We are designing hardware, not writing software.

7 Series Transceiver synthesis issue

I'm having some synthesis issues using 7 series GTX transceiver wizard in my project. I designed a basic custom protocol and a top level wrapper. In behavioral everything works just fine, but when synthesizing project the data bus attached to gt0_txdata_in[15:0] it's not properly rendered thus forcing unknown "X" (same thing happens for gt0_txcharisk_in[1:0]). I'm using Vivado and the compiler doesn't give me any specific warning. I've also looked at gtwizard example design and I'm not doing anything too different from that.
I'm developing my project on Kintex-7 FPGA.
Here is scope and wave window:
(click to enlarge)
(click to enlarge)
Here is my protocol VHDL entity:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity protocol_frame_gen is
Port ( pfg_clk_in : in STD_LOGIC;
pfg_reset_in : in STD_LOGIC;
pfg_data_in : in STD_LOGIC_VECTOR (15 downto 0);
pfg_fifo_empty_in : in STD_LOGIC;
pfg_trasm_rqst_in : in STD_LOGIC;
pfg_fifo_rd_enable_out : out STD_LOGIC;
pfg_data_out : out STD_LOGIC_VECTOR (15 downto 0);
pfg_txcharisk: out STD_LOGIC_VECTOR (1 downto 0)
);
end protocol_frame_gen;
architecture Behavioral of protocol_frame_gen is
type state_type is ( idle, trasmission, dummy_state, end_trasmission);
signal state: state_type;
signal pfg_data_out_reg: STD_LOGIC_VECTOR (15 downto 0):= (others => '0');
signal mux_addr: integer range 0 to 3 := 0;
begin
pfg_data_out <= pfg_data_out_reg;
main: process(pfg_reset_in, pfg_clk_in)
begin
if pfg_reset_in='1' then
state <= idle;
mux_addr <= 0;
pfg_fifo_rd_enable_out <= '0';
elsif rising_edge(pfg_clk_in) then
case state is
when idle =>
if pfg_trasm_rqst_in='1' then
state <= trasmission;
end if;
when trasmission =>
if mux_addr<2 then
mux_addr <= mux_addr+1;
pfg_fifo_rd_enable_out <= '1';
else
null;
end if;
if pfg_fifo_empty_in='1' then
state <= end_trasmission;
pfg_fifo_rd_enable_out <= '0';
mux_addr <= 3;
end if;
when end_trasmission =>
mux_addr <= 0;
state <= idle;
when dummy_state =>
null;
end case;
end if;
end process main;
mux: process (pfg_clk_in)
begin
if rising_edge(pfg_clk_in) then
if mux_addr=0 then
pfg_data_out_reg <= "1111110111111101"; --idle character K29.7 1111110111111101
pfg_txcharisk <= "00";
elsif mux_addr=1 then
pfg_data_out_reg <= "0000000110111100"; --start of frame K28.5 1011110010111100
pfg_txcharisk <= "01";
elsif mux_addr=2 then
pfg_data_out_reg <= pfg_data_in; --valid data
pfg_txcharisk <= "00";
elsif mux_addr=3 then
pfg_data_out_reg <= "0001110000011100"; --end of frame K28.0
pfg_txcharisk <= "00";
end if;
end if;
end process mux;
end Behavioral;
here is wrapper code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_misc.all;
library UNISIM;
use UNISIM.VCOMPONENTS.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
library UNISIM;
use UNISIM.VComponents.all;
entity gtx_interface_wrapper is
Port (--reset
gt_soft_reset_in: in STD_LOGIC;
protocol_reset_in: in STD_LOGIC;
--clocking
GTREFCLK_PAD_P_IN: in STD_LOGIC;
GTREFCLK_PAD_N_IN: in STD_LOGIC;
tx_fifo_clk_out : out STD_LOGIC;
rx_fifo_clk_out : out STD_LOGIC;
fsm_clk_in: in STD_LOGIC;
--tx
tx_data_in : in STD_LOGIC_VECTOR (15 downto 0);
tx_fifo_empty_in : in STD_LOGIC;
tx_trasm_rqst_in : in STD_LOGIC;
tx_fifo_rd_enable_out : out STD_LOGIC;
--rx
rx_data_out : out STD_LOGIC_VECTOR (15 downto 0);
rx_fifo_wren_out : out STD_LOGIC;
--serial I/O
gtxtxp_out: out STD_LOGIC;
gtxtxn_out: out STD_LOGIC;
gtxrxp_in: in STD_LOGIC;
gtxrxn_in: IN STD_LOGIC
);
end gtx_interface_wrapper;
architecture Mapping of gtx_interface_wrapper is
----Component Declaration------
component gtwizard_0
port
(
SOFT_RESET_TX_IN : in std_logic;
SOFT_RESET_RX_IN : in std_logic;
DONT_RESET_ON_DATA_ERROR_IN : in std_logic;
Q0_CLK1_GTREFCLK_PAD_N_IN : in std_logic;
Q0_CLK1_GTREFCLK_PAD_P_IN : in std_logic;
GT0_TX_FSM_RESET_DONE_OUT : out std_logic;
GT0_RX_FSM_RESET_DONE_OUT : out std_logic;
GT0_DATA_VALID_IN : in std_logic;
GT0_TX_MMCM_LOCK_OUT : out std_logic;
GT0_RX_MMCM_LOCK_OUT : out std_logic;
GT0_TXUSRCLK_OUT : out std_logic;
GT0_TXUSRCLK2_OUT : out std_logic;
GT0_RXUSRCLK_OUT : out std_logic;
GT0_RXUSRCLK2_OUT : out std_logic;
gt0_cpllfbclklost_out : out std_logic;
gt0_cplllock_out : out std_logic;
gt0_cpllreset_in : in std_logic;
gt0_drpaddr_in : in std_logic_vector(8 downto 0);
gt0_drpdi_in : in std_logic_vector(15 downto 0);
gt0_drpdo_out : out std_logic_vector(15 downto 0);
gt0_drpen_in : in std_logic;
gt0_drprdy_out : out std_logic;
gt0_drpwe_in : in std_logic;
gt0_dmonitorout_out : out std_logic_vector(7 downto 0);
gt0_eyescanreset_in : in std_logic;
gt0_rxuserrdy_in : in std_logic;
gt0_eyescandataerror_out : out std_logic;
gt0_eyescantrigger_in : in std_logic;
gt0_rxdata_out : out std_logic_vector(15 downto 0);
gt0_rxdisperr_out : out std_logic_vector(1 downto 0);
gt0_rxnotintable_out : out std_logic_vector(1 downto 0);
gt0_gtxrxp_in : in std_logic;
gt0_gtxrxn_in : in std_logic;
gt0_rxdfelpmreset_in : in std_logic;
gt0_rxmonitorout_out : out std_logic_vector(6 downto 0);
gt0_rxmonitorsel_in : in std_logic_vector(1 downto 0);
gt0_rxoutclkfabric_out : out std_logic;
gt0_gtrxreset_in : in std_logic;
gt0_rxpmareset_in : in std_logic;
gt0_rxmcommaalignen_in : in std_logic;
gt0_rxpcommaalignen_in : in std_logic;
gt0_rxchariscomma_out : out std_logic_vector(1 downto 0);
gt0_rxcharisk_out : out std_logic_vector(1 downto 0);
gt0_rxresetdone_out : out std_logic;
gt0_gttxreset_in : in std_logic;
gt0_txuserrdy_in : in std_logic;
gt0_txdata_in : in std_logic_vector(15 downto 0);
gt0_gtxtxn_out : out std_logic;
gt0_gtxtxp_out : out std_logic;
gt0_txoutclkfabric_out : out std_logic;
gt0_txoutclkpcs_out : out std_logic;
gt0_txcharisk_in : in std_logic_vector(1 downto 0);
gt0_txresetdone_out : out std_logic;
GT0_QPLLOUTCLK_OUT : out std_logic;
GT0_QPLLOUTREFCLK_OUT : out std_logic;
sysclk_in : in std_logic
);
end component;
component protocol_frame_gen
port
(
pfg_clk_in : in STD_LOGIC;
pfg_reset_in : in STD_LOGIC;
pfg_data_in : in STD_LOGIC_VECTOR (15 downto 0);
pfg_fifo_empty_in : in STD_LOGIC;
pfg_trasm_rqst_in : in STD_LOGIC;
pfg_fifo_rd_enable_out : out STD_LOGIC;
pfg_data_out : out STD_LOGIC_VECTOR (15 downto 0);
pfg_txcharisk: out STD_LOGIC_VECTOR (1 downto 0)
);
end component;
component protocol_frame_check
port
(
pfc_clk_in : in STD_LOGIC;
pfc_reset_in : in STD_LOGIC;
pfc_data_in : in STD_LOGIC_VECTOR (15 downto 0);
pfc_data_out : out STD_LOGIC_VECTOR (15 downto 0);
pfc_fifo_wren_out : out STD_LOGIC
);
end component;
--_______________________INTERNAL REGISTER______________________--
--gt0 I/O registers
signal SOFT_RESET_TX_IN_i: std_logic;
signal SOFT_RESET_RX_IN_i: std_logic;
signal DONT_RESET_ON_DATA_ERROR_IN_i: std_logic;
signal Q0_CLK1_GTREFCLK_PAD_N_IN_i: std_logic;
signal Q0_CLK1_GTREFCLK_PAD_P_IN_i: std_logic;
signal GT0_TX_FSM_RESET_DONE_OUT_i: std_logic;
signal GT0_RX_FSM_RESET_DONE_OUT_i: std_logic;
signal GT0_DATA_VALID_IN_i: std_logic;
signal GT0_TX_MMCM_LOCK_OUT_i: std_logic;
signal GT0_RX_MMCM_LOCK_OUT_i: std_logic;
signal GT0_TXUSRCLK_OUT_i: std_logic;
signal GT0_TXUSRCLK2_OUT_i: std_logic;
signal GT0_RXUSRCLK_OUT_i: std_logic;
signal GT0_RXUSRCLK2_OUT_i: std_logic;
signal gt0_cpllfbclklost_out_i: std_logic;
signal gt0_cplllock_out_i: std_logic;
signal gt0_cpllreset_in_i: std_logic;
signal gt0_drpaddr_in_i: std_logic_vector(8 downto 0);
signal gt0_drpdi_in_i: std_logic_vector(15 downto 0);
signal gt0_drpdo_out_i: std_logic_vector(15 downto 0);
signal gt0_drpen_in_i: std_logic;
signal gt0_drprdy_out_i: std_logic;
signal gt0_drpwe_in_i: std_logic;
signal gt0_dmonitorout_out_i: std_logic_vector(7 downto 0);
signal gt0_eyescanreset_in_i: std_logic;
signal gt0_rxuserrdy_in_i: std_logic;
signal gt0_eyescandataerror_out_i: std_logic;
signal gt0_eyescantrigger_in_i: std_logic;
signal gt0_rxdata_out_i: std_logic_vector(15 downto 0);
signal gt0_rxdisperr_out_i: std_logic_vector(1 downto 0);
signal gt0_rxnotintable_out_i: std_logic_vector(1 downto 0);
signal gt0_gtxrxp_in_i: std_logic;
signal gt0_gtxrxn_in_i: std_logic;
signal gt0_rxdfelpmreset_in_i: std_logic;
signal gt0_rxmonitorout_out_i: std_logic_vector(6 downto 0);
signal gt0_rxmonitorsel_in_i: std_logic_vector(1 downto 0);
signal gt0_rxoutclkfabric_out_i: std_logic;
signal gt0_gtrxreset_in_i: std_logic;
signal gt0_rxpmareset_in_i: std_logic;
signal gt0_rxmcommaalignen_in_i: std_logic;
signal gt0_rxpcommaalignen_in_i: std_logic;
signal gt0_rxchariscomma_out_i: std_logic_vector(1 downto 0);
signal gt0_rxcharisk_out_i: std_logic_vector(1 downto 0);
signal gt0_rxresetdone_out_i: std_logic;
signal gt0_gttxreset_in_i: std_logic;
signal gt0_txuserrdy_in_i: std_logic;
signal gt0_txdata_in_i: std_logic_vector(15 downto 0);
signal gt0_gtxtxn_out_i: std_logic;
signal gt0_gtxtxp_out_i: std_logic;
signal gt0_txoutclkfabric_out_i: std_logic;
signal gt0_txoutclkpcs_out_i: std_logic;
signal gt0_txcharisk_in_i: std_logic_vector(1 downto 0);
signal gt0_txresetdone_out_i: std_logic;
signal GT0_QPLLOUTCLK_OUT_i: std_logic;
signal GT0_QPLLOUTREFCLK_OUT_i: std_logic;
signal sysclk_in_i: std_logic ;
--frame generator
signal pfg_clk_in_i: STD_LOGIC;
signal pfg_reset_in_i: STD_LOGIC;
signal pfg_data_in_i: STD_LOGIC_VECTOR (15 downto 0);
signal pfg_fifo_empty_in_i: STD_LOGIC;
signal pfg_trasm_rqst_in_i: STD_LOGIC;
signal pfg_fifo_rd_enable_out_i: STD_LOGIC;
signal pfg_data_out_i: STD_LOGIC_VECTOR (15 downto 0) ;
signal pfg_txcharisk_i: std_logic_vector(1 downto 0);
--frame checker
signal pfc_clk_in_i: STD_LOGIC;
signal pfc_reset_in_i: STD_LOGIC;
signal pfc_data_in_i: STD_LOGIC_VECTOR (15 downto 0);
signal pfc_data_out_i: STD_LOGIC_VECTOR (15 downto 0);
signal pfc_fifo_wren_out_i: STD_LOGIC;
begin
unit_gt0: gtwizard_0 port map ( SOFT_RESET_TX_IN => SOFT_RESET_TX_IN_i,
SOFT_RESET_RX_IN => SOFT_RESET_RX_IN_i,
DONT_RESET_ON_DATA_ERROR_IN => DONT_RESET_ON_DATA_ERROR_IN_i,
Q0_CLK1_GTREFCLK_PAD_N_IN => Q0_CLK1_GTREFCLK_PAD_N_IN_i,
Q0_CLK1_GTREFCLK_PAD_P_IN => Q0_CLK1_GTREFCLK_PAD_P_IN_i,
GT0_TX_FSM_RESET_DONE_OUT => GT0_TX_FSM_RESET_DONE_OUT_i,
GT0_RX_FSM_RESET_DONE_OUT => GT0_RX_FSM_RESET_DONE_OUT_i,
GT0_DATA_VALID_IN => GT0_DATA_VALID_IN_i,
GT0_TX_MMCM_LOCK_OUT => GT0_TX_MMCM_LOCK_OUT_i,
GT0_RX_MMCM_LOCK_OUT => GT0_RX_MMCM_LOCK_OUT_i,
GT0_TXUSRCLK_OUT => GT0_TXUSRCLK_OUT_i,
GT0_TXUSRCLK2_OUT => GT0_TXUSRCLK2_OUT_i,
GT0_RXUSRCLK_OUT => GT0_RXUSRCLK_OUT_i,
GT0_RXUSRCLK2_OUT => GT0_RXUSRCLK2_OUT_i,
gt0_cpllfbclklost_out => gt0_cpllfbclklost_out_i,
gt0_cplllock_out => gt0_cplllock_out_i,
gt0_cpllreset_in => gt0_cpllreset_in_i,
gt0_drpaddr_in => gt0_drpaddr_in_i,
gt0_drpdi_in => gt0_drpdi_in_i,
gt0_drpdo_out => gt0_drpdo_out_i,
gt0_drpen_in => gt0_drpen_in_i,
gt0_drprdy_out => gt0_drprdy_out_i,
gt0_drpwe_in => gt0_drpwe_in_i,
gt0_dmonitorout_out => gt0_dmonitorout_out_i,
gt0_eyescanreset_in => gt0_eyescanreset_in_i,
gt0_rxuserrdy_in => gt0_rxuserrdy_in_i,
gt0_eyescandataerror_out => gt0_eyescandataerror_out_i,
gt0_eyescantrigger_in => gt0_eyescantrigger_in_i,
gt0_rxdata_out => gt0_rxdata_out_i,
gt0_rxdisperr_out => gt0_rxdisperr_out_i,
gt0_rxnotintable_out => gt0_rxnotintable_out_i,
gt0_gtxrxp_in => gt0_gtxrxp_in_i,
gt0_gtxrxn_in => gt0_gtxrxn_in_i,
gt0_rxdfelpmreset_in => gt0_rxdfelpmreset_in_i,
gt0_rxmonitorout_out => gt0_rxmonitorout_out_i,
gt0_rxmonitorsel_in => gt0_rxmonitorsel_in_i,
gt0_rxoutclkfabric_out => gt0_rxoutclkfabric_out_i,
gt0_gtrxreset_in => gt0_gtrxreset_in_i,
gt0_rxpmareset_in => gt0_rxpmareset_in_i,
gt0_rxmcommaalignen_in => gt0_rxmcommaalignen_in_i,
gt0_rxpcommaalignen_in => gt0_rxpcommaalignen_in_i,
gt0_rxchariscomma_out => gt0_rxchariscomma_out_i,
gt0_rxcharisk_out => gt0_rxcharisk_out_i,
gt0_rxresetdone_out => gt0_rxresetdone_out_i,
gt0_gttxreset_in => gt0_gttxreset_in_i,
gt0_txuserrdy_in => gt0_txuserrdy_in_i,
gt0_txdata_in => gt0_txdata_in_i,
gt0_gtxtxn_out => gt0_gtxtxn_out_i,
gt0_gtxtxp_out => gt0_gtxtxp_out_i,
gt0_txoutclkfabric_out => gt0_txoutclkfabric_out_i,
gt0_txoutclkpcs_out => gt0_txoutclkpcs_out_i,
gt0_txcharisk_in => gt0_txcharisk_in_i,
gt0_txresetdone_out => gt0_txresetdone_out_i,
GT0_QPLLOUTCLK_OUT => GT0_QPLLOUTCLK_OUT_i,
GT0_QPLLOUTREFCLK_OUT => GT0_QPLLOUTREFCLK_OUT_i,
sysclk_in => sysclk_in_i );
unit_pfg: protocol_frame_gen port map ( pfg_clk_in => pfg_clk_in_i,
pfg_reset_in => pfg_reset_in_i,
pfg_data_in => pfg_data_in_i,
pfg_fifo_empty_in => pfg_fifo_empty_in_i,
pfg_trasm_rqst_in => pfg_trasm_rqst_in_i,
pfg_fifo_rd_enable_out => pfg_fifo_rd_enable_out_i,
pfg_data_out => pfg_data_out_i,
pfg_txcharisk => pfg_txcharisk_i );
unit_pfc: protocol_frame_check port map ( pfc_clk_in => pfc_clk_in_i,
pfc_reset_in => pfc_reset_in_i,
pfc_data_in => pfc_data_in_i,
pfc_data_out => pfc_data_out_i,
pfc_fifo_wren_out => pfc_fifo_wren_out_i );
--_______________EXTERNAL WIRING_______________--
--reset
SOFT_RESET_TX_IN_i <= gt_soft_reset_in;
SOFT_RESET_RX_IN_i <= gt_soft_reset_in;
pfg_reset_in_i <= protocol_reset_in;
pfc_reset_in_i <= protocol_reset_in;
--clocking (refclk has IBUF declaration)
Q0_CLK1_GTREFCLK_PAD_P_IN_i <= GTREFCLK_PAD_P_IN;
Q0_CLK1_GTREFCLK_PAD_N_IN_i <= GTREFCLK_PAD_N_IN;
tx_fifo_clk_out <= GT0_TXUSRCLK2_OUT_i;
rx_fifo_clk_out <= GT0_RXUSRCLK2_OUT_i;
sysclk_in_i <= fsm_clk_in;
--tx
pfg_data_in_i <= tx_data_in;
pfg_fifo_empty_in_i <= tx_fifo_empty_in;
pfg_trasm_rqst_in_i <= tx_trasm_rqst_in;
tx_fifo_rd_enable_out <= pfg_fifo_rd_enable_out_i;
--rx
rx_data_out <= pfc_data_out_i;
rx_fifo_wren_out <= pfc_fifo_wren_out_i;
--serial I/O
gtxtxp_out <= gt0_gtxtxp_out_i;
gtxtxn_out <= gt0_gtxtxn_out_i;
gt0_gtxrxp_in_i <= gtxrxp_in;
gt0_gtxrxn_in_i <= gtxrxn_in;
--_______________INTERNAL WIRING_______________--
--protocol clocking
pfg_clk_in_i <= GT0_TXUSRCLK2_OUT_i;
pfc_clk_in_i <= GT0_RXUSRCLK2_OUT_i;
--datapath
gt0_txdata_in_i <= pfg_data_out_i;
pfc_data_in_i <= gt0_rxdata_out_i;
--gt0 configuration: these signals are all tied to groung for
--proper gt funciotning
gt0_rxdfelpmreset_in_i <= '0';
gt0_gtrxreset_in_i <= '0';
gt0_rxpmareset_in_i <= '0';
gt0_cpllreset_in_i <= '0';
--DRP ports are not used
gt0_drpaddr_in_i <= (others => '0');
gt0_drpdi_in_i <= (others => '0');
gt0_drpen_in_i <= '0';
gt0_drpwe_in_i <= '0';
gt0_eyescanreset_in_i <= '0';
gt0_eyescantrigger_in_i <= '0';
gt0_gttxreset_in_i <= '0';
gt0_rxmonitorsel_in_i <= (others => '0');
gt0_txuserrdy_in_i <= '1';
gt0_rxuserrdy_in_i <= '1';
--gt0 configuration: these signals are all tied to power for
--proper gt funciotning
gt0_txcharisk_in_i <= pfg_txcharisk_i;
gt0_rxmcommaalignen_in_i <= '1';
gt0_rxpcommaalignen_in_i <= '1';
DONT_RESET_ON_DATA_ERROR_IN_i <= '0';
end Mapping;

Error Compiling in quartus

I keep receiving an error while compiling my code below in quartus even though it does in the code below:
Error (12002): Port "qsys_dram_clk" does not exist in macrofunction "u0"
library ieee;
use ieee.std_logic_1164.all;
entity flappyroscoe is
port(
CLOCK_50 : IN STD_LOGIC := 'X';
CLOCK_27 : IN STD_LOGIC_VECTOR(0 downto 0);
AUD_XCK : OUT STD_LOGIC;
I2C_SDAT : INOUT STD_LOGIC := 'X';
I2C_SCLK : OUT STD_LOGIC;
AUD_ADCDAT : IN STD_LOGIC := 'X';
AUD_ADCLRCK : IN STD_LOGIC := 'X';
AUD_BCLK : IN STD_LOGIC := 'X';
DRAM_ADDR : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
DRAM_BA_1 : OUT STD_LOGIC;
DRAM_BA_0 : OUT STD_LOGIC;
DRAM_CAS_N : OUT STD_LOGIC;
DRAM_CKE : OUT STD_LOGIC;
DRAM_CS_N : OUT STD_LOGIC;
DRAM_DQ : INOUT STD_LOGIC_VECTOR(15 DOWNTO 0) := (OTHERS =>
DRAM_UDQM : OUT STD_LOGIC;
DRAM_LDQM : OUT STD_LOGIC;
DRAM_RAS_N : OUT STD_LOGIC;
DRAM_WE_N : OUT STD_LOGIC;
VGA_HS : OUT STD_LOGIC; VGA_VS : OUT STD_LOGIC;
VGA_R : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
VGA_G : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
VGA_B : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
DRAM_CLK : OUT STD_LOGIC
);
end entity;
architecture behavior of flappyroscoe is
component flappy_system is
port (
clk_clk: in std_logic:= 'X';
up_clocks_0_clk_in_secondary_clk: IN STD_LOGIC_VECTOR(0 downto 0);
up_clocks_0_audio_clk_clk: out std_logic;
audio_and_video_config_0_external_interface_SDAT : inout std_logic:= 'X';
audio_and_video_config_0_external_interface_SCLK : out std_logic;
audio_0_external_interface_ADCDAT : in std_logic:= 'X';
audio_0_external_interface_ADCLRCK : in std_logic:= 'X';
audio_0_external_interface_BCLK: in std_logic:= 'X';
qsys_dram_addr : out std_logic_vector(11 downto 0);
qsys_dram_ba : out std_logic_vector(1 downto 0);
qsys_dram_cas_n : out std_logic;
qsys_dram_cke: out std_logic;
qsys_dram_cs_n: out std_logic;
qsys_dram_dq : inout std_logic_vector(15 downto 0) := (others => 'X');
qsys_dram_dqm : out std_logic_vector(1 downto 0);
qsys_dram_ras_n: out std_logic;
qsys_dram_we_n: out std_logic;
qsys_vga_HS: out std_logic;
qsys_vga_VS: out std_logic;
qsys_vga_R: out std_logic_vector(3 downto 0);
qsys_vga_G: out std_logic_vector(3 downto 0);
qsys_vga_B: out std_logic_vector(3 downto 0);
qsys_dram_clk: out std_logic
);
end component flappy_system;
signal dqm_sig,ba_sig: std_logic_vector(1 downto 0);
signal n: std_logic;
begin
DRAM_BA_1 <= ba_sig(1);
DRAM_BA_0 <= ba_sig(0);
DRAM_UDQM <= dqm_sig(1);
DRAM_LDQM <= dqm_sig(0);
u0 : component flappy_system
port map (
clk_clk => CLOCK_50,
up_clocks_0_clk_in_secondary_clk => CLOCK_27,
up_clocks_0_audio_clk_clk => AUD_XCK,
audio_and_video_config_0_external_interface_SDAT => I2C_SDAT,
audio_and_video_config_0_external_interface_SCLK => I2C_SCLK,
audio_0_external_interface_ADCDAT => AUD_ADCDAT,
audio_0_external_interface_ADCLRCK => AUD_ADCLRCK,
audio_0_external_interface_BCLK => AUD_BCLK,
qsys_dram_addr => dram_addr,
qsys_dram_ba => ba_sig,
qsys_dram_cas_n => dram_cas_n,
qsys_dram_cke => dram_cke,
qsys_dram_cs_n => dram_cs_n,
qsys_dram_dq => dram_dq,
qsys_dram_dqm => dqm_sig,
qsys_dram_ras_n => dram_ras_n,
qsys_dram_we_n => dram_we_n,
qsys_vga_HS => vga_HS,
qsys_vga_VS => vga_VS,
qsys_vga_R => vga_R,
qsys_vga_G => vga_G,
qsys_vga_B => vga_B,
qsys_dram_clk => DRAM_CLK
);
end architecture;

VHDL Factorial calculator

I am attempting to create a 16-bit factorial calculator for an unsigned binary number. In doing so I have created a data path and a state machine that
a.) outputs a final value of 1 if the value input is 0
b.) displays and overflow flag if the input is over 8!
c.) Calculates the value for the factorial if the value input is less then 8 and not zero.
The system seems to fall apart if the value I input is anything over 3 yet still not an overflow. I think the issue is somewhere in Test3, Update 1, update 2 in my state machine. Could anyone help explain what is going wrong?
State Machine:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity fact_16_ctrlv2 is
port(
go : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
overflow : in STD_LOGIC;
numeqcnt : in STD_LOGIC;
factzero : in STD_LOGIC;
flag: out STD_logic;
xload : out STD_LOGIC;
cntmux : out STD_LOGIC;
cntload : out STD_LOGIC;
factload : out STD_LOGIC;
factmux : out STD_LOGIC;
finalload : out STD_LOGIC;
finalmuxselect: out STD_logic;
decimalpoint: out std_logic
);
end fact_16_ctrlv2;
--}} End of automatically maintained section
architecture fact_16_ctrlv2 of fact_16_ctrlv2 is
type state_type is (start, input, test1, test2, test3, update1, update2, update3, done);
signal present_state, next_state: state_type;
begin
sreg: process(clk, clr)
begin
if clr='1' then
present_state <= start;
elsif clk'event and clk='1' then
present_state <= next_state;
end if;
end process;
c1: process(present_state, go, overflow, factzero, numeqcnt)
begin
case present_state is
when start =>
if go = '1' then
next_state <= input;
else
next_state <= start;
end if;
when input =>
next_state <= test1;
when test1 =>
if factzero= '1' then
next_state <= done;
else
next_state <= test2;
end if;
when test2 =>
if overflow = '1' then
next_state <= done;
else
next_state <= update3;
end if;
when update3 =>
next_state <= test3;
when test3 =>
if numeqcnt = '1' then
next_state <= done;
else
next_state <= update1;
end if;
when update1 =>
next_state <= update2;
when update2 =>
next_state <= test3;
when done =>
next_state <= done;
when others =>
null;
end case;
end process;
C2: process(present_state, overflow, numeqcnt, factzero)
begin
xload<= '0';
flag <= '0';
cntmux <= '0';
cntload<= '0';
factload<='0';
factmux<='0';
finalload <='0';
finalmuxselect<='0';
decimalpoint<='0';
case present_state is
when input =>
xload<='1';
--cntmux<='1';
--cntload<='1';
when test2 =>
if overflow ='1' then
flag <= '1';
finalmuxselect<='0';
finalload<='1';
factload <='1';
decimalpoint <='1';
end if;
when test1 =>
if factzero ='1' then
flag <= '1';
finalmuxselect <='1';
finalload <='1';
end if;
when update3 =>
cntmux<='1';
cntload<='1';
factmux<= '1';
factload<= '1';
when test3 =>
if numeqcnt ='1' then
finalmuxselect<='0';
--finalload<='1';
factload <='1';
cntload<='1';
factmux<='0';
else
end if;
when update1 =>
factmux<='0';
factload<='1';
when update2 =>
cntmux<='0';
cntload<='1';
--factload<='1';
when done =>
finalload<='1';
when others =>
null;
end case;
end process;
end fact_16_ctrlv2;
Data Path
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity fact_16_dp is
port(
clr : in STD_LOGIC;
clk : in STD_LOGIC;
X : in STD_LOGIC_VECTOR(3 downto 0);
overflow : out STD_LOGIC;
finalfact : out STD_LOGIC_VECTOR(15 downto 0);
cntload, cntmult, factload, factmult, xload, finalload :in Std_logic;
equalone, numcnt : out Std_logic;
finalmuxselect, flagin: in STD_logic
);
end fact_16_dp;
--}} End of automatically maintained section
architecture fact_16_dp of fact_16_dp is
-- Component declaration of the "mult16b(mult16b)" unit defined in
-- file: "./../src/multiplier.vhd"
component mult16b
port(
a : in STD_LOGIC_VECTOR(15 downto 0);
b : in STD_LOGIC_VECTOR(15 downto 0);
p : out STD_LOGIC_VECTOR(15 downto 0));
end component;
for all: mult16b use entity work.mult16b(mult16b);
-- Component declaration of the "comp(comp)" unit defined in
-- file: "./../src/comparitor.vhd"
component comp
generic(
N : INTEGER := 8);
port(
x : in STD_LOGIC_VECTOR(N-1 downto 0);
y : in STD_LOGIC_VECTOR(N-1 downto 0);
gt : out STD_LOGIC;
eq : out STD_LOGIC;
lt : out STD_LOGIC);
end component;
for all: comp use entity work.comp(comp);
-- Component declaration of the "adder(adder)" unit defined in
-- file: "./../src/adder.vhd"
component adder
generic(
N : INTEGER := 8);
port(
a : in STD_LOGIC_VECTOR(N-1 downto 0);
b : in STD_LOGIC_VECTOR(N-1 downto 0);
y : out STD_LOGIC_VECTOR(N-1 downto 0));
end component;
for all: adder use entity work.adder(adder);
-- Component declaration of the "reg(reg)" unit defined in
-- file: "./../src/reg.vhd"
component reg
generic(
N : INTEGER := 8);
port(
load : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
d : in STD_LOGIC_VECTOR(N-1 downto 0);
q : out STD_LOGIC_VECTOR(N-1 downto 0));
end component;
for all: reg use entity work.reg(reg);
-- Component declaration of the "mux2g(mux2g)" unit defined in
-- file: "./../src/mux21.vhd"
component mux2g
generic(
N : INTEGER);
port(
a : in STD_LOGIC_VECTOR(N-1 downto 0);
b : in STD_LOGIC_VECTOR(N-1 downto 0);
s : in STD_LOGIC;
y : out STD_LOGIC_VECTOR(N-1 downto 0));
end component;
for all: mux2g use entity work.mux2g(mux2g);
-- Component declaration of the "mux4g(mux4g)" unit defined in
-- file: "./../src/mux4to1.vhd"
component mux4g
generic(
N : INTEGER);
port(
a : in STD_LOGIC_VECTOR(N-1 downto 0);
b : in STD_LOGIC_VECTOR(N-1 downto 0);
c : in STD_LOGIC_VECTOR(N-1 downto 0);
s : in STD_LOGIC_VECTOR(1 downto 0);
y : out STD_LOGIC_VECTOR(N-1 downto 0));
end component;
for all: mux4g use entity work.mux4g(mux4g);
--signal cntload, cntmult, numcnt, factload, factmult, xload, numload, equalone, finalload :Std_logic;
signal adderout, cntregout, cntregin, x2 :Std_logic_vector(3 downto 0);
signal xin, factregin, factregout, overin, factmout, checkzero, numregout, flag, finalmuxout, cntregoutb :Std_logic_vector(15 downto 0);
begin
x2 <= x;
xin <= "000000000000" & x2; --Change 4 bit number input into a 16 bit number
cntregoutb <= "000000000000" & cntregout; --change count from 4 bit value to a 16 bit value
flag <= "000000000000000" & flagin;
cntreg : reg --4-bit counter register
generic map(
N => 4
)
port map(
load => cntload,
clk => clk,
clr => clr,
d => cntregin, --not in drawing
q => cntregout
);
factreg : reg --16-bit fact register
generic map(
N => 16
)
port map(
load => factload,
clk => clk,
clr => clr,
d => factregin,
q => factregout
);
--numreg : reg --16-bit num register
--generic map(
--N => 16
--)
--port map(
--load => numload,
--clk => clk,
--clr => clr,
--d => xin,
--q => numregout
--);
xreg : reg --4-bit initial x vlaue register
generic map(
N => 4
)
port map(
load => xload,
clk => clk,
clr => clr,
d => x, --x(3:0)
q => x2
);
finalreg : reg --16-bit final fact register
generic map(
N => 16
)
port map(
load => finalload,
clk => clk,
clr => clr,
d => finalmuxout,
q => finalfact
);
cntmux : mux2g --4-bit cnt mux
generic map(
N => 4
)
port map(
b => "0001", --initial value set
a => adderout, --value after initial run through
s => cntmult,
y => cntregin --cntregin not in drawing
);
factmux : mux2g --16-bit fact mux
generic map(
N => 16
)
port map(
b => "0000000000000001", --initial value set
a => factmout, --value after initial run through
s => factmult,
y => factregin
);
add1 : adder --Increment counter 4-bit
generic map(
N => 4
)
port map(
a => cntregout, --add 1
b => "0001", --1
y => adderout --out of the adder
);
multiplier : mult16b --multiply cnt and fact 16-bit
port map(
a => factregout,
b => cntregoutb, --cnt plus 12 zeros to 16-bit
p => factmout --Multiplier out
);
greater8 : comp --16-bit check x overflow if greater then 8
generic map(
N => 16
)
port map(
x => xin, --check value to 8
y => "0000000000001000",
gt => overflow --send overflow flag
--eq => eq,
--lt => lt
);
check0 : comp --16-bit check x not equal to zero
generic map(
N => 16
)
port map(
x => xin,
y => "0000000000000000",
--gt => gt,
eq => equalone
--lt => lt
);
numeqcnt : comp --16-bit check if num equals cnt
generic map(
N => 16
)
port map(
x => xin,
y => cntregoutb, --need 16 bit
--gt => gt,
eq => numcnt --not in drawing
--lt => lt
);
finalmux: mux2g
generic map(
N => 16
)
port map(
a => factregout,
b => flag,
s => finalmuxselect,
y => finalmuxout
);
end fact_16_dp;
Connected together
-------------------------------------------------------------------------------
--
-- Title : fact_16
-- Design : lab4
-- Author :
-- Company :
--
-------------------------------------------------------------------------------
--
-- File : c:\My_Designs\lab4\lab4\src\fact_16.vhd
-- Generated : Tue Oct 14 16:40:38 2014
-- From : interface description file
-- By : Itf2Vhdl ver. 1.22
--
-------------------------------------------------------------------------------
--
-- Description :
--
-------------------------------------------------------------------------------
--{{ Section below this comment is automatically maintained
-- and may be overwritten
--{entity {fact_16} architecture {fact_16}}
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity fact_16 is
port(
go : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
x : in STD_LOGIC_VECTOR(3 downto 0);
overflowB : out STD_LOGIC;
factout : out STD_LOGIC_VECTOR(15 downto 0)
);
end fact_16;
architecture fact_16 of fact_16 is
-- Component declaration of the "fact_16_dp(fact_16_dp)" unit defined in
-- file: "./../src/fact_16_dp.vhd"
component fact_16_dp
port(
clr : in STD_LOGIC;
clk : in STD_LOGIC;
X : in STD_LOGIC_VECTOR(3 downto 0);
overflow : out STD_LOGIC;
finalfact : out STD_LOGIC_VECTOR(15 downto 0);
cntload : in STD_LOGIC;
cntmult : in STD_LOGIC;
factload : in STD_LOGIC;
factmult : in STD_LOGIC;
xload : in STD_LOGIC;
finalload : in STD_LOGIC;
equalone : out STD_LOGIC;
numcnt : out STD_LOGIC;
finalmuxselect : in STD_LOGIC;
flagin : in STD_LOGIC);
end component;
for all: fact_16_dp use entity work.fact_16_dp(fact_16_dp);
-- Component declaration of the "fact_16_ctrlv2(fact_16_ctrlv2)" unit defined in
-- file: "./../src/fact_16_ctrlv2.vhd"
component fact_16_ctrlv2
port(
go : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
overflow : in STD_LOGIC;
numeqcnt : in STD_LOGIC;
factzero : in STD_LOGIC;
flag : out STD_LOGIC;
xload : out STD_LOGIC;
cntmux : out STD_LOGIC;
cntload : out STD_LOGIC;
factload : out STD_LOGIC;
factmux : out STD_LOGIC;
finalload : out STD_LOGIC;
finalmuxselect : out STD_LOGIC;
decimalpoint : out STD_LOGIC);
end component;
for all: fact_16_ctrlv2 use entity work.fact_16_ctrlv2(fact_16_ctrlv2);
signal overflow, numeqcnt, factzero, xload, cntmux, cntload, factload, flag, factmux, numload, finalload: STD_logic;
signal finalmuxselect: std_logic;
begin
Dpath : fact_16_dp
port map(
clr => clr,
clk => clk,
X => X,
overflow => overflow,
finalfact => factout,
cntload => cntload,
cntmult => cntmux,
factload => factload,
factmult => factmux,
xload => xload,
finalload => finalload,
equalone => factzero,
numcnt => numeqcnt,
finalmuxselect => finalmuxselect,
flagin => flag
);
Cunit : fact_16_ctrlv2
port map(
go => go,
clk => clk,
clr => clr,
overflow => overflow,
numeqcnt => numeqcnt,
factzero => factzero,
flag => flag,
xload => xload,
cntmux => cntmux,
cntload => cntload,
factload => factload,
factmux => factmux,
finalload => finalload,
finalmuxselect => finalmuxselect,
decimalpoint => overflowB
);
end fact_16;

vhdl code wrapper

I'm trying to implement a VHDL project but I'm having problems connecting the different components correctly. I just want to make sure that I did this correctly. The code below is just the wrapper (which, to this point, is where the problem lies). Please let me know if I'm connecting the input and outputs to each component correctly.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity SodaWrapper is
Port ( PB1 : in STD_LOGIC;
PB2 : in STD_LOGIC;
PB3 : in STD_LOGIC;
PB4 : in STD_LOGIC;
clk_50m : in STD_LOGIC;
LED1 : out STD_LOGIC;
LED2 : out STD_LOGIC;
LED3 : out STD_LOGIC;
LED4 : out STD_LOGIC;
seven_seg1 : out STD_LOGIC_VECTOR(7 downto 0);
seven_seg2 : out STD_LOGIC_VECTOR(7 downto 0));
end SodaWrapper;
architecture Behavioral of SodaWrapper is
--Define debounce components
component debounce
port (clk : in STD_LOGIC;
reset : in STD_LOGIC;
sw : in STD_LOGIC;
db_level: out STD_LOGIC;
db_tick: out STD_LOGIC);
end component;
for all : debounce use entity work.debounce(debounce);
--define clock
component Clock_Divider
port(
clk : in STD_LOGIC;
clockbus : out STD_LOGIC_VECTOR(26 downto 0)
);
end component;
for all : Clock_Divider use entity work.Clock_Divider(Clock_Divider);
COMPONENT SodaMachine_Moore
PORT(
CLK : IN std_logic;
Reset : IN std_logic;
Nickel : IN std_logic;
Dime : IN std_logic;
Quarter : IN std_logic;
Dispense : OUT std_logic;
ReturnNickel : OUT std_logic;
ReturnDime : OUT std_logic;
ReturnTwoDimes : OUT std_logic;
change1 : OUT std_logic_vector(3 downto 0);
change2 : OUT std_logic_vector(3 downto 0)
);
END COMPONENT;
--Define sseg_converter components
component hex_to_sseg
port( dp : in STD_LOGIC;
hex : in STD_LOGIC_VECTOR(3 downto 0);
sseg : out STD_LOGIC_VECTOR(7 downto 0));
end component;
--create wire for FSM to sseg converter
signal hexconvertones : STD_LOGIC_VECTOR(3 downto 0);
signal hexconverttens : STD_LOGIC_VECTOR(3 downto 0);
--create wires for output of debouncers
signal db_tick_n : STD_LOGIC;
signal db_tick_d : STD_LOGIC;
signal db_tick_q : STD_LOGIC;
signal IQ_n : STD_LOGIC;
signal IQ_d : STD_LOGIC;
signal IQ_q : STD_LOGIC;
--wire up clock
signal clockingbus : STD_LOGIC_VECTOR(26 downto 0);
begin
-- Setup the clock
clock1 : Clock_divider port map (
clk => clk_50m,
clockbus => clockingbus
);
-- Link debounce to FSM
debounce_n : debounce port map (
clk => clockingbus(0),
reset => PB4,
sw => PB1,
db_tick => db_tick_n
);
debounce_d : debounce port map (
clk => clockingbus(0),
reset => PB4,
sw => PB2,
db_tick => db_tick_d
);
debounce_q : debounce port map (
clk => clockingbus(0),
reset => PB4,
sw => PB3,
db_tick => db_tick_q
);
--invert values of db_tick since logic value of button pressed is 0 and vice versa
IQ_n <= not(db_tick_n);
IQ_d <= not(db_tick_d);
IQ_q <= not(db_tick_q);
-- Link components to main FSM
main : SodaMachine_Moore PORT MAP (
CLK => clockingbus(0),
Reset => PB4,
Nickel => IQ_n,
Dime => IQ_d,
Quarter => IQ_q,
Dispense => LED1,
ReturnNickel => LED2,
ReturnDime => LED3,
ReturnTwoDimes => LED4,
change1 => hexconvertones,
change2 => hexconverttens
);
--Link seven segment display to FSM
change_ones : hex_to_sseg port map('0', hexconvertones, seven_seg1);
change_tens : hex_to_sseg port map('0', hexconverttens, seven_seg2);
end Behavioral;

Resources