Close
0%
0%

FPGA Cosmac ELF

A re-creation of a Cosmic ELF computer, Coded in SpinalHDL

Similar projects worth following
This is a re-creation of a Cosmac ELF computer, Coded in SpinalHDL.

The goal of this project is to end up with a cycle-accurate 1802 processor that can be used in FPGA designs easily.
When I start the project I was new to SpinalHDL but I had attempted in the past to write the same processor in VHDL. However, language complexity and the sheer amount of code and time needed to write and debug that project ended the work on it.

I have put a lot of the details about the project in the Github readme.

  • Added the Pixie chip CDP1861

    Winston Lowe01/22/2020 at 09:27 3 comments

    Today I finished writing and testing the CDP1861 Video Display Controller.  It was a addon for the Cosmac ELF, and was also used in the Cosmac VIP, and the RCA Studio II game console. It has a resolution of 64x128, with software you can change it by redrawing lines which can give you 64x64, and 64x32.

    I was able to simulate both the 1802 CPU and 1861 VDC.  and also have the CPU running the driver software for the VDC that help a lot with finale testing.

    But most of the testing was done while feeding in simulated signals.

    The chip are pretty simple, It uses two counters, one for counting lines(Line Counter) and the other for counting machine cycles (MC Counter).

    • MC Counter is incremented by TPA(Rising Edge) and by TPB(Falling Edge) and holds a max count of 27 and overflows back to 0, which increments the Line Counter by 1.
    • There are 14 machine cycle per line, 8 of which are DMA, and the other 6 available for CPU to run instructions.
    • The Line Counter holds a max count of 262 and overflows back to 0. This gives a total of 524 lines, or 262 lines per NTSC field.
    • Base off the counters, states are generated for the CPU flags Interrupt, DMA Out, and EFX.  Along with the V Sync and H Sync signals, that get XOR together to make up the Comp Sync.
    • The VDC relies on the CPU being in the right cycle when it starts the DMA transfer. If the state is not correct it will hold the MC Counter for one machine cycle, allowing the VDC to sync with the CPU.
    • A shift register is user to shift out each pixel at a clock frequency of 1.764Mhz. it's also inverted from the same clock used by the CPU.
    • Disp Off and Disp On allow for disabling and enabling the Interrupt, DMA Out, and EFX flags.

    This is a picture of the video output from the 1861 VDC running on my FPGA, using the classic test program that was apart of the article on adding it to the Cosmac Elf in the Popular Electronics magazine. You can also see a video of the output on my instagram

  • Finished Interrupt Handling

    Winston Lowe01/18/2020 at 10:46 0 comments

    The 1802 CPU now supports Interrupt handling.

    Added support for reading the serial RX, it also sets the interrupt flag when it's FIFO has data. You can use INP N1 to get bytes from the FIFO and check if it has data with BN2.

    I also have the write button set the interrupt flag, and using BN4 you can check the state of it.

    Here's a picture of the output from a terminal, of a program I made to test the functionality. 

    When you press the Write button it send you the current byte toggled into the switches in hex. "Button: 00"

    And when you type on the terminal it stores the byte in a string buffer and when you hit enter it sends that buffer back to you. "Got: testing"

View all 2 project logs

Enjoy this project?

Share

Discussions

Kiran kanchi wrote 01/20/2020 at 17:26 point

which is your FPGA board?

  Are you sure? yes | no

Kiran kanchi wrote 01/20/2020 at 17:54 point

Mojo ?

  Are you sure? yes | no

Winston Lowe wrote 01/21/2020 at 05:20 point

Yes it's a Mojo v3. and the only mods are a DFU and Reset button for the MCU, and I changed out the 8Mhz crystal for a 16Mhz one for faster serial communication between the MCU and FPGA.

  Are you sure? yes | no

ostropest wrote 01/18/2020 at 07:58 point

very nice

  Are you sure? yes | no

Winston Lowe wrote 01/18/2020 at 10:25 point

Thanks

  Are you sure? yes | no

Dan Julio wrote 01/17/2020 at 18:20 point

Very nice Winston.  I had the $99 Quest Elf in high school.  It was my first computer as well and I've always had a soft spot in my heart for the slightly quirky 1802.  Now you just have to add the 1861! :-)

  Are you sure? yes | no

Winston Lowe wrote 01/17/2020 at 21:58 point

I'm think about make the 1861 at some point, now that I have the processor.

  Are you sure? yes | no

Dan Maloney wrote 01/16/2020 at 19:46 point

Pretty cool. I had an RCA COSMAC VIP in high school. It was my first real computer. This makes me think about using my Superconference FPGA badge to make a VIP of my own.

  Are you sure? yes | no

Winston Lowe wrote 01/17/2020 at 21:57 point

That would be super cool

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates