VHDL using an output from an instantiated entity in my toplevel entity - vhdl

I've a VHDL code with a top entity and several other entities. Now there is an output in one of the subentities of which the value has to be brought to the toplevel entity to show it in my simulation program.
How can i do that?
TOP entity:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity multiplier is
port( Clk : in std_logic; -- Clock
A,B : in std_logic_vector(7 downto 0); -- A and B
Start : in std_logic; -- Start
Y : buffer std_logic_vector(15 downto 0); -- Result of A * B
Ready : out std_logic); -- Ready
end multiplier;
architecture structural of multiplier is
-- declaration of signals between different sub-circuits inside the multiplier
signal smInit, smCheck, smAdd, smShift, smZero, smReady, Stop : std_logic;
signal SR_A, SR_B, ADDout, MUXout : std_logic_vector(15 downto 0);
begin
io01: Ready <= smReady;
-- Instantiation of the FSM controller
sm01: entity work.FSM port map( Start, Stop, SR_A(0), Clk,
smReady, smInit, smCheck, smAdd, smShift, smZero);
-- Instantiation of the other sub-circuits and their connections
SR1: entity work.Shifter port map(smInit, smShift, '0', Clk, A, SR_A);
SR2: entity work.Shifter port map(smInit, smShift, '1', Clk, B, SR_B);
A1: entity work.Add16 port map(SR_B, Y, ADDout);
M1: entity work.Mux16 port map(smAdd, ADDout, Y, MUXout);
G1: entity work.Reg16 port map(smInit, Clk, MUXout, Y);
Z1: entity work.AllZero port map(SR_A(7 downto 0), Stop);
end structural; -- end of the multiplier architecture`
Now in the following subentity there is output S which i need to be able to call in the toplevel entity:
library IEEE;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity Add16 is
port( A, B : in std_logic_vector(15 downto 0);
S : buffer std_logic_vector(15 downto 0));
end Add16;
architecture behavior of Add16 is
signal Addout : out std_logic_vector (15 downto 0);
begin
S <= A + B;
end behavior;
How do i do that?

VHDL-2008 has a "external names" concept, whereby a hierarchical reference is possible, so you don't need to manually route internal signals through the hierarchy if the test bench needs access to the value.
If the top-level test bench name is tb and the multiplier instance name is multiplier_e then an alias for the S port on Add16 can be created in the test bench using:
alias S_tb is <<signal .tb.multiplier_e.A1.S : std_logic_vector(15 downto 0)>>;

Related

VHDL Selection machine error in port map

I get this error:
# Error: COMP96_0100: data_reg.vhd : (156, 35): Actual parameter type in port map does not match the port formal type "Allin".
# Error: COMP96_0100: data_reg.vhd : (158, 1): Actual parameter type in port map does not match the port formal type "Fout".
# Error: COMP96_0100: data_reg.vhd : (162, 1): Actual parameter type in port map does not match the port formal type "D".
# Error: COMP96_0100: data_reg.vhd : (163, 1): Actual parameter type in port map does not match the port formal type "Q".
I need some help, please.
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity ticket1 is
port (
A, B : in std_logic_vector(7 downto 0);
Clock: in std_logic;
O: out std_logic_vector(7 downto 0));
end entity;
architecture Ticketmachine of ticket1 is
component ticket_selection
port(
Allin:in bit_vector(3 downto 0);
Clk: in std_logic;
Fout: out bit_vector(7 downto 0));
end component ticket_selection;
component reg is
port(
C: in std_logic;
D: in bit_vector(7 downto 0);
Q : out bit_vector(7 downto 0));
end component reg;
component Money is
port (
Ai,Bi : in std_logic_vector(7 downto 0);
Fo: out std_logic_vector(7 downto 0));
end component money;
signal s1,s2: std_logic_vector(7 downto 0);
begin
Option: ticket_selection
port map(
Allin=>A,
Clk=>Clock,
Fout=>s1);
Cash: reg
port map(
C=>Clock,
D=>B,
Q=>s2);
Pros: Money
port map(
Ai=>s1,
Bi=>s2,
Fo=>O);
end architecture;
You should read carefully some VHDL guide for beginners. I can't recommend any (maybe someone could?), so I'll go straight to your mistakes here:
Never use std_logic_unsigned, std_logic_unsigned, and std_logic_arith. This libraries are not part of standard, and can be replaced with numeric_std.
Don't use bit or bit_vector type. Use std_logic, and std_logic_vector instead.
When you associate one vector to other, they must have equal type and length, as user1155120 and Brian Drummond wrote in comment. In particular, you can't assign std_logic_vector(7 downto 0) to bit_vector(3 downto 0).
There are probably more things done wrong here, but your question is not complete - you didn't provide any explanation what it should do, no full code, and no testbench.

Positional association cannot follow named association

I have implemnted Carry Select Adder using D-lATCh. But I am Getting the following error.
HDLCompiler:720 - "/home/aabhinav/Downloads/Example/CSA_4bits/CSA_BEC1.vhd" Line 76: Positional association cannot follow named association
ERROR:HDLCompiler:854 - "/home/aabhinav/Downloads/Example/CSA_4bits/CSA_BEC1.vhd" Line 41: Unit ignored due to previous errors.
Below is my attached code. If anyone could help me as I am new to VHDL and doing my school project.
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 17:08:00 11/16/2016
-- Design Name:
-- Module Name: CSA_BEC1 - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
USE ieee.std_logic_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.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 primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity CSA_BEC1 is
port( A,B : in std_logic_vector(3 downto 0);
cin : in std_logic;
Scsa : out std_logic_vector(4 downto 0));
end CSA_BEC1;
architecture Behavioral of CSA_BEC1 is
COMPONENT d_latch_top is
port( A : in std_logic_vector(4 downto 0);
EN : IN STD_LOGIC;
B : out std_logic_vector(4 downto 0));
end COMPONENT;
COMPONENT MUX10_5 is
PORT(X, Y: in std_logic_vector(4 downto 0);
sel: in std_logic;
m: out std_logic_vector(4 downto 0));
end COMPONENT;
component rc_adder
Port ( X : in STD_LOGIC_VECTOR (3 downto 0);
Y : in STD_LOGIC_VECTOR (3 downto 0);
-- Cin: in STD_LOGIC ;
sum : out STD_LOGIC_VECTOR (3 downto 0);
Carry : out STD_LOGIC);
end component;
signal RCSum: STD_LOGIC_VECTOR( 3 DOWNTO 0);
signal BECSum, M: STD_LOGIC_VECTOR( 4 DOWNTO 0);
signal RCCarry,BECCarry: STD_LOGIC;
signal RC_S_C: STD_LOGIC_VECTOR( 4 DOWNTO 0);
begin
RC: rc_adder PORT MAP(X => A, Y => B, SUM => RCSum, Carry => RCCarry);
RC_S_C <= RCCarry&RCSum;
dlatch: d_latch_top PORT MAP(A => RC_S_C,B => BECSum, EN = '1');
MUX: MUX10_5 PORT MAP(X => BECSum, y => RC_S_C , sel => cin, m => Scsa);
end Behavioral;
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 17:19:36 11/16/2016
-- Design Name:
-- Module Name: rc_adder - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
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 primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity rc_adder is
port( X : in std_logic_vector(3 downto 0); --4 bit input 1
Y : in std_logic_vector(3 downto 0); -- 4 bit input 2
-- Cin : in STD_LOGIC;
sum : out std_logic_vector(3 downto 0); -- 4 bit sum
carry : out std_logic -- carry out.
);
end rc_adder;
architecture logic of rc_adder is
COMPONENT full_adder is
port (a : in std_logic;
b : in std_logic;
cin : in std_logic;
sum : out std_logic;
carry : out std_logic
);
end COMPONENT;
signal C0: STD_LOGIC_VECTOR( 2 DOWNTO 0);
begin
FA1: full_adder PORT MAP(X(0),Y(0),'0',sum(0),C0(0));
FA2: full_adder PORT MAP(X(1),Y(1),C0(0),sum(1),C0(1));
FA3: full_adder PORT MAP(X(2),Y(2),C0(1),sum(2),C0(2));
FA4: full_adder PORT MAP(X(3),Y(3),C0(2),sum(3),Carry);
end logic;
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity d_latch_top is
Port ( A : in std_logic_vector(4 downto 0);
EN : in STD_LOGIC;
B : out std_logic_vector(4 downto 0));
end d_latch_top;
architecture Behavioral of d_latch_top is
signal DATA : std_logic_vector(4 downto 0);
begin
DATA <= A when (EN = '1') else DATA;
B <= DATA;
end Behavioral;
 
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 17:54:06 11/12/2016
-- Design Name:
-- Module Name: MUX10_5 - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
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 primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity MUX10_5 is
PORT( X, Y: in std_logic_vector(4 downto 0);
sel: in std_logic;
m: out std_logic_vector(4 downto 0));
end MUX10_5;
architecture logic of MUX10_5 is
component MUX6_3 is
PORT( sel: in std_logic;
X, Y: in std_logic_vector(2 downto 0);
m: out std_logic_vector(2 downto 0));
end component;
component MUX4_2 is
PORT( sel, X0, X1, Y0, Y1: in std_logic;
m0, m1: out std_logic);
end component;
begin
mux6_3_inst0 : MUX6_3
PORT MAP( sel => sel, X => X(2 downto 0), Y => Y(2 downto 0),
m => m(2 downto 0));
mux4_2_inst0 : MUX4_2
PORT MAP( sel => sel, X0 => X(3), X1 => X(4), Y0 => Y(3), Y1 => Y(4),
m0 => m(3), m1 => m(4));
end logic;
See IEEE Std 1076-2008 6.5.7 Association lists, 6.5.7.1 General, para 5:
Named associations can be given in any order, but if both positional and named associations appear in the same association list, then all positional associations shall occur first at their normal position. Hence once a named association is used, the rest of the association list shall use only named associations.
In the architecture for CSA_BEC1, the component instantiation labeled dlatch, pretty much where the first error message said. The named association malformed: EN = '1' should be EN => '1'.
A VHDL parser can be implemented LALR(1), meaning it doesn't need to look ahead beyond the next token. You might imagine someone was using the compound delimiter "=>" to determine whether or not an association item is named or positional. It seems it's not smart enough to give a separate error message when the following delimiter ("="), wasn't a ',' or a ')' for the last item in an association list.
Such 'luxuries' usually show up with tool implementation maturity. Fee free to allow the vendor to know the error message is not particularly enlightening.

Structural Architucture Simulation in ACtive-HDL

I have written two codes that successfully simulated in ISE Design Suit:
-- 2X1 Multiplexer
library IEEE;
use IEEE.STD_LOGIC_1164.all;
package mux2to1_pkg is
component mux2to1
port(d1,d0: in std_logic;
s: in std_logic;
f: out std_logic);
end component;
end mux2to1_pkg;
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity mux2to1 is
port(d1,d0: in std_logic;
s: in std_logic;
f: out std_logic);
end mux2to1;
architecture behavioral of mux2to1 is
begin
f <= (d0 and not s) or
(d1 and s);
end behavioral;
and
-- 6X1 Multiplexer
library IEEE;
use IEEE.STD_LOGIC_1164.all;
package mux6to1_pkg is
component mux6to1
port(d: in std_logic_vector(5 downto 0);
s: in std_logic_vector(2 downto 0);
f: out std_logic);
end component;
end mux6to1_pkg;
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use WORK.mux2to1_pkg.all;
entity mux6to1 is
port(d: in std_logic_vector(5 downto 0);
s: in std_logic_vector(2 downto 0);
f: out std_logic);
end mux6to1;
architecture structural of mux6to1 is
signal m1,m2,m3,m4: std_logic;
begin
mux1: mux2to1 port map(d(5),d(4),s(0),m1);
mux2: mux2to1 port map(d(3),d(2),s(0),m2);
mux3: mux2to1 port map(d(1),d(0),s(0),m3);
mux4: mux2to1 port map(m2,m3,s(1),m4);
mux5: mux2to1 port map(m1,m4,s(2),f);
end structural;
The problem is when I want to simulate the MUX6to1 in Active-HDL the output doesn't change at all. What's the secret in this program? Ty.
Using this test bench:
library ieee;
use ieee.std_logic_1164.all;
entity mdl_tb is
end entity;
library ieee;
use ieee.numeric_std.all;
architecture sim of mdl_tb is
signal s_d : std_logic_vector(8 downto 0) := (others => '0');
signal f : std_logic;
begin
dut_e : entity work.mux6to1
port map(d => s_d(5 downto 0),
s => s_d(8 downto 6),
f => f);
process is
begin
wait for 1 ns;
s_d <= std_logic_vector(unsigned(s_d) + 1);
end process;
end architecture;
it shows changes like:
based on this Active-HDL script with the above two files in mdl.vhd:
# Workspace "prod" create under current and open this workspace
workspace create prod
# Design "prod" create under current workspace
design create -a prod .
# Create to directory under workspace
cd $DSN/..
# Compile
acom ../mdl.vhd
acom ../mdl_tb.vhd
# Load module for simulation
asim work.mdl_tb
# Waveform add
add wave /mdl_tb/*
# Run
run 600 ns
Btw. you can reduce the code significantly if you skip the component declarations and related packages, through code like:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity mux2to1 is
port(d1,d0: in std_logic;
s: in std_logic;
f: out std_logic);
end mux2to1;
architecture behavioral of mux2to1 is
begin
f <= d0 when (s = '0') else d1;
end behavioral;
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity mux6to1 is
port(d: in std_logic_vector(5 downto 0);
s: in std_logic_vector(2 downto 0);
f: out std_logic);
end mux6to1;
architecture structural of mux6to1 is
signal m1,m2,m3,m4: std_logic;
begin
mux1: entity work.mux2to1 port map(d(5),d(4),s(0),m1);
mux2: entity work.mux2to1 port map(d(3),d(2),s(0),m2);
mux3: entity work.mux2to1 port map(d(1),d(0),s(0),m3);
mux4: entity work.mux2to1 port map(m2,m3,s(1),m4);
mux5: entity work.mux2to1 port map(m1,m4,s(2),f);
end structural;

using sin and cos through the lookup table in VHDL

i'm using the sin/cos lookup table in VHDL known as sincos_lut.vhd and i'm getting an error when used with my code. I'm implementing my datapath and i need to perform sin and cos on an integer value. I do not know where my problem is but here is the code and error:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.STD_LOGIC_ARITH.all;
use IEEE.STD_LOGIC_UNSIGNED.all;
use IEEE.MATH_REAL.all;
entity DFT is
port(
clk_en, clk, reset, Clock: std_logic;
t_sel,K_sel,sr_sel,si_sel,ld_t,ld_K,ld_sumreal,ld_sumimag,ld_angle: in std_logic;
N: in integer;
e: in std_logic_vector(3 downto 0);
outreal, outimag: out integer;
sig1, sig2: out std_logic
);
end DFT;
architecture str of DFT is
component Adder
Port( a, b: in integer;
f: out integer
);
end component;
component Reg
Port(
Clk: in std_logic;
ld: in std_logic;
a: in integer;
f: out integer
);
end component;
component Mul
Port(
a, b: in integer;
f: out integer
);
end component;
component LT
Port(
a, b: in integer;
sig: out std_logic
);
end component;
component Div
Port(
a, b: in integer;
f: out integer
);
end component;
component Mux
Port(
sel: in std_logic;
a, b: in integer;
f: out integer
);
end component;
component Mem
port( Clock: in std_logic;
Read: in std_logic;
Write: in std_logic;
Address: in integer;
Data_in: in integer;
Data_out: out integer
);
end component;
component sincos_lut Port
(
reset : in std_logic;
clk : in std_logic;
clk_en : in std_logic;
theta : in integer;
sin_data : out signed(integer);
cos_data : out signed(integer)
);
end component;
signal s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s30,s31,s32,s33 : integer;
constant MATH_PI : real := 3.14159_26535_89793_23846;
begin
G1: Mux port map(K_sel,0,s1,s2);
G2: Mux port map(t_sel,0,s3,s4);
G3: Reg port map(Clk,ld_K,s2,s5);
G4: Reg port map(Clk,ld_t,s4,s6);
G5: LT port map(s5,N,sig1);
G6: LT port map(s6,N,sig2);
G7: Adder port map(s5,1,s1);
G8: Adder port map(s6,1,s3);
G9: Div port map(s5,N,s7);
G10: Mul port map(s7,s6,s8);
G11: Mul port map(s8,integer(MATH_PI),s9);
G12: Mul port map(s9,2,s10);
G13: Reg port map(Clk, ld_angle,s10,s11);
G14: Mem port map(Clock,'1','0',s6,0,s12);
G15: Mem port map(Clock,'1','0',s6,0,s13);
G16: Mul port map(s12,s33,s14);
G17: Mul port map(s13,s30,s15);
G18: Adder port map(s14,s15,s16);
G19: Mux port map(sr_sel,0,s17,s18);
G20: Reg port map(Clk, ld_sumreal,s18,s19);
G21: Adder port map(s16,s19,s17);
G22: Mul port map(s12, -1,s20);
G31: sincos_lut port map(reset, clk, clk_en, s11, s30, s31);
G32: sincos_lut port map(reset, clk, clk_en, s11, s32, s33);
G23: Mul port map(s20, s30, s21);
G24: Mul port map(s13, s33, s22);
G25: Adder port map(s21, s22,s23);
G26: Mux port map(si_sel,0,s24,s25);
G27: Reg port map(Clk, ld_sumimag,s25,s26);
G28: Adder port map(s23,s26,s24);
G29: Mem port map(Clock, '0','1',s5,outimag);
G30: Mem port map(Clk, '0','1',s5,outreal);
sincos_lut
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity sincos_lut is
port
(
reset : in std_logic;
clk : in std_logic;
clk_en : in std_logic;
theta : in integer;
sin_data : out signed(integer);
cos_data : out signed(integer)
);
end sincos_lut;
architecture rtl of sincos_lut is
signal theta_int : integer range 0 to 4095 := 0;
signal sin_data_int : signed(integer);
signal cos_data_int : signed(integer);
begin
theta_int <= theta;
process(reset,clk)
begin
if(reset = '1')then
sin_data_int <= to_signed(0,12);
cos_data_int <= to_signed(0,12);
elsif(rising_edge(clk)) then
if clk_en = '1' then
sin_data <= sin_data_int;
cos_data <= cos_data_int;
case theta_int is
end str;
Errors:
Error (10476): VHDL error at DFT.vhd(119): type of identifier "s30" does not agree with its usage as "SIGNED" type
Error (10558): VHDL error at DFT.vhd(119): cannot associate formal port "sin_data" of mode "out" with an expression
Error (10476): VHDL error at DFT.vhd(119): type of identifier "s31" does not agree with its usage as "SIGNED" type
Error (10558): VHDL error at DFT.vhd(119): cannot associate formal port "cos_data" of mode "out" with an expression
Line 119 is:
G31: sincos_lut port map(reset, clk, clk_en, s11, s30, s31);
Your errors are because s30 and s31 are integers and you are connecting them to a signed ports.
Kevin.
type of identifier "s30" does not agree with its usage as "SIGNED" type
This error is caused by mixing different types. The type of s30 is integer, but you are trying to map it to a port of type signed.
cannot associate formal port "sin_data" of mode "out" with an expression
This error is normally caused by "reading" an output port in your logic, but I don't see a clear reason for this error. Possibly this is related to your ports of type : signed(integer). Signed() is used for type conversion.
Your code isn't a Minimal, Complete, and Verifiable example. Note your sincos_lut doesn't analyze either.
signal s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s30,s31,s32,s33 : integer;
constant MATH_PI : real := 3.14159_26535_89793_23846;
signal signed_s30: signed (11 downto 0);
signal signed_s31: signed (11 downto 0);
signal signed_s32: signed (11 downto 0);
signal signed_s33: signed (11 downto 0);
begin
s30 <= to_integer(signed_s30);
s31 <= to_integer(signed_s31);
s32 <= to_integer(signed_s32);
s33 <= to_integer(signed_s33);
You can create signed versions of s30, s31, s32 and s33 and convert
and assign them to s30, s31, s32, s33.
Also note there were associated errors in the sincos_lut, both in port declarations and signal declarations. A type name doesn't represent a range constraint. These have been fixed by:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity sincos_lut is
port
(
reset : in std_logic;
clk : in std_logic;
clk_en : in std_logic;
theta : in integer;
sin_data : out signed(11 downto 0); -- integer);
cos_data : out signed(11 downto 0) -- integer)
);
end sincos_lut;
architecture rtl of sincos_lut is
signal theta_int : integer range 0 to 4095 := 0;
signal sin_data_int : signed(11 downto 0); -- integer);
signal cos_data_int : signed(11 downto 0); -- integer);
The range of the signed values (actually the length) is determined by the to_signed function calls in the process.
Note use package numeric_std function to_integer, and in dft:
library ieee;
use ieee.std_logic_1164.all;
-- use ieee.std_logic_arith.all;
-- use ieee.std_logic_unsigned.all;
-- use ieee.math_real.all;
use ieee.numeric_std.all; -- never, never mix std_logic_arith/numeric_std
-- (see sincos_lut)
Type declarations in two different packages are unique regardless of whether they have the same name and base type or not. They are not compatible. If your tool let's you it is not compliant to the VHDL standard.
G31: sincos_lut port map(reset, clk, clk_en, s11, signed_s30, signed_s31);
G32: sincos_lut port map(reset, clk, clk_en, s11, signed_s32, signed_s33);
That lops of those errors, but reveals two more:
G29: Mem port map(Clock, '0','1',s5,outimag);
G30: Mem port map(Clk, '0','1',s5,outreal);
If you look at your mem component and the positional association list in the instance port maps you'll find you're missing an integer argument for both of these representing Address.
I don't think you've revealed enough of your 'precious' IP from someone to tell what should be connected here. It's part of the price in seeking help, showing what you got. When someone tells you it isn't a minimum example, in this case it would be throwing out component instantiations and signals not connected to the actual error reports.
Also note the promiscuous use of unconstrained integers which can end up implying 32 bit values in synthesis. You should be careful and constrain everything you can.
For instance defining the range constraint for the integer address going to the Mem component defines how big the memory is.
Dummy-ing up a signal Address, an integer and inserting it in the component allows dft to finish analyzing:
G29: Mem port map(Clock, '0','1',Address,s5,outimag);
G30: Mem port map(Clk, '0','1',Address,s5,outreal);
It's not possible to elaborate your design without dummy-ing up entity and architecture pairs for all your instantiated components or eliminating them (which would lead you to a second question later).
(And you could have produced integers from the sincos_lut entity/architecture pair, but without a range constraint that would have likely been a 32 bit value).

VHDL gate basics

I'm learning VHDL and I've come to a halt. I'd like to create a simple gate out of smaller gates (a NAND gate here). Here's the code:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity ANDGATE2 is
port(
x,y : in STD_LOGIC;
z : out STD_LOGIC
);
end ANDGATE2;
architecture ANDGATE2 of ANDGATE2 is
begin
z <= x AND y;
end ANDGATE2;
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity NOTGATE1 is
port(
x : in STD_LOGIC;
z : out STD_LOGIC
);
end NOTGATE1;
architecture NOTGATE1 of NOTGATE1 is
begin
z <= NOT x;
end NOTGATE1;
library ieee;
use ieee.std_logic_1164.all;
entity NANDGATE2 is
port(
x : in STD_LOGIC;
y : in STD_LOGIC;
z : out STD_LOGIC
);
end NANDGATE2;
architecture NANDGATE2 of NANDGATE2 is
signal c, d: std_logic;
component NOTGATE1
port(
n_in : in STD_LOGIC;
n_out : out STD_LOGIC
);
end component;
component ANDGATE2
port(
a_in1, a_in2 : in STD_LOGIC;
a_out : out STD_LOGIC
);
end component;
begin
N0: ANDGATE2
port map(x, y, c);
N1: NOTGATE1
port map(c, d);
z <= d;
end NANDGATE2;
Here's the code from some tutorial I've been using as a template; it compiles with no problems.
library ieee;
use ieee.std_logic_1164.all;
-- definition of a full adder
entity FULLADDER is
port
(
a, b, c: in std_logic;
sum, carry: out std_logic
);
end FULLADDER;
architecture fulladder_behav of FULLADDER is
begin
sum <= (a xor b) xor c ;
carry <= (a and b) or (c and (a xor b));
end fulladder_behav;
-- 4-bit adder
library ieee;
use ieee.std_logic_1164.all;
entity FOURBITADD is
port
(
a, b: in std_logic_vector(3 downto 0);
Cin : in std_logic;
sum: out std_logic_vector (3 downto 0);
Cout, V: out std_logic
);
end FOURBITADD;
architecture fouradder_structure of FOURBITADD is
signal c: std_logic_vector (4 downto 0);
component FULLADDER
port
(
a, b, c: in std_logic;
sum, carry: out std_logic
);
end component;
begin
FA0: FULLADDER
port map (a(0), b(0), Cin, sum(0), c(1));
FA1: FULLADDER
port map (a(1), b(1), C(1), sum(1), c(2));
FA2: FULLADDER
port map (a(2), b(2), C(2), sum(2), c(3));
FA3: FULLADDER
port map (a(3), b(3), C(3), sum(3), c(4));
V <= c(3) xor c(4);
Cout <= c(4);
end fouradder_structure;
My code compiles with no errors, but with two warnings:
# Warning: ELAB1_0026: p2.vhd : (85, 0): There is no default binding for component "andgate2".(Port "a_in1" is not on the entity).
# Warning: ELAB1_0026: p2.vhd : (87, 0): There is no default binding for component "notgate1".(Port "n_in" is not on the entity).
What gives?
You need to use the same port names on your component and entity declarations.
Right now, for example in your NOTGATE1 entity declaration, you have input port x and output port z, but in the NANDGATE2 architecture, you declare the NOTGATE1 component to have ports n_in and n_out.
This won't cause problems during compilation, since compilation looks at a single unit at a time, and won't see the actual entities. In the elaboration phase, your tools will try to match up the entities to components, but this will fail since the ports don't match.
Not 100% sure, but I think the pins in your component declarations need to match up to the ones in your entity blocks:
component NOTGATE1
port(
x : in STD_LOGIC;
z : out STD_LOGIC
);
end component;
component ANDGATE2
port(
x,y : in STD_LOGIC;
z : out STD_LOGIC
);
Always use explicit port bindings in your port maps, like
port map(a_in1 => x,
a_in2 => y,
a_out => c);
It will make your code also more clear. In big projects it is the first rule of thumb.

Resources