Sample code

Discussion in 'VHDL' started by shah_satish2002, Jul 17, 2007.

  1. shah_satish2002

    shah_satish2002

    Joined:
    Jul 10, 2007
    Messages:
    11
    Hi..
    I am new and i dont have much knowledge about VHDL..Here is my code.


    Library IEEE;
    Use IEEE.std_logic_1164.all;

    Entity Del is
    port( M1,M2,M3,SEL: in bit;
    bit1,bit2,bit3: out bit);
    End Entity Del;

    Architecture FA_calc of Del is

    begin


    process (SEL,M1,M2,M3)

    variable IN_vector: bit_vector(3 downto 0);
    begin

    loop1: for i in 0 to 11 loop

    IN_vector := SEL & M1 & M2 & M3 ;

    case IN_vector is

    when "0000" => bit1<='0'; bit2 <= '0';bit3 <= '0';
    when "0100" => bit1<='0'; bit2 <= '0';bit3 <= '0';

    when "1100" => bit1<='1'; bit2 <= '0';bit3 <= '0';
    when "1110" => bit1<='1'; bit2 <= '0';bit3 <= '0';

    when "0110" => bit1<='1'; bit2 <= '1';bit3 <= '0';

    when "0010" => bit1<='1'; bit2 <= '1';bit3 <= '0';

    when "1010" => bit1<='0'; bit2 <= '1';bit3 <= '0';

    when "1011" => bit1<='0'; bit2 <= '1';bit3 <= '0';

    when "0011" => bit1<='0'; bit2 <= '1';bit3 <= '1';

    when "0111" => bit1<='0'; bit2 <= '1';bit3 <= '1';

    when "1111" => bit1<='1'; bit2 <= '1';bit3 <= '1';

    when "1101" => bit1<='1'; bit2 <= '1';bit3 <= '1';

    when "0101" => bit1<='1'; bit2 <= '0';bit3 <= '1';

    when "0001" => bit1<='1'; bit2 <= '0';bit3 <= '1';

    when "1001" => bit1<='0'; bit2 <= '0';bit3 <= '1';

    when "1000" => bit1<='0'; bit2 <= '0';bit3 <= '1';

    End case;

    -- SEL := bit3 ; Here i want to make " bit 3 = SEL "is the input for next cycle.


    end loop loop1;
    end process;

    End Architecture FA_calc ;



    Here I need to create Clock.. and my clock frequency is 24 mhz.I need to rotate my cycle 12 times..so i can get 24 bit out put (i need only bit 1 and bit 2 at every cycle as a out put..Bit 3 is the input for next cycle)..But end of the cycle (12th cycle, My out put is bit1,bit2 and bit3)

    Please help me out..I know my code is not perfect..

    I hope, my question will be clear.
     
    Last edited: Jul 17, 2007
    shah_satish2002, Jul 17, 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. Jake
    Replies:
    0
    Views:
    563
  2. Tim Chase
    Replies:
    0
    Views:
    76
    Tim Chase
    Feb 16, 2014
  3. Terry Reedy
    Replies:
    0
    Views:
    84
    Terry Reedy
    Feb 16, 2014
  4. Tim Chase
    Replies:
    0
    Views:
    88
    Tim Chase
    Feb 16, 2014
  5. Ned Batchelder
    Replies:
    0
    Views:
    85
    Ned Batchelder
    Feb 16, 2014
Loading...

Share This Page