FPGA programmers out there?

https://github.com/MiSTer-devel/Main_MiSTer/wiki

Moderators: Mug UK, Zorro 2, Greenious, spiny, Sorgelig, Moderator Team

jemismyname
Atari freak
Atari freak
Posts: 73
Joined: Wed Feb 27, 2019 8:25 pm

FPGA programmers out there?

Postby jemismyname » Mon Mar 04, 2019 2:14 am

I wonder, since everybody in this group, pretty much, has a nice quality student-oriented FPGA development board, has anybody gotten into FPGA programming just from being a MISTer user?

I'm thinking of diving in... Maybe to make a weird audio synthesizer or something?

I would ultimately like to get good enough to program some MISTer cores, but i don't have any arcade hardware to play with... I want to make a Rygar core, for some reason...

does anyone out there like/remember Rygar?

User avatar
kitrinx
Captain Atari
Captain Atari
Posts: 168
Joined: Wed Sep 26, 2018 6:03 am

Re: FPGA programmers out there?

Postby kitrinx » Mon Mar 04, 2019 2:21 am

I am a software engineer, but I learned to write HDL just for MiSTer.

And I played Rygar for NES quite a bit, back in the day. Arcade was much better though.

alanswx
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 142
Joined: Sat Nov 25, 2017 4:34 pm

Re: FPGA programmers out there?

Postby alanswx » Mon Mar 04, 2019 4:26 pm

I am also a software person who picked up Verilog for MiSTer. It has a very steep learning curve, and it is hard to debug. I started by reading this book:
https://robo-tronix.weebly.com/uploads/2/3/2/1/23219916/veriloghdlsamirpalnitkar.pdf and I installed iverilog on my mac, and just wrote a couple of hello world programs.

Also, you can take a look at centipede and food fight from my repo. They have been updated to use verilator and SDL2 so you can write a simulation, debug it, and view it on the pc. See:
https://github.com/alanswx/arcade-centipede/

A lot of people like VHDL instead of verilog, or system verilog, here is a book:
http://ebook.pldworld.com/_eBook/FPGA%EF%BC%8FHDL/-Eng-/Verilog%20HDL%20Synthesis.%20A%20Practical%20Primet%20(Bhasker).pdf

I don't believe we can simulate VHDL using verilator, I haven't dug through and found an open source tool chain that will allow us to do that yet.

I don't believe you need a board to build the Rygar, you should look through the schematics, and MAME and that should be enough to build it:
http://www.jammarcade.net/files/Schematics/Arcade/Rygar.pdf

flain
Atariator
Atariator
Posts: 27
Joined: Sat Nov 03, 2018 6:21 am

Re: FPGA programmers out there?

Postby flain » Mon Mar 04, 2019 10:00 pm

i did logic circuits as a course like 15 years ago before i started a career, with mister i brushed up on some of that again

some good videos for revision are the nandland ones on youtube

EisernSchild
Atarian
Atarian
Posts: 5
Joined: Sat Nov 25, 2017 10:00 pm

Re: FPGA programmers out there?

Postby EisernSchild » Sun Mar 17, 2019 7:54 am

I'm a long year gpu programmer (c++, hlsl/glsl) and came to HDL via the MiSTer project. First i started on the Taito "Qix" hardware but wasn't able (until now) to synchronize the two main CPUs. Then i continued with "Tutankham" - which has very, very simple hardware - and had success, the game should be finished soon.

I do not have any arcade hardware either, i am using the MAME source code and the MAME debugger to find out what the game hardware actually does. And i do output in-game cpu values (like program counter and registers) on (MiSTer) screen in hex format to compare this to the simultanous running MAME debugger (on my PC) to find out what is going wrong in case.

About "RYGAR" : This one has the same hardware as "Silkworm" and "Gemini Wing". It has two main CPUs, from "Qix" i know that it is hard to syncronize them. And there is not much documentation out there about the actual hardware, so i would recommend to start with a much simpler game.

