RetroBrew Computers Forum
Discussion forum for the RetroBrew Computers community.

Home » RBC Forums » General Discussion » TinyZZ, a Z280 SBC (Exploring Z280)
Re: TinyZZ, a Z280 SBC [message #4456 is a reply to message #4454] Sun, 18 March 2018 07:59 Go to previous messageGo to next message
etchedpixels is currently offline  etchedpixels
Messages: 333
Registered: October 2015
Senior Member
The xxx0 requirement doesn't surprise me - presumably it's dependant in part upon the four instructions being in the same DRAM burst (and probably that there is nothing much else midflight when it happens).

So long as there is an address and cache setting it reliably happens at then it's easy enough to test for. It also doesn't look too scary to write an assembler fixup for either.

I am curious if your second examle actually works or whether the requirement is 1 byte instruction ?

Alan
Re: TinyZZ, a Z280 SBC [message #4458 is a reply to message #4456] Sun, 18 March 2018 11:56 Go to previous messageGo to next message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
I can observe the exaf bug on my machine. Using a test code based on hperaza's 2nd example, my hardware will get identical F, F' if the first ex af,af' instruction is located on an even address. I wrote a program that relocates the test code by one byte every iteration; and the error occurs every other iteration. What's interesting is that to observe the problem, the test code must not be in the cache. If the test code is in the cache, the error will occur every time regardless of the location. To flush the test code out of the cache, I'd call a routine that has more than 256 NOP before returning to the test code again.

One difference between my hardware and Tilmann Reh's CPU280 is that I've not implemented the burst mode memory transaction.
Re: TinyZZ, a Z280 SBC [message #4464 is a reply to message #4458] Mon, 19 March 2018 10:09 Go to previous messageGo to next message
lowen is currently offline  lowen
Messages: 226
Registered: August 2016
Location: Western NC USA
Senior Member
plasmo wrote on Sun, 18 March 2018 14:56
I can observe the exaf bug on my machine. Using a test code based on hperaza's 2nd example, my hardware will get identical F, F' if the first ex af,af' instruction is located on an even address. I wrote a program that relocates the test code by one byte every iteration; and the error occurs every other iteration. What's interesting is that to observe the problem, the test code must not be in the cache. If the test code is in the cache, the error will occur every time regardless of the location. To flush the test code out of the cache, I'd call a routine that has more than 256 NOP before returning to the test code again.


You can also disable the cache for instructions for testing. I would find it interesting to make sure that register A is also being exchanged not copied if the first ex af,af' is on an odd address; if an internal data bus collision is occurring for F and F' on even, I would be suspicious of A and A' on odd. Ken Shirriff's blog has a great discussion of the Z80's register implementation at the silicon level; I would suspect the Z280, even though it's CMOS and not NMOS, might use some of the same features. His blog entry is http://www.righto.com/2014/10/how-z80s-registers-are-impleme nted-down.html

Quote:

One difference between my hardware and Tilmann Reh's CPU280 is that I've not implemented the burst mode memory transaction.


I was going to ask if you were using burst mode.

It is very nice to see some of these bugs being investigated again, and one (delay after DMA) being put to rest as 'not a bug' instead. Nice!




Oh, almost forgot:
plasmo wrote on Fri, 16 March 2018 08:59
...
CPU280 have DRAM as well, so it must have a different way of refreshing the memory and not relying on the internal refresh counter.


CPU280 doesn't use the refresh counter as far as I know, but uses CAS-before-RAS refresh. This isn't well documented in the English manual; the German Hardware Handbuch shows the timing diagrams on page 22 (PDF page number).


--
Bughlt: Sckmud
Shut her down Scotty, she's sucking mud again!

[Updated on: Mon, 19 March 2018 12:15]

Report message to a moderator

Re: TinyZZ, a Z280 SBC [message #4473 is a reply to message #4464] Mon, 19 March 2018 14:57 Go to previous messageGo to next message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
My test shows that when errors occurred, only flag registers are incorrect. Reg A and reg A' retain their correct values in all cases.

The timing diagrams are quite useful, but now I'm confused. The CAS-before-RAS refresh cycle is triggered by the RFSH signal which is generated by decoding Z280's status lines ST[3..0] for value of 0001. That status value can only be generated by the refresh controller. Another word, if the refresh controller is turned off, then RFSH will also turned off and no more CAS-before-RAS refresh cycle. My refresh logic is very similar which also uses CAS-before-RAS refresh cycle and depends on the refresh controller to activate the refresh access once every 16uS.
Re: TinyZZ, a Z280 SBC [message #4475 is a reply to message #4464] Mon, 19 March 2018 16:54 Go to previous messageGo to next message
fritzeflink is currently offline  fritzeflink
Messages: 80
Registered: January 2017
Location: germany
Member
lowen wrote on Mon, 19 March 2018 18:09


CPU280 doesn't use the refresh counter as far as I know, but uses CAS-before-RAS refresh. This isn't well documented in the English manual; the German Hardware Handbuch shows the timing diagrams on page 22 (PDF page number).


Hi...

I did a new scan of the papers for the linked z280_reh.pdf including some history pages and will save the pdf at oldcomputers.
Here I post a screen hard copy of page 17 - timing CPU280, 12.5MHz for information.

index.php?t=getfile&id=855&private=0
  • Attachment: hc_2955.jpg
    (Size: 357.86KB, Downloaded 1313 times)


/*-----
fritz
-----*/
Re: TinyZZ, a Z280 SBC [message #4477 is a reply to message #4473] Mon, 19 March 2018 17:12 Go to previous messageGo to next message
lowen is currently offline  lowen
Messages: 226
Registered: August 2016
Location: Western NC USA
Senior Member
Yeah, it does sound a bit confusing. The Z280 manual does say that if an external bus transaction doesn't occur within the number of cycles defined in the refresh control register, that a refresh transaction will be inserted anyway, even if refresh is disabled. This means that an idle loop, running entirely in cache, would trigger refresh cycles even with refresh disabled.

But I begin to wonder about the advisability of the snc fix. Tilmann's doc does say that software development had hit a snag due to some of the issues; without digging deeper, I wonder if the cure could have been worse than the disease.


--
Bughlt: Sckmud
Shut her down Scotty, she's sucking mud again!
Re: TinyZZ, a Z280 SBC [message #4481 is a reply to message #4477] Mon, 19 March 2018 18:03 Go to previous messageGo to next message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
lowen wrote on Mon, 19 March 2018 18:12
Yeah, it does sound a bit confusing. The Z280 manual does say that if an external bus transaction doesn't occur within the number of cycles defined in the refresh control register, that a refresh transaction will be inserted anyway, even if refresh is disabled. This means that an idle loop, running entirely in cache, would trigger refresh cycles even with refresh disabled.


This is the last paragraph of section 9.3 Refresh Controller
index.php?t=getfile&id=856&private=0

Thanks for the reminder. I remember reading it but not understanding it and moved on. Didn't worry about it since I turned on the refresh controller anyway. Reading between the lines it basically says the refresh rate register can't have a value of zero (refresh disable and rate = 0). This is why it crashed when I write 0x0 to the refresh rate register. This also tells that SNC (Stefan Nitschke Chaos) can't work because it supposedly wrote 0's to the refresh controller. Or perhaps it did worked with older date code parts, but now it won't work. I wonder whether this is part of the UZI280 problems?

----------
Edit: Thinking about it more, even if SNC had set the rate field to non-zero value it can create insidious bugs because if program is idling in cache, the refresh mechanism would work properly, but if program starts running some tasks then the refresh cycles won't start and parts of the memory will become corrupted gradually. This is insidious because the tasks that run regularly will get refreshed, but the tasks that seldom get called will become corrupted and then crashed in random ways. DRAM can actually retain its data for many seconds without refresh but it is highly variable and strongly temperature dependent--a nightmarish problem to debug.


[Updated on: Mon, 19 March 2018 18:35]

Report message to a moderator

Re: TinyZZ, a Z280 SBC [message #4485 is a reply to message #4464] Tue, 20 March 2018 03:03 Go to previous messageGo to next message
fritzeflink is currently offline  fritzeflink
Messages: 80
Registered: January 2017
Location: germany
Member
lowen wrote on Mon, 19 March 2018 18:09

CPU280 doesn't use the refresh counter as far as I know, but uses CAS-before-RAS refresh. This isn't well documented in the English manual; the German Hardware Handbuch shows the timing diagrams on page 22 (PDF page number).



My new scan of the german manual for CPU280 and some history information are at:

1.)
Collection of information by Tilmann Reh send to us including hardwarebook, short 
info for the operating system and historie informations. (german text as below) 

http://oldcomputers.dyndns.org/public/pub/rechner/zilog/z280/CPU280_Handbuch_und_Historie_(ger_bw_ocr).pdf

2.)
Zusammenstellung der Schreiben von Tilmann Reh - Hardware-Handbuch (210690), Kurz-Information zum 
Betriebssystem (231090) und aeltere Texte. 

http://oldcomputers.dyndns.org/public/pub/rechner/zilog/z280/CPU280_Handbuch_und_Historie_(ger_gray_ocr).pdf


/*-----
fritz
-----*/
Re: TinyZZ, a Z280 SBC [message #4489 is a reply to message #4481] Tue, 20 March 2018 07:23 Go to previous messageGo to next message
hperaza is currently offline  hperaza
Messages: 68
Registered: March 2017
Member
plasmo wrote on Mon, 19 March 2018 18:03
I wonder whether this is part of the UZI280 problems?

Is there a list somewhere of UZI280 problems? Haven't had the time to look at the sources in detail, but I don't think it has the SNC fix (floppies are not supported at all). OTOH, OUTJMP fixes can be found in e.g. the IDE code.

Quote:
Thinking about it more, even if SNC had set the rate field to non-zero value it can create insidious bugs because if program is idling in cache, the refresh mechanism would work properly, but if program starts running some tasks then the refresh cycles won't start and parts of the memory will become corrupted gradually. This is insidious because the tasks that run regularly will get refreshed, but the tasks that seldom get called will become corrupted and then crashed in random ways. DRAM can actually retain its data for many seconds without refresh but it is highly variable and strongly temperature dependent--a nightmarish problem to debug.

I was wondering about the same. The DRAM on the CPU280 relies on the Z280 CPU for refresh, and after the SNC fix the software cannot longer be expected to work reliably.

Just wanted to do a quick test to see how long it would take before memory contents begin to fade, but since the BIOS enables protected mode I could not access the refresh register. Also, it is not a trivial test, as the memory will get refreshed just by reading it or by instruction fetches, etc.
Re: TinyZZ, a Z280 SBC [message #4501 is a reply to message #4489] Thu, 22 March 2018 05:03 Go to previous messageGo to next message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
Did a couple experiments with turning off refresh logic to DRAM on TinyZ280. The test condition is at room temperature (70F). I filled 52K of DRAM with test patterns that's unique for each 16-bit word; turned off the refresh controller (the program itself is constantly refreshed by code fetches); wait for some period of time then check the memory for number of mismatches:
DRAM #1 (TI TMS417409)
time without refresh (seconds)	                error count
5 						no error
10						no error
15						1
20						7
25						10
30						17
35						25


DRAM #2 (NANYA NT511740)
2.5						no error
5						1
10						8
15						21
20						50
25						61


Even at room temperature, DRAM's data retention time is orders of magnitude greater than what manufacturer's datasheet required (32mS). Literature showed that retention time is dramatically increased at colder temperature. Retention is also different for different manufacturers.

So depending on the operating temperature and SIP DRAM manufacturers, idling processor with SNC fix will remain operational indefinitely; processor that's actively running with SNC fix may remain operational for many seconds, possibly minutes depending on where the data corruption had occurred.

[Updated on: Thu, 22 March 2018 05:04]

Report message to a moderator

Re: TinyZZ, a Z280 SBC [message #4508 is a reply to message #4501] Sat, 24 March 2018 11:15 Go to previous messageGo to next message
etchedpixels is currently offline  etchedpixels
Messages: 333
Registered: October 2015
Senior Member
The DRAM retention time is very dependant upon what else is happening to cause disturbance and leakage. Try repeatedly changing physically close memory sells and see how the time looks. On pure idle though your numbers look irght. Folks used to switch SIMMs and RAM chips between devices live for nefarious purposes and it usually worked OK.
Re: TinyZZ, a Z280 SBC [message #4542 is a reply to message #4508] Wed, 04 April 2018 20:12 Go to previous messageGo to next message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
With Spring growing season upon us, I find myself not able to spend much time on the Z280 exploration. Fortunately the hardware development is at a stable point. Other than the EX AF,AF' bug, many other bugs that were rumored did not materialized on my hardware. I went as far as built up all 6 remaining pc boards and checked them out. They all worked, and worked the same. I have a working monitor, CPM2.2 and CPM3 (non banked). I wanted very much to port CPM3 banked version, but that'll have to wait to late Fall. UZI280 is but a dream, I had no idea how even to approach it.

I'm pleased with the simplicity of the hardware (and low cost, too). It consists of 5 active components: Z280, Altera EPM7128 CPLD, SIMM72 memory (either 4Meg or 16 Meg), CF disk and 24MHz oscillator, There is an optional RTC based on DS12887. There are plenty of room for other devices even on a small 10cm*10cm pc board. The CPLD is about 75% utilized with a dozen spare pins.

The design is posted on my builderpages starting with this page:
https://www.retrobrewcomputers.org/doku.php?id=builderpages: plasmo:tinyz280:final_step
I welcome ideas, recommendations and constructive criticisms, but they'll have to wait til the Fall to be realized.
Bill
Re: TinyZZ, a Z280 SBC [message #4758 is a reply to message #4542] Wed, 13 June 2018 11:29 Go to previous messageGo to next message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
I couldn't stay away from electronics and continue to work on Z280 albeit at a lower level of efforts. TinyZ280 had served its purpose as a learning platform. I gave a couple of them away and put the remaining boards on eBay hoping to recoup my development cost but was shocked to find how high people bid them up. With TinyZ280 winding down, I returned to the original idea of TinyZZ where a Z280 SBC with connector can be plugged into solderless breadboard to help me with experimentation. Along the way I discovered a line of Z80 family modules called RC2014. Its simplicity appears to me and its single-in-line bus connector can also plug into a solderless breadboard like what I envisioned for TinyZZ. So I redesigned the TinyZ280 to have a RC2014 bus interface and renamed it Z280RC. Like TinyZ280, Z280RC is a single board computer but with only 2 meg of DRAM and an expansion port that can interface to RC2014 I/O modules. Here are the features of Z280RC:

Z280 CPU running at 14.7MHz with bus speed of 7.37 MHz
2 megabyte of DRAM
RAM-only system, shadow ROM is stored in CF disk and loaded in RAM at power on or reset
Bus connected 16-bit wide CF interface
RTC based on DS1302
Four 8-meg CF drives (A: to D:)
1.5-meg RAM drive (E:)
One internal UART at 115200 baud, odd parity, no handshake
bootstrap from CF disk to ZZMon, a simple monitor
CP/M 2.2
CP/M 3 non-banked
A standalone single-board computer with I/O expansion bus compatible with RC2014 I/O bus

The wiki page for Z280RC is here:
https://www.retrobrewcomputers.org/doku.php?id=builderpages: plasmo:z280rc

The hardware appears to be quite stable and producible even with the 12MHz CPU overclocked to 14.7MHz. I built up 8 boards and 7 of them worked up to 17MHz. One board is flaky at 14.7MHz but stable at 12MHz.

Still have quite a bit of hardware/firmware/software I need to do. I like to turn on the burst mode memory access but my CPLD is low on available logic. A board revision is needed to fix the engineering changes and shuffle the CPLD assignments to free up some logic. I also want to port the banked version of CP/M3 to it. It'll be a busy summer in many ways.
Re: TinyZZ, a Z280 SBC [message #4759 is a reply to message #4758] Fri, 15 June 2018 15:44 Go to previous messageGo to next message
etchedpixels is currently offline  etchedpixels
Messages: 333
Registered: October 2015
Senior Member
Only 2MB... but how will anyone fit software in that ! ;-)

Nice - and I like the idea of using the RC2014 - even if it's a bit crude as a bus it has some handy I/O cards.

Alan
Re: TinyZZ, a Z280 SBC [message #4796 is a reply to message #4759] Tue, 26 June 2018 10:27 Go to previous messageGo to next message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
I'm more or less done with the documentation of the Z280RC.
https://www.retrobrewcomputers.org/doku.php?id=builderpages: plasmo:z280rc

I still have 4 assembled/tested Z280RC boards for $50 each listed in the board inventory page (toward the bottom of the page):
https://www.retrobrewcomputers.org/doku.php?id=boardinventor y

Bill
Re: TinyZZ, a Z280 SBC [message #7676 is a reply to message #4796] Wed, 20 May 2020 05:50 Go to previous messageGo to next message
etchedpixels is currently offline  etchedpixels
Messages: 333
Registered: October 2015
Senior Member
I think I am still finding more Z280 bugs Cool

This fails even with all the caches off and a cache flush in the middle

ld hl,0 ; a ROM address
ld a,(hl)
inc (hl)
cp (hl)

Alan
Re: TinyZZ, a Z280 SBC [message #7682 is a reply to message #7676] Thu, 21 May 2020 11:26 Go to previous messageGo to next message
hperaza is currently offline  hperaza
Messages: 68
Registered: March 2017
Member
etchedpixels wrote on Wed, 20 May 2020 05:50
I think I am still finding more Z280 bugs Cool

This fails even with all the caches off and a cache flush in the middle

ld hl,0 ; a ROM address
ld a,(hl)
inc (hl)
cp (hl)

Alan

Can't try it on the Z280RC (no ROM) and on the CPU280 can't access the ROM without some code juggling... I suppose the bug is that it behaves like if it was RAM? On RAM addresses it seems to work fine. Z80 or Z280 bus mode?
Re: TinyZZ, a Z280 SBC [message #7683 is a reply to message #7682] Fri, 22 May 2020 11:40 Go to previous messageGo to next message
etchedpixels is currently offline  etchedpixels
Messages: 333
Registered: October 2015
Senior Member
On RAM it works fine. I suspect it is keeping (hl) internally as an optimization and not flushing it. There is other stuff going on too, when I try and do ordinary bank switching weirdness happens (again cache on or off) in Z80 bus mode if I execute code, flip banks, do some I/O into memory in the new bank, flip back and then do stuff. Again caches on or off, prefetch hazards accounted for as far as I can see. Unfortunately I don't see any way to debug it without a fairly fancy logic analyzer.
Re: TinyZZ, a Z280 SBC [message #7684 is a reply to message #7683] Sat, 23 May 2020 00:29 Go to previous messageGo to next message
hperaza is currently offline  hperaza
Messages: 68
Registered: March 2017
Member
etchedpixels wrote on Fri, 22 May 2020 11:40
On RAM it works fine. I suspect it is keeping (hl) internally as an optimization and not flushing it. There is other stuff going on too, when I try and do ordinary bank switching weirdness happens (again cache on or off) in Z80 bus mode if I execute code, flip banks, do some I/O into memory in the new bank, flip back and then do stuff. Again caches on or off, prefetch hazards accounted for as far as I can see. Unfortunately I don't see any way to debug it without a fairly fancy logic analyzer.

That behavior is actually documented: see page 7-6 of the Z280 Technical Manual, last paragraph near the bottom-right corner of the page, which warns about the CPU pipeline not being flushed after a MMU register is changed. It also has that phrase in parenthesis "(However, no data accesses are pre-fetched.)" where the parenthesis do not make that much sense until you remember that the docs says "Preliminary" (like most Zilog's docs do, BTW).

I've respected that caveat in RSX280, and never ran into any problems.

I'd stay away of the Z80 bus mode as well, as Zilog itself discouraged its use.

[Updated on: Sat, 23 May 2020 03:13]

Report message to a moderator

Re: TinyZZ, a Z280 SBC [message #7690 is a reply to message #7684] Sat, 23 May 2020 17:49 Go to previous messageGo to next message
etchedpixels is currently offline  etchedpixels
Messages: 333
Registered: October 2015
Senior Member
This isn't the Z280 MMU - its plugged into an RC2014 backplane with standard RAM/ROM so it's stuck with Z80 mode. I do have the various bits of pipelining accounted for - on a bank switch I flush the cache and then ret which forces a pipeline stall for data. In fact I can put other stuff there as well and it doesn't help.

I suspect you are right about the Z80bus mode being involved - it took them until the H stepping to even make Z80 bus usable, but my CPU is post 1988 so ought to be ok (and the cache disable doesn't fix it either).

Alan
Re: TinyZZ, a Z280 SBC [message #7692 is a reply to message #7690] Sat, 23 May 2020 20:15 Go to previous messageGo to next message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
Alan,
Could you provide a snippet of Z280 code operating in Z80 mode so I can try it? I do have a fairly good logic analyzer and I can take a close loop at the bus transaction.
Bill
Re: TinyZZ, a Z280 SBC [message #7693 is a reply to message #7692] Sun, 24 May 2020 06:53 Go to previous messageGo to next message
etchedpixels is currently offline  etchedpixels
Messages: 333
Registered: October 2015
Senior Member
For the crash case I don't have a snippet - it's the CP/M 3 loader issuing a disk read the bios pages in the rom (which holds the BIOS), pages out the ROM via a helper in high common memory, does the two inirs, pages the ROM back in and then restores everything and pages the ROM back out, then the CP/M code execution goes nonsensical. It's a fairly long sequence of instructions that would need capturing therefore even if capturing from the completion of the inir I/O transfers.

For the ROM test case it's just

ld a,(hl)
inc (hl)
purge
cp (hl)

and I am fairly sure you'll see a fetch of the LD, a prefetch of the INC a fetch of (HL) and a prefetch of the CP, and there won't be a second read of (HL). That one is just an annoyance where I need to work out a way to defeat the CPU being clever.
Re: TinyZZ, a Z280 SBC [message #7696 is a reply to message #7693] Sun, 24 May 2020 11:31 Go to previous message
plasmo is currently offline  plasmo
Messages: 916
Registered: March 2017
Location: New Mexico, USA
Senior Member
OK, I believe your ROM case is for Z280 operating in Z80 compatible mode, and the MMU and cache are disabled? I'll try it.
Bill
Previous Topic: PIC TV clock
Next Topic: ECB 4MEM question


Current Time: Mon Mar 17 05:00:41 PDT 2025

Total time taken to generate the page: 0.00864 seconds