franticEB
Full Member level 3
Hi i've to design a NRZI encoder / decoder system in VHDL.
The encoder and decoder will be implemented on 2 different fpgas (tx,rx)
I've wrote this for encoder
and this for decoder
Then i've created a top module where the output of encoder is the input for decoder and the clock is the same.
the result of simulation is figured below
Q of decoder doesn't move from it's logical low level. This is because, i think, the input of encoder is sampled on rising edge of clock and the input of decoder too, is it true?
How could i resolve my problem?
If the encoder is implemented on a FPGA transmitter and decoder is implemented on a FPGA receiver the problem will continue to exist?
Thanks
The encoder and decoder will be implemented on 2 different fpgas (tx,rx)
I've wrote this for encoder
Code:
entity NRZI_ENCODER is
Port ( CLK : in STD_LOGIC;
D : in STD_LOGIC;
Q : out STD_LOGIC);
end NRZI_ENCODER;
architecture Behavioral of NRZI_ENCODER is
signal qint : std_logic:='0';
begin
P1 : process(CLK)is
begin
if(D='1')then
if(qint='0')then
qint<='1';
else
qint<='0';
end if;
end if;
end process;
Q <= qint;
and this for decoder
Code:
entity NRZI_DECODER is
Port ( CLK : in STD_LOGIC;
D : in STD_LOGIC;
Q : out STD_LOGIC);
end NRZI_DECODER;
architecture Behavioral of NRZI_DECODER is
signal lastd : std_logic:='0';
begin
P1:process(CLK)is
begin
if rising_edge(CLK) then
if D = lastd then
Q <= '0';
else
Q <= '1';
end if;
lastd <= D;
end if;
end process;
end Behavioral;
Then i've created a top module where the output of encoder is the input for decoder and the clock is the same.
the result of simulation is figured below
Q of decoder doesn't move from it's logical low level. This is because, i think, the input of encoder is sampled on rising edge of clock and the input of decoder too, is it true?
How could i resolve my problem?
If the encoder is implemented on a FPGA transmitter and decoder is implemented on a FPGA receiver the problem will continue to exist?
Thanks