Get into the code from the (most simple) MiSTer arcade games and compare their doing with the MAME debugger for startup.

hyiger
Atarian
Atarian
Posts: 4
Joined: Sun Mar 17, 2019 5:18 pm

Re: FPGA programmers out there?

Postby hyiger » Sun Mar 17, 2019 7:22 pm

Working with a FPGA is not the same as writing software for a CPU. First you are not "programming" in the traditional sense, you are using a HDL (hardware description language) such as VHDL or Verilog to design and wire up a circuit. With modern FPGA's from Xilinx or Intel (formerly Altera) you can develop parts of the core in C/C++ or Python but then this ultimately gets synthesized into a hardware circuit. Also, the hardware circuits that are generated by the synthesizer (analogous to a compiler for CPU programming languages) are inherently parallel and very hard to debug without creating circuit simulations or using a logic analyzer. Therefore, I would say the learning curve is pretty steep unless you already have a background in digital design. That being said, with modern tooling it's a lot easier to learn today than it was say 10-15 years ago.

Personally I use VHDL since it is more strongly typed than Verilog (for example Pascal/Ada versus C/C++) and I find I understand it better since Verilog can be quite terse. However, it helps to know both. For VHDL I would recommend starting with: FreeRange VHDL then even though it's slightly dated I would recommend: FPGA Prototyping by VHDL examples He also has the same book for Verilog.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5099
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: FPGA programmers out there?

Postby Sorgelig » Sun Mar 17, 2019 8:14 pm

Both languages have their strong and weak points.
I like Verilog because all types are interchangeable. In VHDL for example boolean and logic values are completely different types which requires long and cluttered expressions. But sometimes VHDL is better in some circumstances.

hyiger
Atarian
Atarian
Posts: 4
Joined: Sun Mar 17, 2019 5:18 pm

Re: FPGA programmers out there?

Postby hyiger » Sun Mar 17, 2019 9:04 pm

It really comes down to personal preference, in the end both languages accomplish the same thing. Verilog seems to be more common in the US and VHDL elsewhere. When I first got involved in FPGAs I started off using Verilog but somehow kept gravitating toward VHDL since there seemed to be a lot more hidden "magic" with Verilog and I could visualize the circuit better reading VHDL. Now I use VHDL almost exclusively. I think the reason is that on the CPU side I used to do a lot of development in C++ but now use Java and C# and prefer the extra levels of type checking and verboseness of the later. Personally I think VHDL hurts the brain a lot less... But again it comes down to: 6502 or Z80, Emacs or Vi, Coke or Pepsi, etc.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5099
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: FPGA programmers out there?

Postby Sorgelig » Mon Mar 18, 2019 4:57 am

hyiger wrote:6502 or Z80

Although i've used some i8080 in my childhood, the major time and my initial grow as a software developer was based on PDP11 assembler. And at that time assembler was the only language available for home computers (i don't count the basic and other mostly useless languages). And with PDP11 you could write even in machine codes without any tables around you as its code structure is like RISC with hard defined bit structure.
So for me both 6502 and Z80 were looked as utter rubbish :mrgreen: Sorry 6502/Z80 fans :)
I couldn't understand how it's possible to write any assembler program with such strange limited assembler without choice of addressing methods. Z80 even uses backward order of operands (what a perversion!)
Sure, a lot of time passed since that time. Today it's not a problem for me to write for any CPU. Especially you don't need to remember the machine codes today, and can use PC based compilers.

jemismyname
Atari freak
Atari freak
Posts: 73
Joined: Wed Feb 27, 2019 8:25 pm

Re: FPGA programmers out there?

Postby jemismyname » Mon Mar 18, 2019 7:19 am

Thanks for all of the good answers. I know a good bit of digital and analog hardware design stuff.. and i know at least some theory of cpu design and implementation.

