English Amiga Board


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

 
 
Thread Tools
Old 24 January 2022, 22:41   #1
Auscoder
Registered User

 
Join Date: Jan 2019
Location: Brisbane
Posts: 87
memory read/write penalty

Hey all, I understand there are extra memory access needed to read/write to odd addresses on 68020+ and it’s not possible on 68000/010, but what about for 68020+ with a long word read or write to a 2 byte alignment that is not a 4 byte alignment. Any additional cost for longs at those addresses?

As a side question, for the odd addresses is the penalty 2x access cost?

Thanks!
Auscoder is offline  
Old 24 January 2022, 22:53   #2
a/b
Registered User

 
Join Date: Jun 2016
Location: europe
Posts: 623
Yeah, 020+ has to read two consecutive 32-bit data if the address is only 1 or 2 byte aligned (not on a 32-bit boundary).

Last edited by a/b; 24 January 2022 at 23:26. Reason: typo...
a/b is online now  
Old 24 January 2022, 23:13   #3
Auscoder
Registered User

 
Join Date: Jan 2019
Location: Brisbane
Posts: 87
Ok good to know, thanks! Couldn’t find much info except for the odd addresses.
Auscoder is offline  
Old 25 January 2022, 07:44   #4
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 49
Posts: 4,535
Not all odd addresses have a penalty. If you access a word that is fully contained inside an aligned long, then it is accessed at full speed. IOW, if the word is at an address of 1 modulo 4.
meynaf is offline  
Old 25 January 2022, 13:32   #5
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,095
But what happens when you read word or long sequences from a not aligned memory block? Do you get a possible penalty only for the first read access, but then the following reads can re-use the previous data from the cache and only need to fetch the subsequent words or longwords from memory? Or is there still a cache read penalty?
PeterK is offline  
Old 25 January 2022, 14:38   #6
paraj
Registered User

 
Join Date: Feb 2017
Location: Denmark
Posts: 289
Quote:
Originally Posted by PeterK View Post
But what happens when you read word or long sequences from a not aligned memory block? Do you get a possible penalty only for the first read access, but then the following reads can re-use the previous data from the cache and only need to fetch the subsequent words or longwords from memory? Or is there still a cache read penalty?
Cache lookups are performed on a (aligned) longword basis, so if your read operation straddles a longword boundary you'll have 2 cache lookups (each of which could result in a cache miss). Even if both longwords are in the same cache line you'll still occur a penalty. For 68060 it's 1 clock cycle (2 for RMW instructions), see MC68060UM 10.2.5. I'm not sure what the exact penalties are for 030 and 040 but the user manuals contain similar language.
paraj is offline  
Old 25 January 2022, 14:55   #7
PeterK
Registered User
 
Join Date: Apr 2005
Location: digital hell, Germany, after 1984, but worse
Posts: 3,095
Thanks paraj, good to know that, because I always have my difficulties to understand the timing tables and the exact calculation of required clock cycles, and under WinUAE I can hardly measure with benchmarks how fast a real CPU would execute the code.
PeterK 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
Memory Read/Write xArtx Coders. C/C++ 20 18 March 2016 13:50
read/write error? backtoskooldaze support.Hardware 3 07 September 2011 15:22
read but wont write Dave_wb support.Hardware 0 09 December 2006 14:04
Read\Write Errors..... THX1138 support.Apps 10 13 October 2004 15:24
CD Read Write Errors Stom support.WinUAE 2 07 June 2002 18:46

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 23:31.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.
Page generated in 0.12734 seconds with 15 queries