Andrea Scafuto
Newbie level 4
- Joined
- Nov 2, 2013
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 63
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 entity Sommatore is Port ( In0 : in STD_LOGIC; In1 : in STD_LOGIC; In2 : in STD_LOGIC; In3 : in STD_LOGIC; O0 : out STD_LOGIC; O1 : out STD_LOGIC; O2 : out STD_LOGIC; O3 : out STD_LOGIC); end Sommatore; architecture Behavioral of Sommatore is component boundscan is Port ( Din0 : in STD_LOGIC; Din1 : in STD_LOGIC; Din2 : in STD_LOGIC; Din3 : in STD_LOGIC; Scan_en : in STD_LOGIC; Scan_in : in STD_LOGIC; clk : in STD_LOGIC; Dout0 : out STD_LOGIC; Dout1 : out STD_LOGIC; Dout2 : out STD_LOGIC; Dout3 : out STD_LOGIC; Scan_out : out STD_LOGIC); end component;
Din0 = 0 ---> Dout0 = 0
Din1 = 0 ---> Dout1 = 0
Din2 = 1 ---> Dout2 = 1
Din3 = 0 ---> Dout3 = 0
Dout0 ---> In0 = 0
Dout1 ---> In1 = 0
Dout2 ---> In2 = 1
Dout3 ---> In3 = 0
O0 = 0
O1 = 0
O2 = 1
O3 = 1
You didn't show the architecture body and the entity is still missing the said control signals.
begin
In0 <= Dout0;
In1 <= Dout1;
In2 <= Dout2;
In3 <= Dout3;
O0 <= In0;
O1 <= In1;
O2 <= In2;
O3 <= In3 OR '1';
end Behavioral;
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 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 fm is Port ( Din : in STD_LOGIC; Scan_in : in STD_LOGIC; Scan_en : in STD_LOGIC; clk : in STD_LOGIC; Dout : out STD_LOGIC); end fm; architecture Structural of fm is --Definizione del Componente Flip-Flop ------------------------------------- component flip_flop is Port ( d : in STD_LOGIC; clock : in STD_LOGIC; q : out STD_LOGIC); end component; ------------------------------------- --Definizione del Componente Mux2-1 ------------------------------------- component mux2_1 is Port ( a : in STD_LOGIC; b : in STD_LOGIC; sel : in STD_LOGIC; o : out STD_LOGIC); end component; ------------------------------------- signal temp : STD_LOGIC; begin --Port Map dei componenti mux : mux2_1 port map(Din, Scan_in, Scan_en, temp); ff : flip_flop port map(temp, clk, Dout); end Structural;
O.K., looks good. But component fm doesn't appear in the previously shown code. Neither instances of component fm nor component boundscan.
I would strongly suggest to use named instead of positional association in component instances. Makes the code better readable and avoids nasty confusion of ports.
You don't "call variables" in structural VHDL design, just connect components. As said, it can't be seen how you did it.i have a problem in Component Sommatore when i try to call variables defined in other components
You don't "call variables" in structural VHDL design, just connect components. As said, it can't be seen how you did it.
It's done right in entity fm, I would expect similar component instantiations in the entity Sommatore.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity boundscan is
Port ( Din0 : in STD_LOGIC;
Din1 : in STD_LOGIC;
Din2 : in STD_LOGIC;
Din3 : in STD_LOGIC;
Scan_en : in STD_LOGIC;
Scan_in : in STD_LOGIC;
clk : in STD_LOGIC;
Dout0 : out STD_LOGIC;
Dout1 : out STD_LOGIC;
Dout2 : out STD_LOGIC;
Dout3 : out STD_LOGIC;
Scan_out : out STD_LOGIC);
end boundscan;
architecture Structural of boundscan is
component fm is
Port ( Din : in STD_LOGIC;
Scan_in : in STD_LOGIC;
Scan_en : in STD_LOGIC;
clk : in STD_LOGIC;
Dout : out STD_LOGIC);
end component;
signal u0,u1,u2,u3 : STD_LOGIC;
begin
flimux1 : fm Port Map(Din0,Scan_in,Scan_en,clk,u0);
flimux2 : fm Port Map(Din1,u0,Scan_en,clk,u1);
flimux3 : fm Port Map(Din2,u1,Scan_en,clk,u2);
flimux4 : fm Port Map(Din3,u2,Scan_en,clk,u3);
logica : process(Din0,Din1,Din2,Din3,Scan_in,clk,Scan_en)
begin
if Scan_en='0'
then
Dout0 <= Din0;
Dout1 <= Din1;
Dout2 <= Din2;
Dout3 <= Din3;
else
Scan_out <= Din0;
end if;
end process;
end Structural;
dout0 <= u0;
dout1 <= u1;
dout2 <= u2;
dout3 <= u3;
Scan_out <= u3;
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?