Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

I need a VHDL guru and a GAL guru

  1. Nov 24, 2006 #1
    This is my first time trying to program a GAL22V10 w/ VHDL and I'm having troubles. I'm trying to make a password system with a storing mode and a testing mode, and LEDs to tell you which mode you're in. The user inputs are a reset switch, a test-mode switch, and store-mode switch, 3 switches to represent your password, and an enter button. There's also a time-out input which will take you out of your mode if you take too long to do anything (called "16 count"). The outputs are 3 LEDs, a "Wrong" pin, and a "Correct" pin.

    I've attached a block diagram of how I want the processes to work. The code is also attached because it's hard to read on as posted

    The problem is I think one GAL should be enough to execute this, as it has enough inputs, outputs and flip-flops, yet the only way I could get it to fit is to use a GAL for EACH process (total of 3). Why is this, and what can I do about it?




    Now for some Code:

    Architecture PasswordSystem of GAL is
    signal memory: std_logic_vector(2 downto 0);
    signal test_mode: std_logic;
    signal store_mode: std_logic;
    signal password_attempted: std_logic;
    signal password_set: std_logic;

    begin

    Mode: Process (test_input, store_input, sixteen_count, password_attempted, password_set, reset)
    begin
    if (reset = '1' or sixteen_count = '0' or password_attempted = '1' or password_set = '1') then
    test_mode <= '0';
    store_mode <= '0';
    elsif (store_input = '1' and test_input = '0') then
    test_mode <= '0';
    store_mode <= '1';
    elsif (store_input = '0' and test_input = '1') then
    test_mode <= '1';
    store_mode <= '0';
    end if;
    end process;

    testingLED <= test_mode;
    storingLED <= store_mode;
    ten_secondsLED <= store_mode or test_mode;


    Store: Process (enter, reset)
    begin
    if (reset = '1') then
    memory <= "000";
    password_set <= '0';
    elsif (rising_edge(enter)) then
    if (store_mode = '1') then
    memory <= password_inputs;
    password_set <= '1'; --password is set, takes out of mode
    end if;
    end if;
    end process;


    Test: Process (enter, reset)
    begin
    if (reset = '1') then
    wrong <= '0';
    correct <= '0';
    elsif (rising_edge(enter)) then
    if (test_mode = '1') then
    if (inputs = memory) then --correct
    password_attempted <= '1';
    correct <= '1';
    wrong <= '0';
    else --wrong
    password_attempted <= '1';
    correct <= '0';
    wrong <= '1';
    end if;
    end if;
    end if;
    end process;
     

    Attached Files:

    Last edited: Nov 24, 2006
  2. jcsd
  3. Nov 24, 2006 #2
    here's that block diagram
     

    Attached Files:

  4. Nov 24, 2006 #3
    well the block diagram isn't appearing for me, maybe it is for you
     
  5. Nov 24, 2006 #4
    Well I think I've come to the "Why" of my question, maybe someone could verify for me.

    There's 10 outputs which can be either combinational or registered, but not both..So my design needed 9 flip-flops (2 of which would feed direct outputs), and 3 more combinational outputs, so I just had too many needs.

    So am I just stuck with using more than one? It seems like most digital devices that do....a TON of stuff with very few of these...and I'm doing something that seems simple and small, yet I need 3 of them. What's up?
     
  6. Nov 26, 2006 #5
    Well I've changed my design around a bit to save some room in the GAL. The LEDs get taken care of outside the GAL (frees up 3 outputs/flip-flops), the mode switches are now a single switch (frees up a whole process of determining which mode it should be in...2 flip flops), took out the signals "Password_set" and "Password_attempted" and put in an output that will go to an LED to show that the password is set.

    That totals to 3 ouputs, 3 flip-flops, and 8 inputs used...i think that leaves enough room to maybe do something else if I wanted (bigger password?).

    I'll let you know how it goes just incase anyone is curious
     
  7. Nov 27, 2006 #6
    Yup, that fit on a single GAL....much better than using 3
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: I need a VHDL guru and a GAL guru
  1. Help with VHDL (Replies: 2)

  2. VHDL tutorial (Replies: 11)

Loading...