I even took a VHDL class 15 years ago. I passed the class, but we mostly just did dumb stuff with switches and blinky lights and 7 segment displays... it's a whole different world now.

From what people have told me recenlty, i think i should try verilog instead... not like i remember VHDL anyway.

I'll check out some of the simple arcade cores for examples, but i think i'll try Rygar anyway. I've always had an interest in last-century multi-CPU gaming hardware. Even if it turns out to be way over my head, I'll just make something glitchcore AF, and pretend that's what i meant to do.

After that: Sega Saturn. lol

jemismyname
Atari freak
Atari freak
Posts: 73
Joined: Wed Feb 27, 2019 8:25 pm

Re: FPGA programmers out there?

Postby jemismyname » Mon Mar 18, 2019 7:23 am

hyiger wrote:Emacs or Vi


i prefer nano, but i'm a weenie

jemismyname
Atari freak
Atari freak
Posts: 73
Joined: Wed Feb 27, 2019 8:25 pm

Re: FPGA programmers out there?

Postby jemismyname » Mon Mar 18, 2019 7:57 am

alanswx wrote:I don't believe you need a board to build the Rygar, you should look through the schematics, and MAME and that should be enough to build it:
http://www.jammarcade.net/files/Schematics/Arcade/Rygar.pdf


this link is dead sad

alanswx
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 142
Joined: Sat Nov 25, 2017 4:34 pm

Re: FPGA programmers out there?

Postby alanswx » Mon Mar 18, 2019 11:04 pm

jemismyname wrote:
alanswx wrote:I don't believe you need a board to build the Rygar, you should look through the schematics, and MAME and that should be enough to build it:
http://www.jammarcade.net/files/Schematics/Arcade/Rygar.pdf


this link is dead sad
You do not have the required permissions to view the files attached to this post.

hyiger
Atarian
Atarian
Posts: 4
Joined: Sun Mar 17, 2019 5:18 pm

Re: FPGA programmers out there?

Postby hyiger » Sat Mar 23, 2019 5:11 pm

Sorgelig wrote:I couldn't understand how it's possible to write any assembler program with such strange limited assembler without choice of addressing methods. Z80 even uses backward order of operands (what a perversion!)
Sure, a lot of time passed since that time. Today it's not a problem for me to write for any CPU. Especially you don't need to remember the machine codes today, and can use PC based compilers.


Well the Z80 is/was binary compatible with the 8080 so inherited a lot of weirdness from Intel. I had a TRS-80 Model I with 4K of RAM which wasn't even enough RAM to fit an assembler. I quickly outgrew Tiny Basic and was punching in Z80 machine code with hexadecimal keypad I had wired into my TRS-80 keyboard. 40 years later I still remember a lot of the op codes. I've recently built some Z80 based SBC's and have gotten back into Z80 ASM. Definitely a lot harder than JAVA or C# but a lot more fun.

