Core porting, empty template?

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

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

hrvoje
Retro freak
Retro freak
Posts: 10
Joined: Wed Nov 29, 2017 1:32 pm

Core porting, empty template?

Postby hrvoje » Sat Oct 13, 2018 11:56 am

Hello,

I've been having fun trying to implement a DEC PDP emulator to run some old games in Verilog as part of a "teach yourself about FPGA" week I've been having. After getting it to work on a DE0 Nano (which is a Cyclone IV) and a 4-bit VGA output, I would like to integrate it with MiSTer / HDMI.

However, I have no idea where to start. I've read the core porting notes and this was educational, but the learning curve is quite steep.

Is there anyone kind enough who could give me a few pointers, or put together a "boilerplate" minimal, blank core project (for example which only generates a red video background) I could open in Quartus and compile?

Thanks a lot and keep up the awesome work!

Hrvoje

hubersn
Atari User
Atari User
Posts: 35
Joined: Fri Sep 11, 2015 8:10 pm

Re: Core porting, empty template?

Postby hubersn » Sat Oct 13, 2018 12:44 pm

hrvoje wrote:Is there anyone kind enough who could give me a few pointers, or put together a "boilerplate" minimal, blank core project (for example which only generates a red video background) I could open in Quartus and compile?


There are the original MIST tutorials by Till:
https://github.com/mist-devel/mist-boar ... /tutorials

I guess these should be (easily?) portable to MISTer.

Have fun
hubersn

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2629
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting, empty template?

Postby Sorgelig » Sat Oct 13, 2018 2:40 pm

Almost any arcade core can be treated as a template - they are simple and have good point to split original arcade from MiSTer specific part.

hrvoje
Retro freak
Retro freak
Posts: 10
Joined: Wed Nov 29, 2017 1:32 pm

Re: Core porting, empty template?

Postby hrvoje » Sat Oct 13, 2018 6:05 pm

Sorgelig wrote:Almost any arcade core can be treated as a template - they are simple and have good point to split original arcade from MiSTer specific part.


Thanks for your quick response. Which arcade core would you recommend as a good example?

If I manage to get something working, I will try to contribute with some documentation about the process.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2629
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting, empty template?

Postby Sorgelig » Sat Oct 13, 2018 11:48 pm

hrvoje wrote:Which arcade core would you recommend as a good example?

Take Defender.
In Arcade-Defender.sv replace the instance defender by instance of your core.

hrvoje wrote:If I manage to get something working, I will try to contribute with some documentation about the process.

Doc(Wiki) from first porting experience would be good!

hrvoje
Retro freak
Retro freak
Posts: 10
Joined: Wed Nov 29, 2017 1:32 pm

Re: Core porting, empty template?

Postby hrvoje » Sun Oct 14, 2018 2:00 pm

Sorgelig wrote:Doc(Wiki) from first porting experience would be good!


Thank you very much for your advice! I will try my best.

In my current Cyclone IV attempt, I generate VGA with a simple 4-bit R-2R DAC and I know how to make a VGA signal. I've never done HDMI, can you please point me in the right direction - what kind of signal is expected on the HDMI connections (HDMI_R/G/B, HS, VS etc...) from my core? Same values and timings as VGA I'm currently outputting or something else?

Thanks again!

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2629
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting, empty template?

Postby Sorgelig » Sun Oct 14, 2018 2:34 pm

hrvoje wrote:In my current Cyclone IV attempt, I generate VGA with a simple 4-bit R-2R DAC and I know how to make a VGA signal. I've never done HDMI, can you please point me in the right direction - what kind of signal is expected on the HDMI connections (HDMI_R/G/B, HS, VS etc...) from my core? Same values and timings as VGA I'm currently outputting or something else?

HDMI is handled by special chip. After proper configuration the output signals to this chip are identical to VGA signals. The only notable difference is requirement of DE signal. This signal is basically DE = ~(HBLANK | VBLANK). Also HDMI requires pixel clock because it's digital interface.
Ah, i've forgot that Arcade cores have separate video for HDMI to make a rotation.
Ok, forget about arcade as a sample :)

Take Jupiter ACE core as a sample. It's as simple as arcade and doesn't have separate HDMI signals - so easier to connect to your core.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2629
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting, empty template?

Postby Sorgelig » Sun Oct 14, 2018 2:37 pm

Actually, you can take even Genesis core - it has simple connection to MiSTer API and includes all latest changes to API and framework.

hrvoje
Retro freak
Retro freak
Posts: 10
Joined: Wed Nov 29, 2017 1:32 pm

Re: Core porting, empty template?

Postby hrvoje » Sun Oct 14, 2018 9:13 pm

Sorgelig wrote:Actually, you can take even Genesis core - it has simple connection to MiSTer API and includes all latest changes to API and framework.


After a lot of fiddling around, I did manage to compile the Jupiter ACE with Quartus 16.1, so the first milestone is achieved. Lesson learned - the lite version is needed, because the compiling the regular one takes unbelievably long. Is there some trick I should know about, or every single change really needs that long to compile?

What's the deal with clocks? Do I need to set up an additional PLL to generate, let's say, 148.5 MHz pixel clock for 1920x1080p @ 60 Hz?

Should I just plug the horizontal/vertical sync and R, G, B as input to an instance of video_mixer module?

Please excuse my questions, I have nobody else to ask because nobody I know knows anything about FPGA and I really want to teach myself how to do this...

Thanks a lot for your help and guidance!

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2629
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting, empty template?

Postby Sorgelig » Sun Oct 14, 2018 9:42 pm

HDMI clocks are handled in framework (sys_top.v) with separate PLL and you don't need to care about it.
Your entry is instance of your module inside the emu module. Everything in upper layer should not be touched. Also hps_io should be included in emu.

Full version compilation takes long time and if your computer is not powerful enough it may take very long time. So, for development, LITE revision should be used. When everything is OK, you compile the FULL revision for release.

There is no way to compile it faster/partially except using faster computer. Amount of CPU cores don't affect compilation time much. MHz of CPU is the key feature for faster compilation.

Sorgelig
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2629
Joined: Mon Dec 14, 2015 10:51 am
Location: Russia/Taiwan

Re: Core porting, empty template?

Postby Sorgelig » Sun Oct 14, 2018 9:44 pm

hrvoje wrote:Should I just plug the horizontal/vertical sync and R, G, B as input to an instance of video_mixer module?

yes. And it's very important to provide HBlank and VBlank signals as well.
Also i suggest to use video_cleaner module right after your module which will align the signal properly.


Return to “MiSTer”

Who is online

Users browsing this forum: No registered users and 2 guests