6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 8:21 pm

All times are UTC




Post new topic Reply to topic  [ 176 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 12  Next
Author Message
PostPosted: Fri Dec 20, 2019 10:57 pm 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
I have been fixing some errors but there is still a long way to go I'm afraid. It takes the simulation up to 10 minutes to reach the point of interest, and looking at the log has its limits. Is there a way to split the test into smaller pieces, or to begin execution at a later time? I mean, has anyone done it before? Or any recommendations in order to do this myself. It would make debugging easier.
Juan


Top
 Profile  
Reply with quote  
PostPosted: Sat Dec 21, 2019 1:31 am 
Offline

Joined: Sat Jun 04, 2016 10:22 pm
Posts: 483
Location: Australia
What if you added a way to save the state of the simulated machine(registers at the very least, if not memory) to a file, and restore it? That would mean you only have to run it for the 10 minutes once, and then you have what's effectively a save point.


Top
 Profile  
Reply with quote  
PostPosted: Sat Dec 21, 2019 3:30 am 
Offline

Joined: Fri Apr 15, 2016 1:03 am
Posts: 140
In the Dormann 6502 test suite:

I think you could insert a jmp just before (or overlaying) ";testing relative addressing with BEQ" to jump to the section you're concentrating on. I think many of the test sections don't need the results of previous sections.

I assume you're using "load_data_direct = 1" so you don't trace through the loop to copy data.


Top
 Profile  
Reply with quote  
PostPosted: Mon Dec 23, 2019 1:58 pm 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
DerTrueForce wrote:
What if you added a way to save the state of the simulated machine(registers at the very least, if not memory) to a file, and restore it? That would mean you only have to run it for the 10 minutes once, and then you have what's effectively a save point.


I wish I could do that easily. The problem is this is a simulation in Logisim, not something that I've coded myself from scratch, if that makes any sense.
I can save registers to a log, but they have to be manually restored, and mouse macros help only to a extent. It would take me more time to set up than what it saves.

leepivonka wrote:
In the Dormann 6502 test suite:

I think you could insert a jmp just before (or overlaying) ";testing relative addressing with BEQ" to jump to the section you're concentrating on. I think many of the test sections don't need the results of previous sections.

I assume you're using "load_data_direct = 1" so you don't trace through the loop to copy data.


I am looking into that. It is not clear at first glance which tests influence each other but we'll see. I am indeed using that option.

EDIT: Just inserted a jump at address $400, so it jumps to the specific test at hand. Seems to work fine, it gets stuck on the same location as before (now in a matter of seconds). Also tried to jump to a earlier location and it worked fine too.

Thanks, Juan


Top
 Profile  
Reply with quote  
PostPosted: Tue Dec 24, 2019 2:24 pm 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
I fixed the fault, and left it executing the full binary add/subtract test for six or seven hours, and I predict it would take three to four days to complete. I'm pretty confident everything is right at the moment, if a large amount of operands work with add/subtract, the rest will surely do. I think(?) this is one of the final tests, as I'm not testing decimal mode, followed only by the RAM integrity test, which does not make sense to run without having executed all previous tests. So, until I can set up a dedicated computer to work on this full time, I'll start designing the hardware.
Any ideas/thoughts are welcome.
Juan


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 08, 2020 11:02 pm 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
After 6 days, the simulation has finally passed the full test, so it's working correctly. I also got the Woz monitor running.
Next step is designing the actual hardware, which I'm already working on. Chip count is clocking in around 50 or so, but I hope to optimize out some of them. I intend to fit it in four or five perfboard cards using wire-wrap for connections. We'll see.
In the meantime, I'll see if I can get some sort of BASIC working.
Juan


Attachments:
Monitor.JPG
Monitor.JPG [ 42.86 KiB | Viewed 3292 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 16, 2020 9:21 pm 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
A couple things:
I have published my software and simulation here so anyone can have a look. I will be updating it as I progress.
https://github.com/Juan-Gg/microcoded6502

And also got hold of an EEPROM programmer and started doing a couple tests on actual hardware. So far the EEPROM based ALU seems to work fine.

Seems that it can fit in three cards, although it's going to be a pretty tight layout. I may have to spread it over more cards, but as is, grouped by functional blocks, seems simpler to me. The cards I am planning to build are the following:

-Interface card: Address registers, program counter, tris-state data bus buffers, reset and interrupt logic...
-Alu & Status register
-RX, RY, ACC, IR, microcode counter.

I intend to wire wrap header pins soldered right next to IC sockets (wire wrap sockets are expensive), but not sure how it's going to go space-wise.
Juan


Attachments:
ALU card.JPG
ALU card.JPG [ 105.09 KiB | Viewed 3261 times ]
Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 17, 2020 7:26 pm 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
Attached is a timing diagram of the current setup. Control signals change on the falling edge of the clock, and register transfers, reads and writes happen on the rising edge. I have no Phi 1 and Phi 2, so it's quite different than the original 6502.
I am not aiming at full compatibility and I'll be designing all peripherals. Should I change the way its implemented? Any suggestions are welcome.
Juan


Attachments:
Read_write_timing.jpg
Read_write_timing.jpg [ 140.11 KiB | Viewed 3242 times ]


Last edited by JuanGg on Fri Jan 17, 2020 8:48 pm, edited 1 time in total.
Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 17, 2020 8:15 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Very important:  The 6502's cycle starts with the falling clock edge, then the processor sets up the address and R/W, well ahead of the rising edge of Φ2.  Whether reading or writing, the data must be valid before the fall of Φ2 at the end of the cycle, with enough setup time for the data to be latched in at the falling edge.  The timing diagrams in the data sheets have all the details.

One cycle:
Code:
          _________
\________/         \

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 17, 2020 9:24 pm 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
GARTHWILSON wrote:
Very important: The 6502's cycle starts with the falling clock edge, then the processor sets up the address and R/W, well ahead of the rising edge of Φ2. Whether reading or writing, the data must be valid before the fall of Φ2 at the end of the cycle, with enough setup time for the data to be latched in at the falling edge. The timing diagrams in the data sheets have all the details.

One cycle:
Code:
          _________
\________/         \

Thanks. I have taken a look at a couple datasheets, both for the 6502 and for RAM and ROM. So this is what I've come up with, attached is the updated diagram.
In my particular implementation control signals (including R/W) change on the falling edge of Φ2, and data is latched on the rising edge.

The write cycle starts at point D, on the falling edge of Φ2. Addresses have been set on the preceding rising edge, so they should be valid by this point. R/W changes shortly after, so does the data, which is valid through E and to the falling edge of Φ2 in F, when it's latched by for example RAM.

The read cycle starts in A, with valid addresses and data set beforehand. The difference here is that data is read by the CPU on the rising edge of Φ2, on B instead of C. It has to be this way, as I'm latching data on the rising edge.
I suppose this would work, there would be plenty of setup time, unless the peripheral waits to the rising edge of Φ2 to output the data that is.
Juan


Attachments:
RWTiming2 .jpeg
RWTiming2 .jpeg [ 136.16 KiB | Viewed 3232 times ]
Top
 Profile  
Reply with quote  
PostPosted: Fri Jan 17, 2020 9:38 pm 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Address must never change while Φ2 is high.

Quote:
unless the peripheral waits to the rising edge of Φ2 to output the data that is.

The peripheral will not even begin to output data until after the rise of Φ2 (except possibly in the case of ROM, depending on the glue logic); but it will have it ready ahead of the fall of Φ2.

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Sat Jan 18, 2020 1:21 pm 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
I think I have gotten it right this time. I have added a couple flip flops and changed the microcode so signals change on the appropriate times. I had the phases swapped. Now it matches the timing diagram on WDC's datasheet. (I find this one easier to read: https://www.princeton.edu/~mae412/HANDOUTS/timing.bmp)
Juan


Attachments:
RWTiming3.jpeg
RWTiming3.jpeg [ 100.23 KiB | Viewed 3214 times ]
Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 19, 2020 10:23 am 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
Rev A schematics are in! I'm sure there are plenty of typos and possible optimizations. I hope I can catch some of that during initial prototyping. Also attached a general block diagram. My design is horribly inefficient, but so far it works (on Logisim) and speed is not a requirement. I hope to make a functioning computer out of it. We'll see.
Juan

EDIT: Updated block diagram


Attachments:
Block diagram2.JPG
Block diagram2.JPG [ 111.3 KiB | Viewed 3157 times ]
REGISTERS CARD.pdf [257.61 KiB]
Downloaded 81 times
ALU CARD.pdf [342.34 KiB]
Downloaded 86 times
INTERFACE CARD.pdf [385.81 KiB]
Downloaded 77 times


Last edited by JuanGg on Mon Jan 20, 2020 10:20 am, edited 1 time in total.
Top
 Profile  
Reply with quote  
PostPosted: Sun Jan 19, 2020 11:00 am 
Online
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
A milestone - well done!

I think sometimes it might help if you have a block diagram which shows the clock boundaries - perhaps something to consider.


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 20, 2020 10:23 am 
Offline
User avatar

Joined: Mon Nov 04, 2019 4:53 pm
Posts: 103
Location: Spain
Thanks! Updated the block diagram. Not sure if this is what you meant.
Juan


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 176 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 12  Next

All times are UTC


Who is online

Users browsing this forum: BigEd and 12 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: