I need a VHDL guru and a GAL guru

  • Thread starter Thread starter Number2Pencil
  • Start date Start date
Number2Pencil
Messages
204
Reaction score
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;
 

Attachments

  • password schematicA.GIF
    password schematicA.GIF
    24.9 KB · Views: 642
  • password code.doc
    password code.doc
    23.5 KB · Views: 437
Last edited:
Engineering news on Phys.org
here's that block diagram
 

Attachments

  • password schematicB.JPG
    password schematicB.JPG
    22.8 KB · Views: 631
well the block diagram isn't appearing for me, maybe it is for you
 
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?
 
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
 
Yup, that fit on a single GAL...much better than using 3
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
28K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
Replies
2
Views
3K
Replies
5
Views
11K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
4
Views
5K
  • · Replies 1 ·
Replies
1
Views
12K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 6 ·
Replies
6
Views
6K