6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Sep 28, 2024 7:19 pm

All times are UTC




Post new topic Reply to topic  [ 213 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10, 11, 12 ... 15  Next
Author Message
 Post subject: Re: Breaking 6502 apart
PostPosted: Thu Nov 15, 2012 1:34 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
I already simulated some parts of random logic, but attracted by NES PPU :mrgreen:
Technically I understand whole random logic, just need to simulate it carefully step by step.

The reason I turned my attention to the PPU : I want to see some visuals :D Because you can effectively ignore most of custom NES CPU hardware and get some picture just from 6502+PPU bundle.

Here is my new circuit drawing style (transistors over dim background + highlighted regions), to demonstrate complexity of reverse engineering circuits I do :)
Image

I gonna restitch 6502 circuit by the same way.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Thu Nov 15, 2012 4:40 pm 
Offline

Joined: Sun Aug 26, 2012 1:10 am
Posts: 10
Location: France
Wow, that's a huge job you made org.
I really need to learn to "read" those schematics so that I can (someday) simulate those NES chips.
(would do it at logic level, with basic gates like OR/AND/NOR/NAND/NOT ...)


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Sun Nov 18, 2012 10:14 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
You still need to use transistors as transfer gates ("enablers/disablers" transistors) and for static latches, when MOSFET gate is in floating state, keeping its charge and locked by transfer gate. So you cant do it by basic gates only.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Wed Nov 21, 2012 2:46 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
Ignore my previos post, its possible :D

Static latches are actually D-triggers, but transfer gates are just tri-states:
http://en.wikipedia.org/wiki/Tri-state_logic

So, I'm gonna rearrange my transistor circuits into logic schematics :wink:

Restitch in progress :
Image

I decided to complete following parts:
- redraw PLA as NOR gates
- add missing address/data latch registers and pads (they are just regular and same as A0/D0, so do copy paste)
- add missing X/Y/S and PCH/PCL register bits
- add missing predecode logic lines ) (the are also same as PD0, I was lazy to draw it before)

After working on NES chips I have a fresh view on 6502 (especially on logic representation of transistor arrangements)

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Wed Nov 21, 2012 10:12 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
I'm again with you :)

Image
(clickable)

By removing interconnection wires I improved circuit readbility A LOT :)

Also I found and marked many interesting regions :)

Green-square latches are D-triggers, while yellow hexagons are RS-triggers. Random logic output has many of them, as well as flags, intruction register and cycle counter.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Wed Nov 21, 2012 10:25 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
> Green-square latches are D-triggers, while yellow hexagons are RS-triggers

That's visually very helpful!

A note on terminology: I'd say D-type [transparent] latch and RS-flop (or RS-flip-flop) - but I think often in the 6502 we see a master-slave flop rather than an RS. Having said that, I may be using the wrong terms, and other variations may exist!

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Wed Nov 21, 2012 10:41 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
That doesnt matter, since I understand it in different way )

Green one latches are SRAM-type memory (floating gate keep its charge) and yellow flip-flops are DRAM-type cells :)

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Wed Nov 21, 2012 10:46 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Is that the other way around? A DRAM cell is a single transistor, which is your green one (a D-type latch) whereas an SRAM has two re-inforcing inverters (usually) which is quite like the yellow one, except I think the yellow ones are clocked - certainly some of them are. In fact, you'll see a difference between the cells of the stack pointer S and the cells of the X and Y registers.

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Wed Nov 21, 2012 11:41 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
Yeah, thats otherwise )

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Nov 23, 2012 10:56 am 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
Todays speccy: random logic propagation map.

Image

It helps me to construct propagation priority table, to simulate different parts of random logic in correct order.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Nov 23, 2012 12:54 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10938
Location: England
Very nice - and the first time I've seen anything like this!

Does this mean you will also be able to tell us which paths are the longest? That would be after you've sorted out the program counter, I suppose.

(The longest in terms of gate count is not necessarily the slowest, of course.)

Cheers
Ed


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Nov 23, 2012 3:09 pm 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
If you look down to "driver" outputs, you may notice, that output lines are buffered by PHI2.

So, during PHI2 they are loaded by new values, and during PHI1 they are simultaneously outputs.

Also, most of flip-flops has PHI2 cutoff at the output, so those lines are effectively disabled.

But some lines has except (example is S/ADL), which has valid output during both PHI-stages.

I think, you can assume, that all lines are fired simultaneously and those weird undocumented opcode behavior depends on bus conflict issues.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Mon Nov 26, 2012 10:35 am 
Offline
User avatar

Joined: Fri Jun 22, 2012 7:39 am
Posts: 201
6502 simulation already done.

I have implemented almost all random logic in form of C code.

Please again ignore my previous post :), because I was wrong - random logic outputs are NOT using RS-like latches (I thought it was depletion-mode transistor but it was simply pullup ).
Image

As you already noticed, other RS-like formations (flags) are not really "flip/flops". They are just some transient circuits, which are "loaded" during PHI2 and "read-back" during PHI1. Such pass-through gates are need to eliminate unwanted read-back conflicts during "load".

Also I (possibly) found a glitch in program counter swapping (well, not actually glitch :) just some specific 6502 inner working). The reason is program counter put its value on ABH/ABL and loaded back in inverted form back again, to compensate swap, which occure every half-clock.

After I complete random logic, I show you opcode lifetime sequence (which "commands" random logic dispatch to bottom part per cycle).

Reset sequence is simply sort of BRK (its already known though), since instruction register is 0x00 after reset.

I found, that stack register keep its value in inverted form, so its value after power-up is NOT(0x00) = 0xFF (extended to 0x01FF). When stack register value is loaded from the bus (and written back), it get pre-inverted.

_________________
6502 addict


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Wed Nov 28, 2012 6:45 am 
Offline
User avatar

Joined: Sat Sep 29, 2012 10:15 pm
Posts: 899
This is really excellent.

_________________
In theory, there is no difference between theory and practice. In practice, there is. ...Jan van de Snepscheut


Top
 Profile  
Reply with quote  
 Post subject: Re: Breaking 6502 apart
PostPosted: Fri Nov 30, 2012 5:48 pm 
Offline

Joined: Sun Aug 26, 2012 1:10 am
Posts: 10
Location: France
Yep, wonderfull!
I really need to take the time to do my logic sim (realtime on CUDA), and try to simulate that one! :mrgreen:


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 213 posts ]  Go to page Previous  1 ... 6, 7, 8, 9, 10, 11, 12 ... 15  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 7 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: