Archive

Posts Tagged ‘saturate’

Designing a processor for increased source portability costs

February 9th, 2010 Derek-Jones 4 comments

How might a vendor make it difficult for developers to port open source applications to their proprietary cpu? Keeping the instruction set secret is one technique, another is to design a cpu that breaks often relied upon assumptions that developers have about the characteristics of the architecture on which their code executes.

Of course breaking architectural assumptions does not prevent open source being ported to a platform, but could significantly slow down the migration; giving more time for customers to become locked into the software shipped with the product.

Which assumptions should be broken to have the maximum impact on porting open source? The major open source applications (e.g., Firefox, MySQL, etc) run on 32/64-bit architectures that have an unsigned address space, whose integer representation uses two’s complement arithmetic and arithmetic operations on these integer values wrap on over/underflow.

32/64-bit. There is plenty of experience showing that migrating code from 16-bit to 32-bit environments can involve a lot of effort (e.g., migrating Windows 286/386 code to the Intel 486) and plenty of companies are finding the migration from 32 to 64-bits costly.

Designing a 128-bit processor might not be cost effective, but what about a 40-bit processor, like a number of high end DSP chips? I suspect that there are many power-of-2 assumptions lurking in a lot of code. A 40-bit integer type could prove very expensive for ports of code written with a 32/64-bit mindset (dare I suggest a 20-bit short; DSP vendors have preferred 16-bits because it uses less storage?).

Unsigned address space (i.e., lowest address is zero). Some code assumes that addresses with the top bit set are at the top end of memory and not just below the middle (e.g., some garbage collectors). Processors having a signed address space (i.e., zero is in the middle of storage) are sufficiently rare (e.g., the Inmos Transputer) that source is unlikely to support a HAS_SIGNED_ADDRESS build option.

How much code might need to be rewritten? I have no idea. While the code is likely to be very important there might not be a lot of it.

Two’s complement. Developers are constantly told not to write code that relies on the internal representation of data types. However, they might be forgiven for thinking that nobody uses anything other than two’s complement to represent integer types these days (I suspect Univac does not have that much new code ported to it’s range of one’s complement machines).

How much code will break when ported to a one’s complement processor? The representation of negative numbers in one’s complement and two’s complement is different and the representation of positive numbers the same. In common usage positive values are significantly more common than negative values and many variables (having a signed type) never get to hold a negative value.

While I have no practical experience, or know of anybody who has, I suspect the use of one’s complement might not be that big a problem. If you have experience please comment.

Arithmetic that wraps (i.e., positive values overflow negative and negative values underflow positive). While expressions explicitly written to wrap might be rare, how many calculations contain intermediate values that have wrapped but deliver a correct final result because they are ‘unwrapped’ by a subsequent operation?

Arithmetic operation that saturate are needed in applications such as graphics where, for instance, increasing the brightness should not suddenly cause the darkest setting to occur. Some graphics processors include support for arithmetic operations that saturate.

The impact of saturation arithmetic on portability is difficult to judge. A lot of code contains variables having signed char and short types, but when they appear as the operand in a binary operation these are promoted to int in C/C++/etc which probably has sufficient range not to overflow (most values created during program execution are small). Again I am lacking in practical experience and comments are welcome.

Floating-point. Many programs do not make use of floating-point arithmetic and those that do rarely manipulate such values at the bit level. Using a non-IEEE 754 floating-point representation will probably have little impact on the portability of applications of interest to most users.

Update. Thanks to Cate for pointing out that I had forgotten to discuss why using non-8-bit chars does is not a worthwhile design decision.

Both POSIX and the C/C++ Standards require that the char type be represented in at least 8 bits. Computers supporting less than 8-bits were still being used in the early 80s (e.g., the much beloved ICL 1900 supported 6-bit characters). The C Standard also requires that char be the smallest unit of addressable storage, which means that it must be possible for a pointer to point at an object having a char type.

Designing a processor where the smallest unit of storage is greater than 8-bits but not a power-of-2 is likely to substantially increase all sorts of costs and complicate things enormously (e.g., interfaces to main memory which are designed to work with power of two interfaces). The purpose of this design is to increase other people’s cost, not the proprietary vendor’s cost.

What about that pointer requirement? Perhaps the smallest unit of storage that a pointer could address might be 16 or 40 bits? Such processors exist and compiler writers have used both solutions to the problems they present. One solution is for a pointer to contain the address of the storage location + offset of the byte within that storage (Cray used this approach on a processor whose pointers could only point at 64-bit chunks of storage, with the compiler generating the code to extract the appropriate byte), the other is to declare that the char type occupies 40-bits (several DSP compilers have taken this approach).

Having the compiler declare that char is not 8-bits wide would cause all sorts of grief, so lets not go there. What about the Cray compiler approach?

Some of the address bits on 64-bit processors are not used yet (because few customers need that amount of storage) so compiler writers could get around host-processor pointers not supporting the granularity needed to point at 8-bit objects by storing the extra information in ‘unused’ pointer bits (the compiler generating the appropriate insertion and extraction code). The end result is that the compiler can hide pointer addressability issues :-) .

www.wenn.com
FireStats icon Powered by FireStatswww.tinynibbles.com cialis overnight

cialis tablets foreign

buy generic cialis

cialis price 100 mg

cheapest propecia sale uk

canadian viagra

best price levitra

lowest propecia 1 mg

indian cialis generic

buying generic propecia

online pharmacy propecia renova

best price cialis

buy cheap levitra online

order generic levitra

order levitra online

cialis one a day

levitra prescription

online generic cialis 100 mg

how to get cialis in canada

generic levitra purchase

canada viagra generic

cialis strenght mg

buy propecia generic

buy levitra vardenafil

low cost propecia

levitra mg

buy levitra online from canada

natural viagra

levitra online sales

buying cialis

best way to use cialis

buy fast propecia

mail order propecia

cialis from mexico

generic propecia online pharmacy

5 mg daily cialis

cialis daily

generic propecia 5mg

cialis and canada custom

i need to buy propecia

levitra for sale

bestellen levitra online

lowest price propecia

cialis fast delivery

levitra online overnight delivery

how much is viagra

ordering propecia online

canada meds viagra

generic levitra cheap

levitra viagra cialis

buying propecia

generic viagra online

cialis to buy

buy propecia now

order cheap propecia

overnight delivery cialis

cheap propecia online prescription

buy generic levitra

levitra 10mg

how to get viagra

levitra cost

cialis 100 mg

next day delivery cialis

lowest price levitra

cheap levitra

generic viagra 100 mg

buy real viagra online

buy viagra mexico

generic levitra online

buy viagra on line

buy can from i propecia who

cialis in mexico

cheapest viagra

cialis generic 100 mg

canadian healthcare

buy 5 mg cialis

overnight delivery viagra

generic cialis soft tabs

buy propecia online pharmacy

cialis discounts

cialis next day

buy cialis in usa

buy dosages levitra

generic propecia alternative

can i get viagra in mexico

generic cialis from india

generic propecia effective

hydrochlorothiazide cialis

cheap cialis soft

buy online prescription propecia

buy discount viagra

levitra where to buy

levitra online

buy viagra

discount levitra purchase

discount levitra online

levitra online no prescription

buy propecia without prescription

discount us propecia

cialis 100 mg generic

generic propecia fda approved

cheapest overnight cialis

cialis on women

buy levitra uk

cialis and ketoconazole

discount generic propecia

get levitra

cialis professional no prescription

generic viagra canada

indian cialis

canadian viagra india

buy propecia where

online levitra

best price for propecia

cialis price in canada

levitra sales uk

online viagra gel to buy

lowest propecia prices in canada

generic viagra india

getting cialis from canada

levitra tabs

discount propecia propecia

levitra online prescription

generic propecia finasteride

cheapest propecia uk

low cost canadian viagra

healthcare canadian pharmacy

mail online order propecia

brand viagra over the net

canada online pharmacy levitra

cheap viagra from uk

cialis daily in canada

order viagra or levitra

cheap prescription propecia

cialis fast delivery usa

levitra in canada

cialis 5 mg

buying levitra online

cialis woman

lowest price for propecia

buy levitra online no prescription

cialis headaches

cheap levitra uk

cialis cheap

cialis refractory

cheap order prescription propecia

levitra online us

how much does cialis cost

indian generic levitra

mexico pharmacy cialis

best viagra

buy cialis canada

cialis quick shipment

lowest price on non generic levitra

order prescription propecia

online propecia prescription

cialis transdermal

buy cialis 5 mg

cialis tablets

discount propecia online

buy generic propecia

buy viagra online cheap us

china viagra

cialis alternative

low cost levitra

canada levitra

cialis professional 100 mg

buy generic viagra india rx

buy cialis usa

best price generic propecia

cialis en mexico

cheap viagra canada or india

low price levitra

discount levitra rx

buying cialis next day delivery

cialis professional 20 mg

generic cialis sale

brand name cialis overnight

order propecia

cheap propecia online

cialis discount

canadian pharmacy cialis

buy levitra us

cheap propecia uk

levitra buy online

cheapest propecia prescription

drug generic propecia

generic propecia for sale

does generic cialis work

buying cialis soft tabs 100 mg

how much cialis

buy viagra online

50 mg cialis

generic levitra vardenafil

buy propecia online prescription

generic cialis next day shipping

cialis and diarrhea

canadian viagra and healthcare

buying viagra in canada

lowest price propecia best

cialis price

cheap viagra online

cialis by mail

buy propecia on line

cost levitra low

buy cialis once daily

cialis prescription

levitra discount

generic viagra canadian

cheapest viagra usa

get levitra online

cialis no prescription

mail order levitra

levitra cheap fast

daily dosage cialis

generic propecia sale

best price propecia

buy canada levitra

levitra order prescription

canadian drugs propecia

generic viagra made in india

once a day viagra

buy viagra germany canadian meds

buying online propecia

levitra pill

once daily cialis

canada generic propecia

buy cialis cannada

cialis online

online cheap viagra

buying propecia online

buy propecia cheap

canadian viagra 50mg

cialis dosage mg

fda levitra

buy cialis online canada

buy now propecia

buy cialis fedex shipping

cheapest prices for viagra

canadian propecia rx

buy propecia online

cialis cheap us pharmacy

cheap discount levitra

ordering cialis gel

buy cialis for daily use

cost of daily cialis

levitra low price

buy cialis online uk

order cheapest propecia online

obtain viagra without prescription

online pharmacy propecia viagra

lowest priced propecia

canadian healthcare viagra

buy levitra online viagra

canada online pharmacy propecia

levitra next day delivery

get cialis online

cialis daily dosage pharmacy

cheap propecia no prescription

online propecia uk

how strong is 5 mg of cialis

cheap cialis from india

bio viagra herbal

cialis 20 mg

cheap cialis

buy cheap generic levitra

best price for generic cialis

canada viagra

cialis overnight delivery

get propecia online pharmacy

canadian pharmacies cialis

buy cheap generic propecia

buy cheap levitra

cialis pharmacy

cialis uk

buy viagra without prescription

gele viagra

cialis for woman

lowest cost levitra

cialis delivered overnight

info levitra

generic levitra overnight delivery

herbal propecia

genuine cialis pills

canadian online pharmacy cialis

brand viagra professional

lowest propecia prices

cialis from canada

cialis soft pills

discount propecia rx

buy cialis without prescription

cost of viagra

buy propecia online from usa pharmacy

generic viagra made in usa

levitra in india

buy cheapest propecia

cialis buy overnight

for sale levitra

name brand cialis

order cheap levitra