Genesis Core

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

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

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Sat May 25, 2019 7:28 pm

hi,

With quartus 18, the creation of the rbf file take 1h44! Is this normal or is there option(s) to activate to reduce the compilation time? Or shall i get older version of quartus? (i've seen on one thread that compilation time get longer when jumping from v13 to an older version)

ghogan42
Atari maniac
Atari maniac
Posts: 97
Joined: Wed Oct 17, 2018 7:27 pm

Re: Genesis Core

Postby ghogan42 » Sat May 25, 2019 8:05 pm

onaryc29 wrote:hi,

With quartus 18, the creation of the rbf file take 1h44! Is this normal or is there option(s) to activate to reduce the compilation time? Or shall i get older version of quartus? (i've seen on one thread that compilation time get longer when jumping from v13 to an older version)


That's very slow. Quartus is slow in general but it should be something like 15-20 minutes on good modern hardware. On very old hardware it will be slower of course. But 1h44 is really bad!

What cpu do you have? Quartus will use multiple threads but not well. So mostly Quartus needs fast single threaded performance (clock speed).

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Sat May 25, 2019 11:04 pm

For now i've only try with a mobile i7 (i7-2640 running at 2.8ghz). It is not a recent one and a mobile version but i did not expect such slow compilation time :(

Most of the time is spend in the fitter part of the compilation (around 1h15).

I see there is a rapid recompile option where it seems only a fraction of operation are done in the fitter part, i will try that.

BBond007
Captain Atari
Captain Atari
Posts: 392
Joined: Wed Feb 28, 2018 3:23 am

Re: Genesis Core

Postby BBond007 » Sun May 26, 2019 12:44 am

onaryc29 wrote:For now i've only try with a mobile i7 (i7-2640 running at 2.8ghz). It is not a recent one and a mobile version but i did not expect such slow compilation time :(


Intel did people a disservice calling that CPU an i7...

It is only 2 cores with hyper-threading and 4mb cache allowing for only 4 hardware threads :(

Not 4/8 like a real i7.

You really wanted a "QM" processor --> 'Q' – Quad-core.

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Sun May 26, 2019 8:35 am

well i win it on a website lottery, so i can not complain too much 8) but it is still a fast cpu.

I try the fast recompilation but from what i understand it is only to reproduce the output files. If i change one file, i have to make a full recompilation... I was hopping that certain CPU costly operations was only necessary one time but it is not the case :(

Well the good thing is that i manage to compile a core, now i have to face the wall of learning how to use all of this.

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

Re: Genesis Core

Postby Sorgelig » Sun May 26, 2019 9:10 am

Mine is Core i5-4690k. It compiles the Genesis in something like 15mins in Quartus 17.
I think besides the CPU clock, Quartus needs enough RAM. I don't know what exactly "enough" is. My PC has 32GB.
With not enough memory it may swap a lot and be very slow - it has huge logic map while placing and routing.

Fast recompile according to help (we read the help right?) is useful when changes are small, so Q can re-use most compiled/routed parts. It's not just output file production.
From my experience in Q17 fast recompile takes almost the same time as full recompile - not worth to use.

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Sun May 26, 2019 11:39 am

I have 8g on my laptop which was quite good at the time but perhaps not in the current standard. It does not seem to swap but i have a ssd, i m use to notice the swap with my ears which is not doable now ;) I have to check this with the windows resource monitor.

I change some setings and gain 15 min with the fitter but still too long. I have other leads :
* use the linux version
* test my desktop computer (i5 3570k, 16g)
* get an older version of quartus

Thanks for all the responses anyway, i will try to make my small improvement to this core with my current setup.

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

Re: Genesis Core

Postby Sorgelig » Sun May 26, 2019 12:49 pm

It's possible to use Q13.1.4 - this is the lowest version supporting Cyclone V. So far it produces correct bitstream although it wars that timings are preliminary. Some of my projects include Q13 files.
Official quartus version to produce releases is v17.0.2

SSD doesn't reduce compilation time, as most time consuming things are happened in RAM (if it's enough).
As pointed above - amount of CPU cores doesn't matter. Multiple cores may reduce synthesizing part of compilation which is alone is not so long. Most lengthy part of compilation is placing and routing - and it's a single threaded operations, so won't be affected by amount of CPU cores.
To sum it up: you need CPU with as high clock as possible with enough RAM. CPU cache amount also may speed up the compilation.

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Mon May 27, 2019 9:09 am

i get the 17.0 version of quartus this morning (thanks to the work fiber :) ) and the fitter operation took 14min for a total compilation time of 19min!

Well, i'm use to work with interpreted language at work so waiting 19min to compile a project is a very long time for me, but compared to the 1h44 from before it is night and day :coffe:

Glaurung
Atari freak
Atari freak
Posts: 58
Joined: Sat Mar 30, 2019 6:22 am

Re: Genesis Core

Postby Glaurung » Fri May 31, 2019 4:23 am

GAme saved/load is working in this core?
When I save the game in wonder boy mosnter world I can't load any game later

angelicliver
Atarian
Atarian
Posts: 5
Joined: Wed May 15, 2019 11:30 am

Re: Genesis Core

Postby angelicliver » Fri May 31, 2019 8:30 am

Glaurung wrote:GAme saved/load is working in this core?
When I save the game in wonder boy mosnter world I can't load any game later


Yes it is, make sure you manually save to SRAM from the OSD menu or have enabled autosaving.

Glaurung
Atari freak
Atari freak
Posts: 58
Joined: Sat Mar 30, 2019 6:22 am

Re: Genesis Core

Postby Glaurung » Fri May 31, 2019 11:10 am

angelicliver wrote:
Glaurung wrote:GAme saved/load is working in this core?
When I save the game in wonder boy mosnter world I can't load any game later


Yes it is, make sure you manually save to SRAM from the OSD menu or have enabled autosaving.




that doesn't work,still only can choose NEW GAME
In SNES core it works good

angelicliver
Atarian
Atarian
Posts: 5
Joined: Wed May 15, 2019 11:30 am

Re: Genesis Core

Postby angelicliver » Fri May 31, 2019 12:38 pm

Glaurung wrote:
angelicliver wrote:
Glaurung wrote:GAme saved/load is working in this core?
When I save the game in wonder boy mosnter world I can't load any game later


Yes it is, make sure you manually save to SRAM from the OSD menu or have enabled autosaving.




that doesn't work,still only can choose NEW GAME
In SNES core it works good


Which release of the core are you using and are you able to provide an MD5 for the rom? Does it happen on any other SRAM enabled game? Are you pressing the OSD button before you quit (this is when the autosave happens)?

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Fri May 31, 2019 2:19 pm

It has been some days i've been working on a auto region feature for the genesis core based on the rom header and not the file extension. My code seems to be working now (i still have some pb to solve) and i have some questions (sorry if it is a bit long) :

First question
when setting a new video mode, from my understanding, one have to toggle the new_vmode register.

On some core, the setting is directly set to the PAL mode (which make sense, well seems to) but in the genesis core the new_vmode register is manage by the following piece of code :

Code: Select all

reg new_vmode;
always @(posedge clk_sys) begin
   reg old_pal;
   int to;
   
   if(~(reset | cart_download)) begin
      old_pal <= PAL;
      if(old_pal != PAL) to <= 5000000;
   end
   else to <= 5000000;
   
   if(to) begin
      to <= to - 1;
      if(to == 1) new_vmode <= ~new_vmode;
   end
end


This seems to be some kind of timer which is set when there is no cartridge loading or core soft reset.

And in the snes core, there is also a similar timer :

Code: Select all

reg new_vmode;
always @(posedge clk_sys) begin
   reg old_pal;
   int to;
   
   if(~reset) begin
      old_pal <= PAL;
      if(old_pal != PAL) to <= 2000000;
   end
   
   if(to) begin
      to <= to - 1;
      if(to == 1) new_vmode <= ~new_vmode;
   end
end


The timer duration is not the same, the condition is also different.

What is the exact purpose of this? with the ascal scaler and my 2 pc monitor, i notice no special difference in the genesis core with :
  • a direct connection between the PAL mode and the new_vmode
  • the genesis timer with different values (0, 2000000, 4000000, ...)
  • the snes timer in the genesis core

Second question
I have implemented a small difference in the region selection ergonomy and i would like to gray an option of the osd menu when certain values of another option is selected.

The Region option have the following values : JP,US,EU,Auto. I have another option to select the region priority which is only valid when the auto region is selected and shall be grayed in the other cases. Is there a way to do this? I'v seen the menumask feature but i do not understand how it works exactly.

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

Re: Genesis Core

Postby Sorgelig » Fri May 31, 2019 3:48 pm

There is no reliable way to autodetect the region from header. Many ROMs have several regions in header.
Current detection based on extension is good. I use it myself and pretty much satisfied. This is clear and easy to use, So no need to obfuscate it through uncertenity of headers.

