-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZX Spectrum doesn't work or incompatible. #2
Comments
I just verified that spectrum_150319_r894.rbf still works with the latest firmware. It does. Please first try on a regular VGA screen without any mist.ini. Once that's working you can try to disable the scan doubler and use a SCART cable. The ability to disable the scan doubler was introduced with version spectrum_150312_r822.rbf |
I've tried without mist.ini on my projector (which is the only my device understanding such sync). And result is the same. There is one thing i've noticed. With TV RGBS mode (scandoubler_disable=1) even with DivMMC it's hard to start with DivMMC boot screen displayed. Most times i see garbled screen instead of DivMMC. And even if DivMMC boot screen displayed, it distorted with flickering lines and pixels. Can it be SDRAM memory timing/refresh problem? May be timings used in ZX core is at the edge of specification, so some SDRAM chips can work well, while others are not? |
I don't know how to re-open this issue (i don't see any button for this) but it looks like really SDRAM timing problem. If it could be any CPU programming language i could experiment and find the problem. But FPGA is like martian language for me. Thus i'm asking for help. I can provide any info you want. P.S.: My MIST board is standard (not hand-made), ordered from Lotharek this month. |
Will have a look at it ... |
It's definitely possible that something is closer to the fpga limits than it should be and thus causes problems an certain boards. As I said, I'll have a look ... |
Probably SDRAM refresh period is too long. I doubt it's something about FPGA limits because C64 works well which is close to ZX by screen and memory organization and speed. Also Amiga AGA works well which is much more powerful. Let me know if you have something to test. I can compile by myself. Just push commit will be enough. |
Sorry for annoying. Just my thought: |
After checking out sdram.v from 6b27e2f commit and some additional tweaks i've got SDRAM working. I didn't test very hard, but loaded couple games and they were fine. Also, i can start core only with DivMMC (spectrum.rom) on SD card. Withouth this ROM, core never starts. Is it supposed to run core without spectrum.rom as well? |
Yes, tge core is supposed to work without the divmmc rom. I am currently taking a closer look at the sdram. It can be quite difficult to port those cores that make extensive use of the high speed sram on the de1/de2 boards. That's why the sdram runs at 112mhz in the spectrum core. I am trying to reduce that to 56mhz which will greatly relax the whole ram timing. But feel free to commit your quick fix so others can also benefit. |
I see ZX core occupies only small part of our FPGA. So, may be possible to implement RAM inside FPGA as an array of bytes? I just started to study Verilog and VHDL and not familiar with all features. As for SDRAM: it's supposed to run on >100mhz clock. It's not a problem. There is race condition somewhere. Starting the core is the main problem. It's unstable at the power-on. Once it loaded OK, i can issue reset through OSD and ZX-reset button without a problem. I didn't provide fix i mentioned above because i'm not sure if it really help. Still, core startup is unstable and i cannot start clean Spectrum without DivMMC. It seems additional DivMMC ROM greatly change startup timings and eliminates (sometimes) hang upon power-on. If i will make real fix then be sure i will publish it. I hope you can find the source of problem because you should have more experience here :) |
Hi, no, the FPGA only has roughly 80kb of ram and some of this is needed for the I'll also have a further look at this. Regards, On Tuesday, December 01, 2015 11:48:30 AM sorgelig wrote:
Dr. Till Harbaum till@harbaum.org |
Can you recall which exactly commit used to build spectrum_140812_r306.rbf binary? |
I've located r306 (and r309) commit in Google SVN, but it doesn't produce the same binary. I've tried Quartus 9.1, 10.1, 13.1 - nothing similar to binary spectrum_140812_r306.rbf. |
It's unlikely to produce the same binary. It's likely timings are specified too tightly. This is why I always use always blocks that run off clocks Sent from my iPhone
|
Would probably be best to try and identify which components in the model are running tight (Till knows this already of course - but I say this for the benefit of anyone who doesn't). Might be a clock domain issue or something needing latched etc. Sent from my iPhone
|
yes and no. Actually there are 2 binaries always working correctly. R306 binary actually has two versions. They are compiled at the same day and pushed with the same name. I just restored the previous version (before Video fix) and it also works. The second version actually should have name R309. And then something happened after these releases and all later versions don't work. My original idea was to check the source code difference between R309 and the next one to pinpoint the problem. |
I've done major changes to the SDRAM timing. The SDRAM now runs at 56 MHz (as opposed to the 112MHz before). I've also changed the overall timing. The current source tree already gives me quite reliably a running core. There are still a few things to verify. For me this core e.g. also works without the esxdos rom and boots in the typical 128k main menu then. The new code is in the source repository but no binaries have been released yet. Please give it a try. |
Thanks Till, Sorgelig, With FPGA PAR you can have the same code producing a good build Cheers On Wed, Dec 2, 2015 at 4:02 PM, Till Harbaum notifications@github.com
Stephen Leary |
One thing that's very unlike software development is that compiling (synthesizing in this case) a core from the very same sources on the same machine with the same tools will result in different cores. This is due to the fact that the placement of logic cells inside the FPGA may change from build to build. If there's something in the core designed very close to the limits of the FPGA then the minor timing variations caused by these small build-to-build differences may result in one core working and the other one not. Also adding debug stuff like signaltap may cause such a core not to work anymore all of a sudden. This problem of "build to build instabilities" can be quite nasty. Edit: Ah, Stephen just explained the very same thing ... |
Unfortunately it didn't help. |
The ram will work at 128mhz no problem. But there is another build to build issue that needs resolved first. Till, I could give this core the verilator treatment to get a working simulator like the BBC core if you think that might help. Sent from my iPhone
|
In most of your comments in this bug report you suggested that there were sdram timing problems. Now that I have worked on that you ask me why I do that? Sdram definitely was a mess. Also reducing clocks always is a good idea. While it's sure possible to run the sdram at 133 mhz it's also much more difficult to achieve stable operation at that speed than at 56mhz. Since I lowered the clock I haven't seen any of the typical ram timing related problems anymore. Next I'll try to see what may cause startup problems. I haven't looked at that at all as I have always loaded the core via the usb blaster and never from sd card the last few days. |
I now played hours with the core, did small adjustments here and there, reduced the fitter effort etc etc ... and every single core booted reliably. I really start to wonder what your problems are. Are you doing these test with the scandoubler disabled? I didn't test that yet and it make difference as this changes the memory access timing of the video engine. |
Except video projector in another room, i don't have any display devices accepting 31Khz@50Hz. So, my test platform requires standard TV PAL(or NTSC) signal. So, i always disable scandoubler. I've just tried with scandoubler on projector your new commits and it works stable! Well, almost. I have to press ZX-reset button after every core start. So, when core start i see empty screen. Then i press ZX-reset button (or use OSD reset) and then Spectrum 128 welcome dialog appears. So, you are close now! :) |
I have an idea how to fix problem in PAL mode: |
by the way, i found some inconsistency in code: sdram_addr <= io_addr when ioctl_cycle = '1' else
("000000" & vid_addr) when vid_rd_n = '0' else ("0000" & cpu_addr); and then here if cpu_cycle = '1' then
sdram_oe <= not cpu_mreq_n and not cpu_rd_n; -- any cpu read enables ram
sdram_we <= sram_write; -- cpu_wr_n incl. -- write only for memory used as ram
sdram_di <= cpu_do;
elsif ioctl_cycle = '1' then
sdram_oe <= tape_rd;
sdram_we <= ioctl_used;
sdram_di <= ioctl_ram_data;
else
-- no cpu sccess. Thus do video access
sdram_oe <= not vid_rd_n;
sdram_we <= '0'; -- video never writes
sdram_di <= "00000000";
end if; the priorities are not match, so it's possible in some cases sdram_addr won't match sdram_oe/sdram_we/sdram_di. |
That wasn't a problem as the timing usually matched (at least in VGA mode). But i have cleaned that part up and it's now much more readable. Also if there's a timing mismatch between video and the rest then the cpu now has priority and will continue to work while the video will suffer from the resulting mismatches. This is/was actually happening in 15khz mode while it shouldn't. I've taken a look at the memory timing of the 15khz mode and adjusted a few things here and there. It's totally untested since i current don't have a 15khz capable screen on my test setup. I may actually already work, but i need to test it myself. |
In spectrum_mist.vhd i see many sichronizations to 28mhz. But ZX spectrum has no such high frequency. Base ZX spectrum frequency is 3.5Mhz and code should sync to it. Memory accesses in spectrum_mist.vhd should be synchronized to respective clocks like vid_clk, dio_clk, cpu_clk and so on. |
Congratulations! No more problems with memory in PAL mode.
This happens in both PAL and VGA modes for me. |
By the way, is it possible to use DivMMC and boot into Spectrum 128 dialog? I would like to get the best from both parts :) |
Yeah, i am little impressed by myself that i fixed 15khz mode without being able to test it :-) I'll have a look at that boot problem. The fact that i need to remove the spectrum.rom to trigger that issue was missing. I don't know anything about the esxdos/divmmc. I thus cannot answer questions regarding its ability to boot into the original spectrum 128 menu. I've never seen a real spectrum let alone a divmmc equipped one. |
Can you do benchmarks? How accurate is the CPU speed? |
It seams there is problem with performance.. If you have some specific benchmarks to compare VGA and PAL modes, give me the link. |
Older versions (112mhz RAM) have the same performance issue. |
The shock megademo is the best test Sent from my iPhone
|
First part of Shock Megademo is slower than original (and may be balls part, but not so obvious). Border effect in first part is totally messed because it requires very precise timings. |
The boot problems have been fixed by extending the reset a little bit. Actually i extended the reset to be able to trace the problem. But that was already the fix. Dunno what exactly is/was the problem ... will investigate this a little further one day. Perhaps ... |
Can you give performance numbers? Perhaps the timing of some basic loop? How much too slow is this? I can adjust things by e.g. giving it the CPU some of the free memory bandwidth in the video blanking times. And no need to test TV vs VGA. The CPU timing is the same in both setups. |
Unfortunately i don't know exact timings. |
nope. It didn't fix the problem for me. Still have to press ZX-reset. |
i've improved extended reset time. Made it only for coldboot. So pressing ZX-reset won't take long time. From aae610f4bdb893a16e7967e5679be4d7e65dd071 Mon Sep 17 00:00:00 2001
From: sorgelig <pour.garbage@gmail.com>
Date: Fri, 4 Dec 2015 06:58:01 +0800
Subject: [PATCH] [SPECTRUM] Extended reset time only for core coldboot
---
cores/spectrum/spectrum_mist.vhd | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/cores/spectrum/spectrum_mist.vhd b/cores/spectrum/spectrum_mist.vhd
index 6b8a220..7dd3afd 100755
--- a/cores/spectrum/spectrum_mist.vhd
+++ b/cores/spectrum/spectrum_mist.vhd
@@ -1014,10 +1014,13 @@ begin
-- delay reset so sdram can be initialized etc. especially clearing the
-- divmmc ram after esxdos upload needs some time (9.3ms)
process(clock, pll_locked, status, buttons)
- variable reset_cnt : integer range 0 to 28000000;
+ variable reset_cnt : integer range 0 to 32000000 := 32000000;
begin
if pll_locked = '0' or status(0) = '1' or status(1) = '1' or buttons(1) = '1' then
- reset_cnt := 28000000;
+ -- don't clear core coldboot reset time
+ if reset_cnt < 280000 then
+ reset_cnt := 280000;
+ end if;
elsif rising_edge(clock) then
if reset_cnt /= 0 then
reset_cnt := reset_cnt - 1;
--
1.8.3.msysgit.0 |
Yes, the root of the problem is probably something else. But i am little too lazy at the moment to fix this. Most importantly the core now works for you (and hopefully everybody else as well). Can you please close this issue if the subject of this issue has been fixed? |
Released core binaries for ZX Spectrum are not working with neither 20151118 nor 20150910 firmware. I have garbled screen on start. Mist menu rolling vertically very fast and a even cannot catch the view to see what is displayed there.
Only release spectrum_140812_r306.rbf is partly working. I mean, i can see some unsynced video. It seems ignores scandoubler_disable=1 from ini and my scaler doesn't work with RGBHV video (cannot sync video).
I didn't test compatibility with older firmwares because need Amiga AGA core.
Can you update Spectrum core for latest firmware?
The text was updated successfully, but these errors were encountered: