6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 9:18 pm

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sat Oct 07, 2023 11:16 pm 
Offline
User avatar

Joined: Fri Feb 17, 2023 11:59 pm
Posts: 163
Location: Lviv, Ukraine
Who said recursive acronyms are getting old? :lol:

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
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


Last edited by and3rson on Sun Oct 08, 2023 2:03 pm, edited 3 times in total.

Top
 Profile  
Reply with quote  
PostPosted: Sun Oct 08, 2023 7:06 am 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
I can see how that could be handy - thanks for sharing!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: