[comp.sys.amiga.tech] Longword alignment with 68020

nsw@cord.UUCP (Neil Weinstock) (02/20/89)

Quickie question:

Do the 68020/32-bit memory boards (ala A2620) require that longword data
be longword-aligned?  I suspect that they do, but I want to be sure.

(The blitter requires its data word-aligned, right?  That has been my
experience.)

 /.- -- .. --. .- .-. ..- .-.. . ... .- -- .. --. .- .-. ..- .-.. . ...\
/ Neil Weinstock | att!cord!nsw     | "One man's garbage is another     \
\ AT&T Bell Labs | nsw@cord.att.com | man's prune danish." - Harv Laser /
 \.- -- .. --. .- .-. ..- .-.. . ... .- -- .. --. .- .-. ..- .-.. . .../

daveh@cbmvax.UUCP (Dave Haynie) (02/22/89)

in article <712@cord.UUCP>, nsw@cord.UUCP (Neil Weinstock) says:

> Quickie question:

> Do the 68020/32-bit memory boards (ala A2620) require that longword data
> be longword-aligned?  I suspect that they do, but I want to be sure.

No, actually, the 68020 is less demanding about word alignment than the 
68000.  It wants instructions word aligned, but data doesn't have to be
aligned at all.  However, if a longword datum isn't longword aligned, the
'020 will take two cycles to get at it, which will of course make fetching
that thing 1/2 as fast as it could be.


> / Neil Weinstock | att!cord!nsw     | "One man's garbage is another     \
> \ AT&T Bell Labs | nsw@cord.att.com | man's prune danish." - Harv Laser /


-- 
Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
              Amiga -- It's not just a job, it's an obsession

scotth@harlie.SGI.COM (Scott Henry) (02/22/89)

From article <6031@cbmvax.UUCP>, by daveh@cbmvax.UUCP (Dave Haynie):
> 
> No, actually, the 68020 is less demanding about word alignment than the 
> 68000.  It wants instructions word aligned, but data doesn't have to be
> aligned at all.  However, if a longword datum isn't longword aligned, the
> '020 will take two cycles to get at it, which will of course make fetching
> that thing 1/2 as fast as it could be.

Does this mean that the 68020 will work with byte-aligned word and longword
data? That's the only interpretation of "less demanding" that fits this
context. No more odd-address traps on data? :-)? Is this, then another
potential incompatibility with the 680?0 series?

> -- 
> Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
>    {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
>               Amiga -- It's not just a job, it's an obsession
--
---------------------
              Scott Henry <scotth@sgi.com>
#include <std_disclaimer.h>

ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) (02/22/89)

In article <712@cord.UUCP> nsw@cord.UUCP (Neil Weinstock) writes:
>Do the 68020/32-bit memory boards (ala A2620) require that longword data
>be longword-aligned?  [ ... ]
>
	No.  You will achieve optimum performance if you do align your
logwords/pointers on longword boundaries, but you'll still be able to fetch
longwords on arbitrary word boundaries.

	As an extra added bonus, the '020 will read and write words on odd
*byte* boundaries (but you pay a heavy performance penalty).  An entire
class of Gurus almost disappears!  (Type 00000003, Address error.)

>(The blitter requires its data word-aligned, right?  That has been my
>experience.)
>
	Yes.

_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
Leo L. Schwab -- The Guy in The Cape	INET: well!ewhac@ucbvax.Berkeley.EDU
 \_ -_		Recumbent Bikes:	UUCP: pacbell > !{well,unicom}!ewhac
O----^o	      The Only Way To Fly.	      hplabs / (pronounced "AE-wack")
"Work FOR?  I don't work FOR anybody!  I'm just having fun."  -- The Doctor

daveh@cbmvax.UUCP (Dave Haynie) (02/23/89)

in article <27183@sgi.SGI.COM>, scotth@harlie.SGI.COM (Scott Henry) says:
> From article <6031@cbmvax.UUCP>, by daveh@cbmvax.UUCP (Dave Haynie):

>> ... but data doesn't have to be aligned at all.  

> Does this mean that the 68020 will work with byte-aligned word and longword
> data? 

Is there an echo in here?

> No more odd-address traps on data? :-)? Is this, then another potential 
> incompatibility with the 680?0 series?

You got it.  It's an Amiga operating system requirement that word or longword 
data be word aligned, and, in some cases, longword aligned.  It is not in any
way a requirement of the 68020 or 68030 hardware.  The reason for this is that
the 32 bit CPUs have a much more clever bus sizing mechanism than the 16 bit
ones.  The 68020/30 can do other strange things, like running code out of 8
bit memory, that the 68000/10 can't.  

>> Dave Haynie ...

>               Scott Henry <scotth@sgi.com>

-- 
Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
              Amiga -- It's not just a job, it's an obsession

jesup@cbmvax.UUCP (Randell Jesup) (02/25/89)

In article <10803@well.UUCP> ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
>	As an extra added bonus, the '020 will read and write words on odd
>*byte* boundaries (but you pay a heavy performance penalty).  An entire
>class of Gurus almost disappears!  (Type 00000003, Address error.)

	Right, the Guru is not a 3.  However, instead of guruing it grabs 
bad data and runs with it, maybe corrupting things without indication. :-(

	Now where was that 68000/68010 address error compatibility bit....
(just joking)

-- 
Randell Jesup, Commodore Engineering {uunet|rutgers|allegra}!cbmvax!jesup

karl@sugar.uu.net (Karl Lehenbauer) (02/25/89)

In article <10803@well.UUCP>, ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
> 	As an extra added bonus, the '020 will read and write words on odd
> *byte* boundaries (but you pay a heavy performance penalty).  An entire
> class of Gurus almost disappears!  (Type 00000003, Address error.)

...and an entire class of bugs becomes harder to find.  Sigh.
-- 
-- uunet!sugar!karl  | "Everyone has a purpose in life.  Perhaps yours is
-- karl@sugar.uu.net |  watching television."  -- David Letterman
-- Usenet BBS (713) 438-5018

daveh@cbmvax.UUCP (Dave Haynie) (03/01/89)

in article <3503@sugar.uu.net>, karl@sugar.uu.net (Karl Lehenbauer) says:

> In article <10803@well.UUCP>, ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:
>> 	As an extra added bonus, the '020 will read and write words on odd
>> *byte* boundaries (but you pay a heavy performance penalty).  An entire
>> class of Gurus almost disappears!  (Type 00000003, Address error.)

> ...and an entire class of bugs becomes harder to find.  Sigh.

There are really two things (three, if you count memory failure) that give
you GURU 3s.  First is the simple "I didn't align my data properly" bug, which
isn't a problem with a 68020, but is with the Amiga OS.  This would result
in a GURU 3 changing into a library call error of some kind, and is harder
to track down on a 68020 system than on a 68000 system.  Fortunately, if you're
using a compiler, this one's not all that easy to get.  The second kind is
the "I'm reading E-Space and acting on it" bug, in which you perhaps forget
to reference or dereference in some place, and end up using a data value as
an address.  Some of this can be trapped by using my SetCPU V1.4 program
with the FASTROM TRAP option.  That turns on trapping of access to memory
outside of the 24 bit address space, which can catch a good portion of the
possible GURU 3s in this class, changing them into GURU 2s.

> -- uunet!sugar!karl  | "Everyone has a purpose in life.  Perhaps yours is
> -- karl@sugar.uu.net |  watching television."  -- David Letterman
> -- Usenet BBS (713) 438-5018
-- 
Dave Haynie  "The 32 Bit Guy"     Commodore-Amiga  "The Crew That Never Rests"
   {uunet|pyramid|rutgers}!cbmvax!daveh      PLINK: D-DAVE H     BIX: hazy
              Amiga -- It's not just a job, it's an obsession