With the 6502 vs Z80 it's a matter of modified Harvard architecture vs von Neumann. Also mpu's back then generally had to be CISC (with the exception of the PDP-8 which like it's version number only had 8 op codes...)

User avatar
nullobject
Retro freak
Retro freak
Posts: 14
Joined: Mon Feb 27, 2017 3:58 am
Contact:

Re: FPGA programmers out there?

Postby nullobject » Tue Jun 18, 2019 10:20 am

I just stumbled across this thread.

How funny, I'm planning on implementing a Rygar core for MiSTer myself :lol:

Since I'm new to all this, phase one of the project was to write an emulator to learn as much as I could about how the original arcade hardware works. Reading the MAME source code wasn't much help to me, since it's all so abstract. I ended up studying the Rygar schematics and writing an emulator from scratch.

I just finished getting it working (it doesn't have any sound yet), you can actually run in your browser: https://rygar.joshbassett.info/
My emulator source code is on GitHub: https://github.com/nullobject/rygar

Phase two of my project is to obviously take what I learned and try to write a core for MiSTer. It's probably going to take me a while since there's a fair learning curve to all this, but Rygar was one of my favourite games as a kid and I'm going to write this core even if it kills me :wink:

alanswx
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 142
Joined: Sat Nov 25, 2017 4:34 pm

Re: FPGA programmers out there?

Postby alanswx » Tue Jun 18, 2019 1:08 pm

nullobject wrote:I just stumbled across this thread.

How funny, I'm planning on implementing a Rygar core for MiSTer myself :lol:

Since I'm new to all this, phase one of the project was to write an emulator to learn as much as I could about how the original arcade hardware works. Reading the MAME source code wasn't much help to me, since it's all so abstract. I ended up studying the Rygar schematics and writing an emulator from scratch.

I just finished getting it working (it doesn't have any sound yet), you can actually run in your browser: https://rygar.joshbassett.info/
My emulator source code is on GitHub: https://github.com/nullobject/rygar

Phase two of my project is to obviously take what I learned and try to write a core for MiSTer. It's probably going to take me a while since there's a fair learning curve to all this, but Rygar was one of my favourite games as a kid and I'm going to write this core even if it kills me :wink:


Let us know how we can help! There is a steep learning curve to the FPGA development. But don’t despair you can move up it quickly.

jemismyname
Atari freak
Atari freak
Posts: 73
Joined: Wed Feb 27, 2019 8:25 pm

Re: FPGA programmers out there?

Postby jemismyname » Wed Jun 19, 2019 3:47 am

hip hip hoooray!

I keep meaning to dive into FPGA programming... but the weather is so nice i keep spending all day outside.

can i fpga hack in the park?

I need to create a mobile hacker station!

if nullobject is doing rygar, maybe i should set my sights on Truxton/Truxton 2, instead...

Anybody have thoughts on those 2?

User avatar
Newsdee
Atari God
Atari God
Posts: 1465
Joined: Fri Sep 19, 2014 8:40 am

Re: FPGA programmers out there?

Postby Newsdee » Wed Jun 19, 2019 5:20 am

For me I'd be happy if I manage to write and test a CPU for starters... getting vdeo and inputs to work feels too out of reach yet. :?

User avatar
nullobject
Retro freak
Retro freak
Posts: 14
Joined: Mon Feb 27, 2017 3:58 am
Contact:

Re: FPGA programmers out there?

Postby nullobject » Wed Jun 19, 2019 6:27 am

alanswx wrote:Let us know how we can help! There is a steep learning curve to the FPGA development. But don’t despair you can move up it quickly.


Thanks.

I just bought a little 6" Sony PVM, so that I can run RGB output from the MiSTer. I hear that compiling cores without the scaler included has much faster build times. Other than that, I am right at the very beginning...but I do have a good idea of how Rygar works, at least :D

Is the best place to get info on how to build a core just the wiki on GitHub?

I plan on documenting the whole process so that I can share what I learn along the way.

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5099
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: FPGA programmers out there?

Postby Sorgelig » Wed Jun 19, 2019 7:25 am

nullobject wrote:I hear that compiling cores without the scaler included has much faster build times.

this is not relevant anymore.
When MiSTer used altera scaler it had much longer time to compile, so there was 2 versions: full and lite. With new (already not so new) open source scaler the compilation time almost the same - so lite builds are dropped.

User avatar
nullobject
Retro freak
Retro freak
Posts: 14
Joined: Mon Feb 27, 2017 3:58 am
Contact:

Re: FPGA programmers out there?

Postby nullobject » Wed Jun 19, 2019 9:43 am

Sorgelig wrote:this is not relevant anymore.
When MiSTer used altera scaler it had much longer time to compile, so there was 2 versions: full and lite. With new (already not so new) open source scaler the compilation time almost the same - so lite builds are dropped.


Great, thanks for the update.

So should I build the whole core every time I compile during development? Or can I disable certain things? Obviously I want to be able to iterate as fast as possible.

Also, should I try to hardcode ROMs into the core during development? Or do I build the core, program the FPGA, then load ROMs manually with the menu?

I'm just trying to get a basic understanding of the development process within the MiSTer environment :coffe:

Sorgelig
Ultimate Atarian
Ultimate Atarian
Posts: 5099
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: FPGA programmers out there?

Postby Sorgelig » Wed Jun 19, 2019 11:12 am

nullobject wrote:So should I build the whole core every time I compile during development? Or can I disable certain things? Obviously I want to be able to iterate as fast as possible.

How much parts to include into build to speedup the compiling - it's up to developer and specific core. If you think you can disable meaningless modules while testing some features then do this.

nullobject wrote:Also, should I try to hardcode ROMs into the core during development? Or do I build the core, program the FPGA, then load ROMs manually with the menu?

This is also depends on your vision of your core. You can include BIOS ROM in the core and also allow to download the other BIOS version through boot.rom or manually from OSD. It depends on emulated system. Some systems have only single BIOS so there is no point to keep it separately. Some systems have many different BIOSes giving different features so such systems are better with ability to load alternative BIOS.

MartinW
Atari User
Atari User
Posts: 34
Joined: Thu May 09, 2019 9:28 pm

Re: FPGA programmers out there?

Postby MartinW » Wed Jun 19, 2019 12:02 pm

Also just saw this thread pop up!

For a living I am a development manager and what the cool kids these days (I’m not one) like to call a full-stack java developer. I’ve also started to have another crack at HDL. I tried in the past and didn’t think I got very far but I found some of my old code and I had got further than I remembered! Before I was working on a dev cart for the vectrex but I hit a block and then someone released one way better than mine would have been so I stopped.

Rather than use my DE10 I already had a ‘GoDil’ module which is basically an FPGA with 50 I/o pins exposed to the outside world at 5v levels so really handy. Ok, it’s a Xilinx Spartan 3E but so what?

I’m under no illusions, I doubt I’ll ever be able to write a mister core but it would be nice if I could get to a level where I understand it. For now I have been doing stuff like driving LEDs via binary counters on breadboard (easy stuff to prove my setup) and next I intend to implement a simple cpu since a friend did just that with TTL logic a few weeks back.

I’ll see where we go from there!

Oh, PS: since the subject of arcade hardware has come up. I used to fix arcade PCBs part time (not any more) and have several crates of them in the loft. I basically got board of it though. Still have all the kit, spare parts and documentation. Rygar is too modern for me to be interested I’m afraid though.

alanswx
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 142
Joined: Sat Nov 25, 2017 4:34 pm

Re: FPGA programmers out there?

Postby alanswx » Wed Jun 19, 2019 2:40 pm

nullobject wrote:
Sorgelig wrote:this is not relevant anymore.
When MiSTer used altera scaler it had much longer time to compile, so there was 2 versions: full and lite. With new (already not so new) open source scaler the compilation time almost the same - so lite builds are dropped.


Great, thanks for the update.

So should I build the whole core every time I compile during development? Or can I disable certain things? Obviously I want to be able to iterate as fast as possible.

Also, should I try to hardcode ROMs into the core during development? Or do I build the core, program the FPGA, then load ROMs manually with the menu?

I'm just trying to get a basic understanding of the development process within the MiSTer environment :coffe:


Grab some simple arcade core like Sprint1 and compile it and look at it. It should compile in 6-10 minutes.

You can hardcode the roms or just use the batch file and the specs from mame to create a single romfile. I have a spreadsheet I use to create the select lines.

jemismyname
Atari freak
Atari freak
Posts: 73
Joined: Wed Feb 27, 2019 8:25 pm

Re: FPGA programmers out there?

Postby jemismyname » Thu Jun 20, 2019 3:22 am

MartinW wrote:I used to fix arcade PCBs part time... I basically got board of it though.


heh heh


Return to “MiSTer”

Who is online

Users browsing this forum: danytyler and 4 guests