Who said recursive acronyms are getting old?
I started by writing a Python script to test some GAL equations, and ended up building a whole tool that can "emulate" the GAL, so I decided to share it here in case someone finds this tool helpful.
How does it work? You give Ginger a .PLD file and a .VEC file, and it calculates the equations.
Vector files look like this:
Code:
@ RAM/ROM test
< A19 A18 A17 A16 /RD /WR /M
> /RAM /ROM
0000 11 1 # Disable memory
? /RAM=1 /ROM=1
0000 11 0 # RAM starts @ 0x00000...
? /RAM=0 /ROM=1
0001 11 0
0010 11 0
0011 11 0
0100 11 0
0101 11 0
0110 11 0
0111 11 0 # ...and ends @ 0x7FFFF
1000 11 0 # (0x80000-0xEFFFF unused)
? /RAM=1 /ROM=1
1001 11 0
1010 11 0
1011 11 0
1100 11 0
1101 11 0
1110 11 0
1111 11 0 # ROM @ 0xF0000-0xFFFFF
? /RAM=1 /ROM=0
@ I/O ports test
< A8 /RD /WR /M
> /IN /OUT /IO
0 11 1
0 01 1 # Input port 0x000
? /IN=0 /OUT=1 /IO=1
0 10 1 # Output port 0x000
? /IN=1 /OUT=0 /IO=1
1 01 1 # Input port 0x100
? /IN=1 /OUT=1 /IO=0
1 10 1 # Output port 0x100
? /IN=1 /OUT=1 /IO=0
@ Clock test
< RST
> Q0 Q1 TMCK
1
# Q1 is 66% duty-cycle clock, TMCK is Q1 / 2
0 # Enable clock
0
0
0
0
0
0
1 # Trigger reset
0
0
0
0
0
0
Lines that start with "@" are test case names.
Lines that start with "<" list signals that you want to input (and each following line needs to set those signals high or low).
Lines that start with ">" list signals that you want to display after every step.
Lines that start with ? are test case assertions, they should contain key-value pairs for your tests.
Comments start with "#". If a comment is added after a vector, it will be printed during run.
Empty lines are ignored.
All other lines are vectors.
Output:
Attachment:
example.jpg [ 180.5 KiB | Viewed 3117 times ]
Here's the source code along with some examples:
https://github.com/and3rson/ginger(Why isn't Ginger an emulator? Because it doesn't emulate a GAL: it merely evaluates the equations.)
EDIT: Ginger now supports tri-state outputs as well as test case assertions. I've updated an example above. If the test fails, Ginger will exit with non-zero code.
_________________
/Andrew
deck65 - 6502 slab with screen and keyboard |
ПК-88 - SBC based on KM1810VM88 (Ukrainian i8088 clone) |
leo80 - simple Z80 SBC
nice65 - 6502 assembly linter |
My parts, footprints & 3D models for KiCad/FreeCAD