Mini ATOM in HX8K breakout board FPGA

discussion of games, software, hardware & emulators relating to the Acorn Atom
janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Tue Aug 09, 2016 8:15 pm

I started a very simplistic Acorn Atom in FPGA for the HX8K breakout board.

The first attempt can be seen at: https://github.com/janrinze/miniatom

It's not working yet since I am still figuring out how to get the cpu interfaced properly.
This is not a copy of other Atom FPGA efforts but an attempt to make a very minimal working ATOM on a small FPGA.

The HX8K has 7680 4LUT's and 16 KB BRAM.
8 KB is used for ROM (BASIC and Kernel)
6 KB for video #8000-#9800
1 KB ZP
1 KB at #9800-#99FF which will hold the character set for the VGA

It is far from finished but I think sharing is the right thing to do at this point :-)

20160809_220002.jpg

20160809_220621.jpg


The left screen is attached to the HX8K board showing the video RAM contents which was setup from random data.
The vga connector in the Roland 2015 ATOM has been conveniently plugged into the HX8K board.

Best regards,
Jan Rinze.

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Tue Aug 09, 2016 8:41 pm

Hi Jan,

Great to see another complementary Atom FPGA effort.

I have a couple of initial thoughts.

1. As I'm sure you are aware, Arlet's core is unusual as the Addr, Dout and We outputs are not registered. This allows them to connect directly to FPGA block RAMs, without requiring wait states. You need will also need to create registered versions, for example to use in controlling the Din multiplexor. It looks like you have registered Addr (latched_cpu_addr), but not Dout and We.

What I think is currently incorrect is that IO_Out uses the unregistered version:

