Counter simulation proper but giving trouble in DFT

Discussion in 'VHDL' started by nisheethg@gmail.com, Feb 8, 2007.

  1. Guest

    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use IEEE.STD_LOGIC_ARITH.ALL;
    use IEEE.STD_LOGIC_UNSIGNED.ALL;


    entity su_pixel_counter is
    Port ( CLK : in STD_LOGIC;
    RESET : in STD_LOGIC;
    EN : in STD_LOGIC;
    CNTR_INCR : in STD_LOGIC;
    LOAD_PIXEL : in STD_LOGIC;
    TC : in STD_LOGIC_VECTOR( 3 downto 0);
    COUNT_ONE : out STD_LOGIC;
    COUNT_ONE_IF_INCR : out STD_LOGIC;-- First Count i.e. zero
    CNTR : out STD_LOGIC_VECTOR ( 3 downto 0);
    TC_MINUS_CNTR : out STD_LOGIC_VECTOR ( 3 downto 0);
    SUM_OF_CNTR_AND_TC_MINUS_CNTR: out STD_LOGIC_VECTOR ( 3 downto 0);
    PIXEL_CNTR_COUNT_OVER : out STD_LOGIC

    --test
    );
    end su_pixel_counter;

    architecture Behavioral of su_pixel_counter is

    SIGNAL CNTR_IN : STD_LOGIC_VECTOR(3 downto 0); -- original value 1

    --SIGNAL iCNTR : STD_LOGIC_VECTOR(3 downto 0);
    --SIGNAL iTC_MINUS_CNTR : STD_LOGIC_VECTOR(3 downto 0);
    --SIGNAL iSUM_OF_CNTR_AND_TC_MINUS_CNTR : STD_LOGIC_VECTOR(3 downto
    0);

    begin

    process(CLK, RESET)
    begin

    if ( RESET ='1') then
    CNTR_IN <= b"0000";
    PIXEL_CNTR_COUNT_OVER <= '0';
    COUNT_ONE_IF_INCR <= '0';


    elsif(CLK'event and CLK ='1') then
    if ( EN ='1') then
    if (CNTR_INCR = '1') then

    -- CNTR_IN <= CNTR_IN + 1;

    if ( CNTR_IN = "0000") then
    COUNT_ONE_IF_INCR<= '1';
    PIXEL_CNTR_COUNT_OVER <= '0';
    CNTR_IN <= CNTR_IN + 1;

    elsif ( CNTR_IN = TC) then
    COUNT_ONE_IF_INCR<= '0';
    PIXEL_CNTR_COUNT_OVER <= '1';
    CNTR_IN <= CNTR_IN + 1;

    elsif ( CNTR_IN = TC + 1 ) then
    COUNT_ONE_IF_INCR<= '0';
    PIXEL_CNTR_COUNT_OVER <= '0';
    CNTR_IN <= b"0000";
    else
    CNTR_IN <= CNTR_IN + 1;

    end if;


    --if ( CNTR_IN = TC + 1) then
    -- CNTR_IN <= b"0000"; -- original value 0001
    -- end if;


    -- for generating counter count over when TC is greater than 1
    -- if ( CNTR_IN = TC) then -- original tc -1
    -- PIXEL_CNTR_COUNT_OVER<='1';
    -- end if;

    --
    -- if (CNTR_IN = b"0000") then -- chnaged from 1 to 0
    -- COUNT_ONE_IF_INCR<= '1';
    -- else
    -- COUNT_ONE_IF_INCR<= '0';
    -- end if;
    end if;

    else
    PIXEL_CNTR_COUNT_OVER<= '0';
    COUNT_ONE_IF_INCR<= '0';
    end if;

    CNTR<= CNTR_IN;
    TC_MINUS_CNTR<= (TC + 2) - CNTR_IN;
    SUM_OF_CNTR_AND_TC_MINUS_CNTR <= TC + 2;


    end if;
    end process;




    --- COunter intitial value flag
    process( CLK, RESET)
    begin
    if (RESET ='1') then
    COUNT_ONE<= '0';
    elsif (CLK ='1' and CLK'event) then
    if (CNTR_IN = b"0001") then
    COUNT_ONE<= '1';
    else
    COUNT_ONE<= '0';
    end if;
    end if;
    end process;



    --process(CLK, RESET)
    --begin
    -- if (RESET ='1') then


    -- elsif ( CLK ='1' and CLK'event) then


    -- -end if;
    --end process;

    --CNTR <= iCNTR;
    --TC_MINUS_CNTR <= iTC_MINUS_CNTR;
    --SUM_OF_CNTR_AND_TC_MINUS_CNTR <= iSUM_OF_CNTR_AND_TC_MINUS_CNTR;

    end Behavioral;
     
    , Feb 8, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    921
  2. Lukasz Indyk

    Java Advanced Imaging and DFT

    Lukasz Indyk, Jan 14, 2004, in forum: Java
    Replies:
    1
    Views:
    3,849
  3. Roberto Dias

    DFT routine

    Roberto Dias, May 26, 2004, in forum: C++
    Replies:
    8
    Views:
    4,392
    Jeff Schwab
    May 28, 2004
  4. Replies:
    1
    Views:
    353
  5. sixteenmillion

    The giving that keeps on giving

    sixteenmillion, Nov 19, 2007, in forum: C Programming
    Replies:
    0
    Views:
    429
    sixteenmillion
    Nov 19, 2007
Loading...

Share This Page