Pradeepbp
Junior Member level 2
- Joined
- Sep 21, 2013
- Messages
- 23
- Helped
- 9
- Reputation
- 18
- Reaction score
- 9
- Trophy points
- 3
- Location
- Kerala
- Activity points
- 214
Hi, I am developing VHDL code for 0101 sequence detector. When i simulate, i get 0 output no matter what the sequence is. I have used JK flipflop to implement the design. In my code, im calling JK ff through component port-map. JK ff works fine individually but in the top-level module, its output is always zero.
there's some warning when i check behavioral syntax in simulation space.
WARNING:HDLCompiler:89 - "C:/Documents and Settings/FSM_seqdetector_0101/FSM_seqdec_0101.vhd" Line 60: <jkff> remains a black-box since it has no binding entity.
WARNING:HDLCompiler:89 - "C:/Documents and Settings/FSM_seqdetector_0101/FSM_seqdec_0101.vhd" Line 61: <jkff> remains a black-box since it has no binding entity.Completed static elaboration
Any idea where is the problem???
Here my code for reference.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity FSM_seqdec_0101 is
Port ( x : in STD_LOGIC;
clk : in STD_LOGIC;
z : out STD_LOGIC);
end FSM_seqdec_0101;
architecture Behavioral of FSM_seqdec_0101 is
signal sj1,sj2,sk1,sk2:std_logic;
signal so2:std_logic:='0';
signal so1:std_logic:='0';
signal so1q: std_logic:='1';
signal so2q: std_logic:='1';
component JKFF
port(J,K: in std_logic;
q,qb: inout std_logic;
clk:in std_logic);
end component;
begin
sj1<=x and so2;
sk1<=x or so2;
z<=so1 and so2 and x;
sk2<=x;
JKFF1: JKFF port map(j=>sj1,k=>sk1,clk=>clk,q=>so1,qb=>so1q);
JKFF2: JKFF port map(j=>not sk2,k=>sk2,clk=>clk,q=>so2,qb=>so2q);
end Behavioral;
JK ff code:
entity JKFF is
Port ( j : in STD_LOGIC;
k : in STD_LOGIC;
q : inout STD_LOGIC;
qb : inout STD_LOGIC;
clk : in STD_LOGIC);
end JKFF;
architecture Behavioral of JKFF is
signal qtemp:std_logic;
begin
process(clk)
begin
if(clk'event and clk='1') then
if(j='0' and k='0') then
qtemp<=qtemp;
elsif(j='0' and k='1') then
qtemp<='0';
elsif(j='1' and k='0') then
qtemp<='1';
elsif(j='1' and k='1') then
qtemp<=not qtemp;
end if;
end if;
end process;
q<=qtemp;
qb<=not qtemp;
end Behavioral;
schematic:
there's some warning when i check behavioral syntax in simulation space.
WARNING:HDLCompiler:89 - "C:/Documents and Settings/FSM_seqdetector_0101/FSM_seqdec_0101.vhd" Line 60: <jkff> remains a black-box since it has no binding entity.
WARNING:HDLCompiler:89 - "C:/Documents and Settings/FSM_seqdetector_0101/FSM_seqdec_0101.vhd" Line 61: <jkff> remains a black-box since it has no binding entity.Completed static elaboration
Any idea where is the problem???
Here my code for reference.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity FSM_seqdec_0101 is
Port ( x : in STD_LOGIC;
clk : in STD_LOGIC;
z : out STD_LOGIC);
end FSM_seqdec_0101;
architecture Behavioral of FSM_seqdec_0101 is
signal sj1,sj2,sk1,sk2:std_logic;
signal so2:std_logic:='0';
signal so1:std_logic:='0';
signal so1q: std_logic:='1';
signal so2q: std_logic:='1';
component JKFF
port(J,K: in std_logic;
q,qb: inout std_logic;
clk:in std_logic);
end component;
begin
sj1<=x and so2;
sk1<=x or so2;
z<=so1 and so2 and x;
sk2<=x;
JKFF1: JKFF port map(j=>sj1,k=>sk1,clk=>clk,q=>so1,qb=>so1q);
JKFF2: JKFF port map(j=>not sk2,k=>sk2,clk=>clk,q=>so2,qb=>so2q);
end Behavioral;
JK ff code:
entity JKFF is
Port ( j : in STD_LOGIC;
k : in STD_LOGIC;
q : inout STD_LOGIC;
qb : inout STD_LOGIC;
clk : in STD_LOGIC);
end JKFF;
architecture Behavioral of JKFF is
signal qtemp:std_logic;
begin
process(clk)
begin
if(clk'event and clk='1') then
if(j='0' and k='0') then
qtemp<=qtemp;
elsif(j='0' and k='1') then
qtemp<='0';
elsif(j='1' and k='0') then
qtemp<='1';
elsif(j='1' and k='1') then
qtemp<=not qtemp;
end if;
end if;
end process;
q<=qtemp;
qb<=not qtemp;
end Behavioral;
schematic: