Author Topic: FlipFlop via WinCUPL and GAL  (Read 2804 times)

0 Members and 1 Guest are viewing this topic.

Offline banedonTopic starter

  • Regular Contributor
  • *
  • Posts: 77
FlipFlop via WinCUPL and GAL
« on: March 29, 2015, 03:15:06 pm »
Hi guys

Does anyone program GALs and have some experience with WinCUPL?

I've recently purchased a Genius G540 programmer for my sins (anyone who has one probably knows what I mean!) and am experimenting with WinCUPL.
I'm trying to create an internal D flip flop and am running into some odd errors. For some reason it doesn't like me setting an output pin to 0 or False.

Here's my code:

Code: [Select]
/*
 * Inputs
 */

Pin 2 = d;       // Data out
Pin 3 = ck;      // Clock out

/*
 * Outputs
 */

Pin 23 = q;       // Q out
Pin 22 = nq;     // /Q out

/*
 * Main
 */

// AND gate stuff
and1a = !d;
and1b = ck;

and2a = d;
and2b = ck;

// set some values for Q so that the GAL can output something
q1 = 0;         // <--- error is found here
nq1 = 0;       // <--- error is found here

nor1a = and1a & and1b;
nor1b = q1;
nor2a = and2a & and2b;
nor2b = nq1;

// now set the actual output of Q via the NAND gates
q2 = !(nor1a # nor1b);
nq2 = !(nor2a # nor2b);

nor1a2 = and1a & and1b;
nor1b2 = q2;
nor2a2 = and2a & and2b;
nor2b2 = nq2;

q = !(nor1a2 # nor1b2);
nq = !(nor2a2 # nor2b2);

When I try and compile the above code, it says:

Invalid Syntax: 0
and points to the '1' in 'q1'
It does the same with 'nq1'

The lines that generate this error are:
q1 = 0;
nq1 = 0;


I've bolded the two lines which generate these errors.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf