English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 11 July 2022, 19:56   #1
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
Burn 100000 on the 68040

Hi folks, hope to get some help here with a pretty special request. I'm looking for a verified(!) code that burns 100000 cycles on the 68040. Assumption is that the code is cached and in cacheable memory. Thus, one can assume that the code is completely in cache. You can also assume that task switching and interrupts are disabled. The code should approximately look as follows:
Code:
  DelayLoop040:         move.l  #1000,d0 .loop:         nop                     ;8 cycles per nop         nop         nop         nop         nop         nop          nop                     ;8 cycles per nop         nop         nop         nop         nop         nop                     ;12 * 8 = 96 cycles burned         dbra    d0,.loop        ;+3 cycles for dbra = 99 cycles burned         rts
This looks like a rather strange request (even more so from me), so let me explain what this is used for. The purpose is to determine the CPU clock frequency of an 68040 board, as close as possible. For this, the current code runs a delay cycle like the above until 100ms have been spend, and then returns the number of times the above delay loop is run. As one can compute, this returns (approximately) the clock frequency of the CPU in Mhz. Now, what do I need this all for? Actually, this is part of a (new) driver for a GVP EGS 110 graphics board, and as it looks, the board requires a configuration of the number of wait states of its memory. The number of wait states depends on the clock frequency of the host CPU as the card connects directly to the board. Thus, please provide algorithms, (i.e. I need the number of NOPs and the loop counter for the dbra), and please verify that, indeed, the requested number of cycles is burned, for example by cross-checking with the CIA-E clock. Thanks a lot, and I hope I get some help for this (as much as I hate cycle counting, this time it is needed (- Greetings, Thomas
Thomas Richter is online now  
Old 12 July 2022, 03:49   #2
Don_Adan
Registered User
 
Join Date: Jan 2008
Location: Warsaw/Poland
Age: 56
Posts: 2,085
Why not, something like this?

Code:
 move.w #999,D0
Loop
 addq.l #1,D1 ; 1 (1 cycle)
 addq.l #1,D1 ; 2
...
 addq.l #1,D1 ; 97
 dbf D0,Loop (3 cycles)
 rts
Don_Adan is offline  
Old 12 July 2022, 08:11   #3
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
It doesn't really matter what is in the loop as long as you had it verified. "NOP" seemed like a good alternative since it seems to burn more cycles (less instructions), but that does not matter too much. It does not have to be super precise.
Thomas Richter is online now  
Old 12 July 2022, 11:05   #4
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,377
NOP can burn many cycles because it triggers a pipeline resync. Thus its timing may eventually depend on what the cpu was doing before.
meynaf is online now  
Old 12 July 2022, 11:07   #5
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
Absolutely. This is why I need it verified for the 68040. I have a verified NOP delay loop for the 68030, but I cannot simply reuse the same loop for the 68040 for the reasons you gave. The NOP on the 68040 will spend a different (more?) number of cycles than the NOP on the 68030.
Thomas Richter is online now  
Old 12 July 2022, 11:25   #6
meynaf
son of 68k
 
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,377
Why using NOP then ? It does not look like a very reliable source for cycle counting.
Unfortunately i don't own a 040 so i can't verify timings, but Don Adan's code looks good enough.
meynaf is online now  
Old 12 July 2022, 12:24   #7
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
That's not any different with any other instruction - timing will differ between the 68030 and 68040 anyhow, so I need two delay loops in first place. Anyhow, I'm not insisting on NOP, I only need to be sure it really burns the requested number of cycles.
Thomas Richter is online now  
Old 12 July 2022, 12:49   #8
aros-sg
Registered User
 
Join Date: Nov 2015
Location: Italy
Posts: 193
Can't you do something self calibrating like it's being done elsewhere to implement things like very small (busy looping) time delays.
aros-sg is offline  
Old 12 July 2022, 14:10   #9
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
Hmm, do you have anything particular in mind? Just to remind you, the point of the whole exercise is to find the clock speed of the CPU, which I need to configure the wait states of a graphics card attached directly to the turbo board.
Thomas Richter is online now  
Old 12 July 2022, 14:25   #10
Locutus
Registered User
 
Join Date: Jul 2014
Location: Finland
Posts: 1,192
Sorry if this is stupid

...But isn't this over engineering? If you only need the approximate clock in MHz, why not ask it the end user during the installation process?

I can't imagine there are many users with this setup who wouldn't know their installed CPU clock speed.
Locutus is offline  
Old 12 July 2022, 16:05   #11
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
Well, you know, if the casual user has to modify a tool type to get a driver working, chances are that this doesn't work. I have no problem adding a tool type for this type of configuration, but the driver should work out of the box without user intervention.
Thomas Richter is online now  
Old 12 July 2022, 17:12   #12
alexh
Thalion Webshrine
 
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 14,582
Quote:
Originally Posted by Thomas Richter View Post
I have no problem adding a tool type for this type of configuration, but the driver should work out of the box without user intervention.
Is there a big range of speeds? 25MHz, 33MHz, 40MHz?
alexh is offline  
Old 12 July 2022, 17:26   #13
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
Ok, here a test program instead:

http://eab.abime.net/attachment.php?...1&d=1657639518

Please run on an 68040 system, please report the result, and the true CPU clock of the system.

Thanks!
Attached Files
File Type: zip SpeedTest.zip (1.5 KB, 132 views)
Thomas Richter is online now  
Old 12 July 2022, 17:27   #14
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
Quote:
Originally Posted by alexh View Post
Is there a big range of speeds? 25MHz, 33MHz, 40MHz?
No, not at all, only what GVP managed to manufacture as Turbo boards. It is pretty much the above range. Thus, it doesn't have to be super-precise, but it needs to distinguish the clocks to switch between 2 to 5 wait states, depending on the board frequency.
Thomas Richter is online now  
Old 15 July 2022, 15:01   #15
Mathesar
Registered User
 
Mathesar's Avatar
 
Join Date: Aug 2014
Location: Netherlands
Posts: 702
Forget about it if this is a stupid idea but:

If you can read/write into the graphics card memory. Can't you do a memory test to see how many wait states are needed for a reliable data transfer?

Also, I don't have a 040 system to test on otherwise I would have helped.
Mathesar is offline  
Old 15 July 2022, 15:53   #16
grond
Registered User
 
Join Date: Jun 2015
Location: Germany
Posts: 1,948
Quote:
Originally Posted by Mathesar View Post
If you can read/write into the graphics card memory. Can't you do a memory test to see how many wait states are needed for a reliable data transfer?
Such tests are usually not reliable because the system will behave differently when the computer heats up.

From what I read in the German forum, the problem has been solved, Thomas has working code already.
grond is offline  
Old 15 July 2022, 17:37   #17
paraj
Registered User
 
paraj's Avatar
 
Join Date: Feb 2017
Location: Denmark
Posts: 1,284
Quote:
Originally Posted by grond View Post
Such tests are usually not reliable because the system will behave differently when the computer heats up.

From what I read in the German forum, the problem has been solved, Thomas has working code already.

That's interesting. Does the graphics card do thermal throttling?
(Would have helped if I could with the measurements, but "only" have a 060).
paraj is offline  
Old 15 July 2022, 23:49   #18
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,382
Actually, I doubt such ancient technology uses thermal throttling, it is more a matter of system tolerances such that a particular configuration when measured with a cold system no longer remains stable once the system heats up as tolerances are then exceeded. It is also hard to actually detect the issues with bit flips into video RAM without actually turning the video on and trying to reproduce the issue by flooding the bus with writes.

But as ground said, the problem is resolved. Funny enough, my 68040 "computed delay loop" worked right from its design sketch, a rather rare circumstance.
Thomas Richter is online now  
Old 16 July 2022, 12:09   #19
grond
Registered User
 
Join Date: Jun 2015
Location: Germany
Posts: 1,948
As Thomas says, semiconductors get "slower" (it's more complicated physics but let's skip this) as they heat up. This can also affect power supply and a lot of other factors that determine how a processor or bus driver chip will operate.
grond is offline  
Old 16 July 2022, 12:23   #20
alexh
Thalion Webshrine
 
alexh's Avatar
 
Join Date: Jan 2004
Location: Oxford
Posts: 14,582
Quote:
Originally Posted by grond View Post
As Thomas says, semiconductors get "slower" (it's more complicated physics but let's skip this) as they heat up.
That is not strictly true. Semiconductors are designed so that they work correctly at the speed they are being clocked across a range of temperatures.

Heat should have no affect on tests like these.

What is more likely to affect speed is other bus traffic. If you stay inside the CPU, in the cache then external factors such as bus traffic etc. are ruled out.
alexh is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
68040 to 68060 adapter respin with A2000 and Zeus 68040 Accelerator richx support.Hardware 14 26 April 2022 05:46
Changing 68040 25 to 68040 33 on 603e plus Jpor support.Hardware 27 06 January 2022 22:20
Amiga a3640 processor card and 68040/68040 processors Euphoria MarketPlace 3 26 February 2017 21:15
Burn out stainy HOL data problems 0 24 April 2006 13:37
burn several isos on one cd? Dasse New to Emulation or Amiga scene 13 01 December 2003 03:47

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 22:14.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.12418 seconds with 14 queries