I need a VHDL guru and a GAL guru

  • Thread starter Thread starter Number2Pencil
  • Start date Start date
AI Thread Summary
The discussion revolves around programming a GAL22V10 with VHDL for a password system that includes storing and testing modes, along with user inputs and LED indicators. Initially, the user struggled to fit the design into a single GAL due to the number of required flip-flops and outputs. After reevaluating the design, they optimized it by removing unnecessary signals and relocating LED management outside the GAL, which significantly reduced the resource requirements. This adjustment allowed the entire system to fit within a single GAL, demonstrating the importance of design efficiency in digital systems. The user plans to continue refining the design and share updates on their progress.
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: 601
  • password code.doc
    password code.doc
    23.5 KB · Views: 401
Last edited:
Engineering news on Phys.org
here's that block diagram
 

Attachments

  • password schematicB.JPG
    password schematicB.JPG
    22.8 KB · Views: 588
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
 
Very basic question. Consider a 3-terminal device with terminals say A,B,C. Kirchhoff Current Law (KCL) and Kirchhoff Voltage Law (KVL) establish two relationships between the 3 currents entering the terminals and the 3 terminal's voltage pairs respectively. So we have 2 equations in 6 unknowns. To proceed further we need two more (independent) equations in order to solve the circuit the 3-terminal device is connected to (basically one treats such a device as an unbalanced two-port...
suppose you have two capacitors with a 0.1 Farad value and 12 VDC rating. label these as A and B. label the terminals of each as 1 and 2. you also have a voltmeter with a 40 volt linear range for DC. you also have a 9 volt DC power supply fed by mains. you charge each capacitor to 9 volts with terminal 1 being - (negative) and terminal 2 being + (positive). you connect the voltmeter to terminal A2 and to terminal B1. does it read any voltage? can - of one capacitor discharge + of the...
Thread 'Weird near-field phenomenon I get in my EM simulation'
I recently made a basic simulation of wire antennas and I am not sure if the near field in my simulation is modeled correctly. One of the things that worry me is the fact that sometimes I see in my simulation "movements" in the near field that seems to be faster than the speed of wave propagation I defined (the speed of light in the simulation). Specifically I see "nodes" of low amplitude in the E field that are quickly "emitted" from the antenna and then slow down as they approach the far...
Back
Top