new_vmode is signal to force notify about new resolution. Toggling the PAL/NTSC don't set the output video to specific PAL/NTSC immediately. Delay gives some time to make video stable before it will be measured.

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

Re: Genesis Core

Postby Sorgelig » Fri May 31, 2019 4:00 pm

You cannot disable specific value in option. Only the whole option can be disabled.

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Fri May 31, 2019 4:06 pm

well, there are several region in the header indeed, this is why a supplementary option is needed. Imho, selecting the region based on the file extension is not a good option : in the no intro set (which is the goto set to take, which is the set you find in the smokemonster pack) every files have the *.md extension.

The use case, i propose is to set the region to auto (the other option are forced region) and then set another option to region priority :JP, US or EU. If the region chosen by the user is found in the header, then there it is, otherwise it take the first one. A better option would be to choose between all combination priority (U>J>E for example) but this is my first time programming in verilog so i prefer to keep things simple (but i think i can do this now if needed).

For the option mask, i want to disabled the whole option.

slingshot
Atari God
Atari God
Posts: 1343
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis Core

Postby slingshot » Fri May 31, 2019 4:12 pm

Auto-detection from the header works for me in most of the cases on MiST (I would say it's 95% reliable).

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Fri May 31, 2019 6:37 pm

I do not know how it is implemented in mist (and i have to check in the emulator how it is configured) but just selecting the first region found in the header shall satisfied most of the user.

There is at most 3 region codes. In theory, one can have J, JU, JUE, JE, U, UE, E with the following priority order J>U>E (there are more codes but they act like E). Certain region configuration could be problematic : for example by loading Street of rage, which is JUE, in auto region mode, you will always play at bare knuckle if you only select the first region code found ;)

So i think, in most case, you select the priority option once and for all (or at least), and then you choose if you force one region or let the auto algorithm do it for you. But, i'm open to suggestion :)

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Fri May 31, 2019 7:47 pm

I've look at some emulators :
* in kega fusion, you have the preferred order option where all the priority orders are listed
* in genplus-gx, it seems to have the following auto region selection algo :

Code: Select all

If US in header then region <- US
else if Japan in header then region <- Japan
else region <- Europe


I think this algo will satisfy most western people but perhaps not Japan ones ;)

I still prefer the version where all priority order are listed, where the default one is U>J>E

I will make a test version as soon as possible

slingshot
Atari God
Atari God
Posts: 1343
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis Core

Postby slingshot » Fri May 31, 2019 8:00 pm

onaryc29 wrote:I do not know how it is implemented in mist (and i have to check in the emulator how it is configured) but just selecting the first region found in the header shall satisfied most of the user.

It works exactly like this. If the first one is not good for some reason, you can select any other manually. I don't see any benefit implementing a priority system or such, since all regions are available, never need to fall back.

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

Re: Genesis Core

Postby Sorgelig » Fri May 31, 2019 10:12 pm

slingshot wrote:I don't see any benefit implementing a priority system or such, since all regions are available, never need to fall back.

Some games have different languages depending on region. Even name of game may have different. That mentioned Streets Of Rage II - different name, different language. Even title music is a little different in EU region.

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

Re: Genesis Core

Postby Sorgelig » Fri May 31, 2019 11:19 pm

I will see if i can add alternative auto-region based on header.

onaryc29
Atari nerd
Atari nerd
Posts: 48
Joined: Mon Dec 10, 2018 9:47 am

Re: Genesis Core

Postby onaryc29 » Fri May 31, 2019 11:45 pm

well perhaps you can just wait for my PR, i've been working on this for quite some time. i want to participate (and learn some FPGA prgramming) to this project and this way, experience FPGA programmer can concentrate to more complex task (i don't think i will be able to make a soft core or a complete system, i have not the knowledge or the time). But if you do not let simple task to beginner it will be a bit frustrating, especially when the work is almost done.

slingshot
Atari God
Atari God
Posts: 1343
Joined: Mon Aug 06, 2018 3:05 pm

Re: Genesis Core

Postby slingshot » Fri May 31, 2019 11:53 pm

Sorgelig wrote:
slingshot wrote:I don't see any benefit implementing a priority system or such, since all regions are available, never need to fall back.

Some games have different languages depending on region. Even name of game may have different. That mentioned Streets Of Rage II - different name, different language. Even title music is a little different in EU region.


Then you can choose EU, and load Streets Of Rage. It can be made more complicated, just I like to keep things simple.


Return to “MiSTer”

Who is online

Users browsing this forum: AntialiasedPixel, SegaMan and 7 guests