Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Problem with Behav Sim vs Post Place & Route Sim

 
Thread Tools Search this Thread
Old 09-22-2005, 06:06 PM   #1
Default Problem with Behav Sim vs Post Place & Route Sim


I have a real simple piece of code where I am setting a signal in the
test bench and generating an ack signal in the main code. I have coded
it using state machines since I plan to add to it once I figure out why
it won't work in Post Place & route. The code is shown below.

Thanks in advance for any help..

Joel

-- MAIN CODE
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity CDEout is
Port (
FPGA_CLK : in std_logic;
LRESET_n : in std_logic;
LHOLD : in std_logic;
LHOLDA : out std_logic
);
end CDEout;

architecture RTL of CDEout is

type State_Type is (S0,S1,S2);

signal Current_State : State_Type;
signal Next_State : State_Type;

signal CLK : std_logic;
signal RESET : std_logic;

signal set_holda : boolean;
signal rst_holda : boolean;


begin

CLK <= FPGA_CLK;
RESET <= not LRESET_n;

Sync: PROCESS( CLK, RESET)
begin

if (RESET = '1') then
current_state <= S0;
elsif (rising_edge(CLK)) then
current_state <= next_state;
end if;

end process;


PROCESS( CLK, RESET )
begin
if (RESET = '1') then
LHOLDA <= '0';
elsif (rising_edge(CLK)) then
if (set_holda) then
LHOLDA <= '1';
elsif (rst_holda) then
LHOLDA <= '0';
end if;
end if;
end process;


Comb: PROCESS(Current_State, LHOLD)
begin

set_holda <= FALSE;
rst_holda <= FALSE;

case Current_State is

when S0 =>
if (LHOLD = '1') then
set_holda <= TRUE;
next_state <= S1;
else
set_holda <= FALSE;
next_state <= S0;
end if;


when S1 =>

next_state <= S2;

when S2 =>

next_state <= S1;

end case;
end process;

end RTL;


-- TEST BENCH

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;

ENTITY CDEout_tb_vhd IS
END CDEout_tb_vhd;

ARCHITECTURE behavior OF CDEout_tb_vhd IS

-- Component Declaration for the Unit Under Test (UUT)
COMPONENT cdeout
PORT(
FPGA_CLK : IN std_logic;
LRESET_n : IN std_logic;
LHOLD : IN std_logic;
LHOLDA : OUT std_logic
);
END COMPONENT;

--Inputs
SIGNAL FPGA_CLK : std_logic := '0';
SIGNAL LRESET_n : std_logic := '0';
SIGNAL LHOLD : std_logic := '0';

--Outputs
SIGNAL LHOLDA : std_logic;

signal RESET : std_logic := '1';

type State_Type is (S0,S1,S2,S3,S4);
signal Current_State, Next_State : State_Type;



BEGIN

-- Instantiate the Unit Under Test (UUT)
uut: cdeout PORT MAP(
FPGA_CLK => FPGA_CLK,
LRESET_n => LRESET_n,
LHOLD => LHOLD,
LHOLDA => LHOLDA
);

FPGA_CLK <= not FPGA_CLK after 30.303 ns;
RESET <= '0' after 303.03 ns;

-- process
-- begin
--
-- wait for 211 ns;
-- LHOLD <= '1';
--
-- wait;
--
-- end process;
--
Sync: PROCESS( FPGA_CLK, RESET)
begin

if (RESET = '1') then
current_state <= S0;
elsif (rising_edge(FPGA_CLK)) then
current_state <= next_state;
end if;

end process;

Comb: PROCESS(Current_State)
begin

case Current_State is

when S0 =>
LRESET_n <= '0';
next_state <= S1;

when S1 =>
LRESET_n <= '1';
next_state <= S2;

when S2 =>

LHOLD <= '1';
next_state <= S3;

when S3 =>
next_state <= S4;


when S4 =>

next_state <= S3;

end case;

end process;

END;



joel.weddick@lmco.com
  Reply With Quote
Old 09-22-2005, 06:16 PM   #2
joel.weddick@lmco.com
 
Posts: n/a
Default Re: Problem with Behav Sim vs Post Place & Route Sim
Some additional information:

LHOLDA should go active on the next rising clock edge after LHOLD is
set. This works fine in the Behav sim. In the Post P&R sim, LHOLDA
stays low all the time.

Joel



joel.weddick@lmco.com
  Reply With Quote
Old 09-23-2005, 01:31 AM   #3
Mike Treseler
 
Posts: n/a
Default Re: Problem with Behav Sim vs Post Place & Route Sim
wrote:

> LHOLDA should go active on the next rising clock edge after LHOLD is
> set. This works fine in the Behav sim. In the Post P&R sim, LHOLDA
> stays low all the time.


I think the problem is in your Post P&R testbench.
But a post route sim is unnecessary.

Your RTL code is inexplicable but I see no errors.
See a single process version of the same description below:

-- Mike Treseler

_____________________________

library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.numeric_std.all;

entity CDEout is
port (
CLK : in std_logic;
LRESET_n : in std_logic;
LHOLD : in std_logic;
LHOLDA : out std_logic -- alt des. int
);
end CDEout;

architecture RTL of CDEout is
begin
one : process(CLK, LRESET_n) is
subtype phase_t is natural range 0 to 3; -- two bits
variable phase_v : phase_t;
constant active_phase_c : phase_t := 1;
constant roll_phase_c : phase_t := 2;
variable lholda_v : std_logic;
begin
template : if (LRESET_n = '0') then
phase_v := 0;
lholda_v := '0';
elsif (rising_edge(CLK)) then
if phase_v = active_phase_c then
if lhold = '0' then
lholda_v := '0';
phase_v := 0;
else
lholda_v := '1';
end if;
end if;
if phase_v < roll_phase_c then
phase_v := phase_v + 1;
else
phase_v := 1; -- 0,1,2,1,2,...
end if;
end if template;
lholda <= lholda_v;
end process one;
end architecture RTL;


-- vsim cdeout_tb_vhd -do "add wave -r *; add wave
/cdeout_tb_vhd/uut/one/*;run 900;"


Mike Treseler
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comcast + Wireless Internet Problem shadoweloc General Help Related Topics 1 07-01-2008 06:19 PM
DVD +R burning problem. Sseadoubleyou DVD Video 0 09-25-2005 12:52 AM
Strange DVD Diagnostic Problem... Jack DVD Video 11 12-19-2004 02:43 PM
Pioneer DVR3100S problem with Satellite receiver Samsung DCR 9500 Fredrik Bengtsson DVD Video 0 12-12-2003 02:32 PM
Computer start up problem James Walker A+ Certification 0 07-07-2003 10:32 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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