M
Mohd Zulkarnain Jaranee
Guest
Hi, I want to make a controller which will enable the latch.
As you can seen on my code below, the signal en will take the output from w AND x to enable the latch. After that, w and x will fetch the en. For example, initially, let say the w and x values start at 1, the en will become 1 and cause the latch to fetch data from data_in to data_out. After that, en will become the input of w and x and cause the latch to disable. However, the circuit didn't work when I tested it using altera university waveform program. The data_out didnt take the value of data_in. I can't figure out what is the problem still I'm new in VHDL. Hope you can assist/advice me on this
Sorry for my bad english.
library ieee;
use ieee.std_logic_1164.all;
entity gasp_ctrl is
port(
w,x : inout std_logic; --! bidirectional wire
data_in : in std_logic; --! Data In when latch is enable
data_out: out std_logic --
);
end gasp_ctrl;
architecture ctrl of gasp_ctrl is
signal en, ww, xx : std_logic;
begin
en <= w and x; ------
ww <= en;
xx <= not en;
w <= ww;
x <= xx;
-------- Latch ------
process(en)
begin
if(en = '1') then
data_out <= data_in;
end if;
end process;
end gasp_ctrl;
As you can seen on my code below, the signal en will take the output from w AND x to enable the latch. After that, w and x will fetch the en. For example, initially, let say the w and x values start at 1, the en will become 1 and cause the latch to fetch data from data_in to data_out. After that, en will become the input of w and x and cause the latch to disable. However, the circuit didn't work when I tested it using altera university waveform program. The data_out didnt take the value of data_in. I can't figure out what is the problem still I'm new in VHDL. Hope you can assist/advice me on this
library ieee;
use ieee.std_logic_1164.all;
entity gasp_ctrl is
port(
w,x : inout std_logic; --! bidirectional wire
data_in : in std_logic; --! Data In when latch is enable
data_out: out std_logic --
);
end gasp_ctrl;
architecture ctrl of gasp_ctrl is
signal en, ww, xx : std_logic;
begin
en <= w and x; ------
ww <= en;
xx <= not en;
w <= ww;
x <= xx;
-------- Latch ------
process(en)
begin
if(en = '1') then
data_out <= data_in;
end if;
end process;
end gasp_ctrl;