Code: Select all

   assign IO_out = PIO_out;
   assign PIO_out = (PIO_select==0) ? 0 :
                    (cpu_address[1:0]==2'b00) ? { graphics_mode, keyboard_row } :
                    (cpu_address[1:0]==2'b01) ? keyboard_input :
                    (cpu_address[1:0]==2'b10) ? { Port_C_high, Port_C_low} : 8'hFF;

Because your Din mux is ORing things, including IO_Out:

Code: Select all

   assign D_in = (latched_cpu_addr[15:13]==3'b100) ? VID_RAM_out : ( ZP_RAM_out | BASIC_ROM_out | MOS_ROM_out | IO_out );

this will pretty much cause the 6502 to crash immediately.

I would go through the code very carefully and review the use of the unregistered Addr, Dout and We signals.

I would expect them to generally only be used on the inputs of block RAMs.

2. Your VGA module

https://github.com/janrinze/miniatom/blob/master/vga.v

Is this a stop gap? I ask because it seems different to how the Atom currently does video.

To get an Atom to do anything sensible, you need to end up implementing the graphics modes of the 6847.

I would start with a 32x16 text mode, as that's what you will need to see any signs of life.

Dave

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Tue Aug 09, 2016 9:41 pm

Thanks Dave,

The CPU indeed is a bit difficult to interface properly and I will look into that.
Yes, the IO_out hasn't been latched and indeed will cause problems because of that. Well spotted, thanks!

The VGA module is really simplified to support CLEAR 4 mode only a.t.m. but work on a 32x16 character mode is on it's way as we speak.

It's a work in progress and your input is very welcome.

Thanks!
Jan Rinze.

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Wed Aug 10, 2016 8:49 pm

Progress..

I have been able to fix some issues and add the character set.

20160810_224434.jpg


I kind of like the white on blue :-)

The keyboard isn't attached yet and thus it gets false key presses.
Nice to see this working.

User avatar
roland
Posts: 2779
Joined: Thu Aug 29, 2013 8:29 pm
Location: Born (NL)
Contact:

Re: Mini ATOM in HX8K breakout board FPGA

Postby roland » Wed Aug 10, 2016 9:00 pm

I agree, white on blue is quite nice. It reminds me of Word Perfect BITD :lol:
You're doing a great job, I certainly wouldn't get this far ... too complex for me at the moment. Respect =D>

Would it be possible to connect a real Atom keyboard to this board?
256K + 6502 Inside
MAN WOMAN :shock:

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Wed Aug 10, 2016 9:14 pm

roland wrote:I agree, white on blue is quite nice. It reminds me of Word Perfect BITD :lol:
You're doing a great job, I certainly wouldn't get this far ... too complex for me at the moment. Respect =D>

Would it be possible to connect a real Atom keyboard to this board?


Thanks!

Yes, the pins for connecting the keyboard are assigned.
I am looking at how to get the pullups correct and then get the keyboard hooked up.
Using the keyboard connection from your design it should be working from the get-go.

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Wed Aug 10, 2016 9:42 pm

Yes, congratulations for getting past "First Boot" =D> =D> =D>

Do you have any plan for being able to load original software onto this?

Tape would be one possibility, but very slow.

Another possibility would be a tiny boot loader that downloaded data over the serial port, a bit like UPURS on the Beeb. This could be pre-loaded into RAM.

A third possibility would be a simple SD Card based file system, like SDDOS. How much of the device is used? If it's less than half, you might just have room for the 4K SDDOS ROM implemented as LUTs. But somehow I doubt this will be feasible.

Dave

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Wed Aug 10, 2016 10:54 pm

hoglet wrote:Yes, congratulations for getting past "First Boot" =D> =D> =D>

Do you have any plan for being able to load original software onto this?

Tape would be one possibility, but very slow.

Another possibility would be a tiny boot loader that downloaded data over the serial port, a bit like UPURS on the Beeb. This could be pre-loaded into RAM.

A third possibility would be a simple SD Card based file system, like SDDOS. How much of the device is used? If it's less than half, you might just have room for the 4K SDDOS ROM implemented as LUTs. But somehow I doubt this will be feasible.

Dave


Thanks!

The idea is to upload over the serial port if possible. There is a USB to serial onboard so it could be used for that.
For now I'll be happy if I can get the keyboard hooked up and try a few lines of BASIC :-)
I agree that SDcard would be really nice. Will take me more than a weekend I think ;-)

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Mon Aug 15, 2016 6:22 am

Keyboard, Textmode on VGA and Mode 4 graphics all work.
To be able to use logic tiles for ROM I had to lower the CPU frequency from 32.5 MHz to 16.25 MHz.
VGA 1024x768 requires 65 MHz but we can use 32.5 or 16.25 because 1024 = 4x 256 pixels.

so the max config for now is:
12 KB RAM , 8 KB ROM and a 6502 @ 16.25 MHz.
the fast config uses:
8 KB RAM , 8KB ROM and a 6502 @ 32.5 MHz. (nice snappy atom)

I should be able to get it running @ 21.66 MHz and have the VGA logic generate the clock for the CPU.
Another option is to introduce wait states for accessing the (now) slow ROM area.
Wait states seem to be a little more difficult than I thought with Arlet's 6502.

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Mon Aug 15, 2016 6:47 am

janrinze wrote:Wait states seem to be a little more difficult than I thought with Arlet's 6502.

There is a bug I think with using RDY to insert wait states.

I was able to fix it by changing the DIHOLD/DIMUX logic to:

Code: Select all

always @(posedge clk )
    if( RDY )
        DIHOLD <= DI;
 
assign DIMUX = ~RDY ? DIHOLD : DI;

If you try this, let me know how you get on.

Dave

User avatar
BigEd
Posts: 1393
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Mini ATOM in HX8K breakout board FPGA

Postby BigEd » Mon Aug 15, 2016 7:03 am

(Thanks Dave - as you'd previously noted privately, Arlet did suspect he had a problem. It would be good to get a fix tested and committed!)

paulb
Posts: 764
Joined: Mon Jan 20, 2014 9:02 pm

Re: Mini ATOM in HX8K breakout board FPGA

Postby paulb » Sat Sep 03, 2016 4:31 pm

It's nice to see this work being done, particularly as I was also interested in what the iCE40 series of products might be useful for. I mentioned this in the context of the Electron in another thread.

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Thu Oct 13, 2016 5:01 pm

It's been busy times here.
A while ago I ordered a nice FPGA shield called 'ICOBoard' for the RPi which has the same FPGA chip as the HX8K breakout board.
On top of that it has 1MB SRAM @ 100Mhz so I have continued development to support this board.

I added a connector on the board to plug in the keyboard connector from the Roland ATOM.
The VGA connector has move a little too,
In all the result is very nice.

#0000 - #AFFF is external SRAM.
VGA module still only supports text mode and mode 4. (needs some work to get more modes supported)
keyboard works very well.
ATOM runs at 32.5 MHz
I am working on verilog code to readout the eeprom and be able to have bank switched ROMS.
Since there isn't yet a way to read an SDcard loading and running programs is still not yet possible.

I'm pleased with the result, it is a smooth and solid ATOM now with much FPGA resources free for extra's.
Hope to post some pictures soon.

User avatar
BigEd
Posts: 1393
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: Mini ATOM in HX8K breakout board FPGA

Postby BigEd » Thu Oct 13, 2016 5:03 pm

Thanks for the update!

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Thu Oct 13, 2016 5:33 pm

It's possible to type in BASIC programs but many will agree that it's better to be able to load programs from SDcard.
I have tested some with typing a small program that does:

Code: Select all

10 CLEAR 4
20 !8=#12345678
30 MOVE(RND&255),(RND&255)
40 DRAW(RND&255),(RND&255)
50 GOTO 30


Nothing fancy but it is 32x faster than a 1 MHz ATOM :-)
And it has no 'snow' during plotting or screen memory access.

acory
Posts: 18
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England

Re: Mini ATOM in HX8K breakout board FPGA

Postby acory » Sat Oct 15, 2016 3:03 pm

I downloaded you code from Github. The intended target is a Papilio One (Spartan 3E).

There seem to be some missing files...

`include "BASIC_ROM.v"
`include "MOS_ROM.v"
`include "ram_areas.v"

I might be able to figure it out, but I wonder if you might release these too?

It looks like your design requires an external keyboard, which is nice as I have an old keyboard (oput of some terminal not PC keyboard) which would be perfect for this.

--Acory

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Sat Oct 15, 2016 4:37 pm

I think these files are generated when you run the python programs:
- genAtomRAM.py
- genAtomROM.py

Dave

acory
Posts: 18
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England

Re: Mini ATOM in HX8K breakout board FPGA

Postby acory » Sun Oct 16, 2016 12:21 am

Yep, saw the Python, but runnng them just gives errors. My Python knowledge is virtually zero, so although I attempted to fix, they still don't run. I do note that I have Python 2.7 installed and it looks like these need Python3, but I have no idea how to make these co-exist on a Windows machine, and another app needs the older 2.7 version.

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Sun Oct 16, 2016 8:34 am

acory wrote:Yep, saw the Python, but runnng them just gives errors. My Python knowledge is virtually zero, so although I attempted to fix, they still don't run. I do note that I have Python 2.7 installed and it looks like these need Python3, but I have no idea how to make these co-exist on a Windows machine, and another app needs the older 2.7 version.

I was able to run them using Python 2.7.6. Here are the three files they generate:
miniatom.zip
(12.7 KiB) Downloaded 19 times

Dave

acory
Posts: 18
Joined: Thu Feb 26, 2015 9:47 pm
Location: Cambridge, England

Re: Mini ATOM in HX8K breakout board FPGA

Postby acory » Tue Oct 18, 2016 10:26 pm

OK Dave, thanks again. I will give this another go. I am using Xilinx ISE, and it did flag a syntax error, so not sure what to make of this. Perhaps it compiles OK with the Altera software?

--Gary

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Tue Nov 01, 2016 1:50 am

I have not tried to use other tools than the IceStorm tools for verilog with this.
I thought ISE only does VHDL?

If there are implementation specific things in the verilog code then that might be because it was setup to use the IceStorm tools.

Indeed the python utilities are for Python 3 but 2.7.6 seems to work too. It is mainly because I want to be able to automatically convert ROM files to verilog. This keeps the source code clean and allows for different ROMs without much hassle.

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Tue Nov 01, 2016 7:03 am

janrinze wrote:I thought ISE only does VHDL?

It's happy with both, and you can even mix them in the same project.

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Sun Feb 05, 2017 9:30 am

It's been a while..

The weekends were packed and the new job is very demanding. Finally found some time to do a bit of FPGA coding.
The latest version uploaded on GIT now has Kernel, BASIC, FP and PCharme ROMs.

Memory is 0000-9FFF
P-Charme is A000-AFFF
BASIC is C000-CFFF
FP is D000-DFFF
KERNEL is F000-FFFF

no interface for loading programs or SD card yet. I am thinking about a serial port to upload files.
SPI interface with the RPi could be used for fast interchange.

There are some ideas brewing. The IcoBoard has 1MB 100MHz SRAM so that allows for a lot more.
Hope to find more time in the near future.

Best regards,
Jan Rinze.

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Sun Feb 05, 2017 11:12 am

Just a thought:

What if I simulate the MMC interface on the RPi and add AtomMMC ROM. That would allow me to access a directory on the RPi and use that as a virtual MMC.. Perhaps I could just modify the Atom Emulator to serve as a MMC server.

We'll see how far that will get me.

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Sun Feb 05, 2017 1:42 pm

If you have space in the FPGA for a small SPI master interface, you should be able to implement the SDDOS interface (the pre-cursor to AtoMMC).

See:
https://github.com/hoglet67/AtomFpga/bl ... e.vhd#L327
and
https://github.com/hoglet67/AtomFpga/bl ... PI/spi.vhd

There are builds of the Atom Software Archive for SDDOS.

Dave

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Sun Feb 05, 2017 6:04 pm

hoglet wrote:If you have space in the FPGA for a small SPI master interface, you should be able to implement the SDDOS interface (the pre-cursor to AtoMMC).

See:
https://github.com/hoglet67/AtomFpga/bl ... e.vhd#L327
and
https://github.com/hoglet67/AtomFpga/bl ... PI/spi.vhd

There are builds of the Atom Software Archive for SDDOS.

Dave


The serial EEPROM is also attached to SPI and I was already looking into getting the ROMs loaded from SPI to SRAM. Apparently that requires me to write a bootloader for the ATOM. not yet started on that. Technically the #E000 ROM should be loaded to get either AtomMMC or SDDOS working.
Dropping P-Charme and getting SDDOS working could be an option and go from there.
My main focus is to get as much RAM free in the FPGA to enable more sophisticated things in future. The external SRAM is shared between the VGA and the CPU. Having a separate (dual port) RAM available is tempting.

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Sat Sep 02, 2017 7:56 pm

So busy lately but found some time to work on this again.

Hoglet showed that it is possible to have a full Atom system on the Ice hx8k and I am very curious how to get SDDOS working.
I have the SDCard hooked up on the PMOD interface and trying to find out how it should interface with the ATOM

SDDOS version, connection and changes are a bit hard to figure out.

Jan Rinze.

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Sat Sep 02, 2017 8:39 pm

janrinze wrote:Hoglet showed that it is possible to have a full Atom system on the Ice hx8k and I am very curious how to get SDDOS working.
I have the SDCard hooked up on the PMOD interface and trying to find out how it should interface with the ATOM

SDDOS version, connection and changes are a bit hard to figure out.

I'm using a memory mapped SPI interface:
https://github.com/hoglet67/Ice40Atom/b ... /src/spi.v

This happens to be supported in SDDOS 2.x:
https://github.com/hoglet67/AtomFpga/tr ... ware/sdrom

Dave

janrinze
Posts: 52
Joined: Sat Mar 19, 2016 6:38 am

Re: Mini ATOM in HX8K breakout board FPGA

Postby janrinze » Sun Sep 03, 2017 10:10 pm

hoglet wrote:
janrinze wrote:Hoglet showed that it is possible to have a full Atom system on the Ice hx8k and I am very curious how to get SDDOS working.
I have the SDCard hooked up on the PMOD interface and trying to find out how it should interface with the ATOM

SDDOS version, connection and changes are a bit hard to figure out.

I'm using a memory mapped SPI interface:
https://github.com/hoglet67/Ice40Atom/b ... /src/spi.v

This happens to be supported in SDDOS 2.x:
https://github.com/hoglet67/AtomFpga/tr ... ware/sdrom

Dave


Running the SDcard with 30Mhz base clock and running the CPU at 15 MHz did the trick.
Very impressed with how easy I got the SDcard hooked up.

So nice to see this very minimal Atom run the menu of the disk image. shift-Break et voila!

User avatar
hoglet
Posts: 6369
Joined: Sat Oct 13, 2012 6:21 pm
Location: Bristol

Re: Mini ATOM in HX8K breakout board FPGA

Postby hoglet » Mon Sep 04, 2017 5:58 am

janrinze wrote:Running the SDcard with 30Mhz base clock and running the CPU at 15 MHz did the trick.
Very impressed with how easy I got the SDcard hooked up.

There are a couple of fixed delays to be aware of:

One here, while the byte is being transmitted:
https://github.com/hoglet67/AtomFpga/bl ... d.inc#L260

Another here, to ensure a slow clock for putting the card in SPI mode:
https://github.com/hoglet67/AtomFpga/bl ... pi.vhd#L55

What type of card are you using (micro, or fullsize) (low capacity or high capacity SDHC)?
janrinze wrote:So nice to see this very minimal Atom run the menu of the disk image. shift-Break et voila!

There is an updated version of the archive here:
https://github.com/hoglet67/AtomSoftwar ... e/releases
that improves compatibility with SDDOS2.

What address did you place the SPI interface at? Yesterday I moved it from B4xx to BCxx and had B4xx return zeros. This allows games like Manic Miner to work.

Some games (especially Kees's Retro Software ones) need a 6522. I ported one to verilog:
https://github.com/hoglet67/Ice40Atom/b ... rc/m6522.v

Anyway, well done for getting this working on miniatom. =D> =D> =D>

Dave


Return to “acorn atom”

Who is online

Users browsing this forum: Bing [Bot] and 3 guests