5 ms·
Verilog 6502 (2016)
- JdeBP 8y agoThe RTL Verilog that the article talks about can be found at http://ladybug.xs4all.nl/arlet/fpga/6502/ http://ladybug.xs4all.nl/arlet/fpga/6502/ . I wonder whether anyone tackled the RTL for a complete 65816 . (Daniel Wallner's doco for T65 says that it isn't complete.)
- phaedrus 8y agoThis page gives the first low-level explanation I've ever found for why the 6502 requires a two-phase clock.
- brian-armstrong 8y agoYeah, pretty interesting. And I remember the TA in my digital logic lab slapping our wrists if we tried to use latches like that.
- analognoise 8y agoAn FPGA is not an ASIC. Latches are totally valid design choices and they take less silicon area if doing a custom layout. The thing is that an FPGA has a lot of time/money spent on getting the clock network and tooling for that clock network correct in a flopped digital style, and you obviate that by trying to force latches.
- FullyFunctional 8y agoI'm not a EE but four transistors for a D-FF is hard to beat. Z-80 other contemporaries also used dual phase clocks. Obviously the downsides outweighed the transistor overhead eventually. There was a "modern" instantiation of this by Intrinsity (got acquired by Apple) whose "FAST-14" [1] dynamic logic used a four-phase clock. That was pretty cool and they had some (for the time) insanely fast products. I wonder if that logic style would have been feasible in the 6502's time frame. [1] https://en.wikichip.org/wiki/intrinsity/fast14 https://en.wikichip.org/wiki/intrinsity/fast14
- GeorgeTirebiter 8y agoThe Z-80 has a single-phase clock, which was one of its selling features. https://en.wikipedia.org/wiki/Zilog_Z80 https://en.wikipedia.org/wiki/Zilog_Z80 The 8008 and 8080 use dual-phase clocks.
- FullyFunctional 8y agoD'oh. Thanks for the correction. I was indeed thinking of 8080.
- sehugg 8y agoInternal busses are precharged to $FF during Φ2 and then connected to one of the ALU input latches in the immediately following Φ1, during which the nodes are floating. This forces $FF onto the ALU input by swamping it with charge from physically larger nodes. A register (X, Y, SP or PCH) is routed to the other ALU input and decremented by adding $FF (-1). Temporarily turning your bus into a DRAM to stuff a value into an ALU == living your best life
- urmish 8y agoI had never heard of this chip. Any good resource to understand this? I am familiar (or was at one point) with 8085/86 architecture.
- pvg 8y agoIt's one of the famous 8-bitters (possibly the famousest). The Wikipedia page is probably a decent start, for overwhelmingly way too much there is 6502.org.
- dbcurtis 8y agoMOS Technology made it popular by pricing it cheaply and giving engineering samples to young, bearded hippies like the Woz. It was cheap and accessible when the other microcontrollers were not yet so much. It is OK to program, not exactly unpleasant, but it is quirky. I did a linker for the Apple II in about 4k lines of assembly code, because their assembler produced a decent symbol dictionary but didn't come with a linker. That was the largest single assembly module I did for the 6502. I also worked on a compiler for something like B, but never finished. Code generation was just too wonky. Hand written 6502 is OK once you know the idioms.
- mwcampbell 8y ago> Code generation was just too wonky. What do you mean? Is code generation for the 6502 unusually difficult, even compared to other 8-bit processors (e.g. 8080/Z80)? I'm sure code generation for an 8-bit processor is difficult compared to a 32-bit processor.
- pvg 8y agoThe Z80 is definitely a substantially fancier ISA. There were many more Z80-targeted compilers.
- 0xcde4c3db 8y agoIt's been a while since I've read about this, and I'm far from a 6502 expert, but I think the biggest issues are: 1) There's not a cheap, straightforward way to get a conventional frame pointer (i.e. indexable pointer to local variables on the stack). I imagine one could do something with the indexed zero-page modes, but I'm not sure how well that works in practice. 2) None of the registers are large enough to hold a full memory address, which considerably complicates any pointer arithmetic beyond increment/decrement. I'm even less familiar with Z80 than I am with 6502, but I gather that the IX and IY index registers were added to it to address similar limitations in the 8080 architecture.