Hello everyone!. I have a problem!. I can't understand why do not work
how i hope it..
I have 2 components "registro_16bits" and "decoEstado"
on Registro_16bits:
when rising_edge of clock and enable is 1: I can write on Z_out the X_in
value; I don't have problem here.
the problem is when I connect decoEstado with registro_16bits.
decoEstado receives izq_in and der_in.
truth table:
izq_in | der_in | z_out
0 0 0
0 1 0
1 0 1
1 1 0
my desing should to work:
when izq_in is 1 and der_in is 0 I should save x_in value and let get
out that value on z_out.
I use decoEstado to assign enable_in on registro_16bits.
I'm apologize, but i don't speak english very well.. I hope u can help
me..
thanks
I attach the whole code and 2 TestBench Pictures!
---------------------------------------------------------------
-- Registro_16bits code
1 | entity registro_16bits is
|
2 | Port ( x_in : in STD_LOGIC_VECTOR (15 downto 0);
|
3 | enable_in : in STD_LOGIC;
|
4 | reset_in : in STD_LOGIC;
|
5 | clk : in STD_LOGIC;
|
6 | z_out : out STD_LOGIC_VECTOR (15 downto 0));
|
7 | end registro_16bits;
|
8 |
|
9 | architecture Behavioral of registro_16bits is
|
10 | --signal temp: std_logic_vector(15 downto 0):=(others=>'0');
|
11 | begin
|
12 |
|
13 | process(clk,reset_in)
|
14 | begin
|
15 | if reset_in='1' then
|
16 | z_out<="0000000000000000";
|
17 | elsif(clk'event and clk='1') then
|
18 | if(enable_in='1') then
|
19 | z_out<=x_in;
|
20 | end if;
|
21 | end if;
|
22 | end process;
|
23 |
|
24 | end Behavioral;
|
----------------------------------------------------------
----------------------------------------------------------
--deEstado Code
1 | entity decoEstado is
|
2 | Port ( izq_in : in STD_LOGIC;
|
3 | der_in : in STD_LOGIC;
|
4 | z_out : out STD_LOGIC);
|
5 | end decoEstado;
|
6 |
|
7 | architecture Behavioral of decoEstado is
|
8 |
|
9 | begin
|
10 |
|
11 | z_out<= izq_in and not(der_in);
|
12 | end Behavioral;
|
--------------------------------------------------------
--------------------------------------------------------
1 | -- neurona_simple code
|
2 |
|
3 |
|
4 | entity neurona_simple is
|
5 | Port ( x_in : in STD_LOGIC_VECTOR (15 downto 0);
|
6 | izq_in : in STD_LOGIC;
|
7 | der_in : in STD_LOGIC;
|
8 | reset_in : in STD_LOGIC;
|
9 | clk : in STD_LOGIC;
|
10 | z_out : out STD_LOGIC_VECTOR (15 downto 0));
|
11 | end neurona_simple;
|
12 |
|
13 | architecture Behavioral of neurona_simple is
|
14 |
|
15 | component registro_16bits
|
16 | Port ( x_in : in STD_LOGIC_VECTOR (15 downto 0);
|
17 | enable_in : in STD_LOGIC;
|
18 | reset_in : in STD_LOGIC;
|
19 | clk : in STD_LOGIC;
|
20 | z_out : out STD_LOGIC_VECTOR (15 downto 0));
|
21 | end component;
|
22 |
|
23 | component decoEstado is
|
24 | Port ( izq_in : in STD_LOGIC;
|
25 | der_in : in STD_LOGIC;
|
26 | z_out : out STD_LOGIC);
|
27 | end component;
|
28 |
|
29 | signal enable_sg : std_logic :='0';
|
30 | begin
|
31 |
|
32 | deco : decoEstado port map(izq_in,der_in,enable_sg);
|
33 | reg : registro_16bits port map(x_in,enable_sg,reset_in,clk,z_out);
|
34 |
|
35 | end Behavioral;
|
----------------------------------------------------------------------