Home > Uncategorized, data analysis > Designing a processor for increased source portability costs

Designing a processor for increased source portability costs

February 9th, 2010 Derek-Jones

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 :-) .

  1. February 9th, 2010 at 08:31 | #1
  2. cate
    February 9th, 2010 at 09:35 | #2

    You forgot some usual assumptions:
    - char is 8 bits (from POSIX)
    - strange endianness (it seems that a lot of program uses custom function to transform data)
    - pointer are longer than long (IIRC since C99)

    The first two items are important to read binary files (e.g. images) or from network. Programs use custom function but now that all devices must share data such assumptions could slow down porting applications.

  3. February 9th, 2010 at 12:01 | #3

    @Tony Finch
    The diagram on that page clearly shows zero at the bottom and FFF… at the top. In a signed address space zero sits in the middle of memory. I did not see any obvious errors in the article saying that the address space was signed.

  4. February 9th, 2010 at 12:43 | #4

    @cate Thanks for pointing out that I need to discuss 8-bit chars; now done!

    The Intel x86 and many RISC chips have opposite byte endianness which ensures that this issue is addressed by a lot of Open Source code. What about word endianness (i.e., swapping 16-bit quantities) like that used by the DEC (now HP) VAX? This is an interesting possibility that I had overlooked.

    Having pointers occupy more bits than a long (the IBM RS/400 has 16 byte pointers!) introduces all sorts of extra costs for the processor vendor, so I don’t think that this is a cost effective option.

  1. No trackbacks yet.
Comments are closed.
www.wenn.com
FireStats icon Powered by FireStatswww.tinynibbles.com buy dosages levitra

buying cialis next day delivery

buy discount viagra

generic cialis next day shipping

cheap propecia online prescription

canada viagra pharmacies scam

buy cialis cannada

cost of daily cialis

levitra online no prescription

buy viagra online

canadian pharmacy cialis

once daily cialis

generic viagra canada

cialis dosage mg

cheap levitra without prescription

online generic cialis 100 mg

generic propecia alternative

buy cialis usa

cialis daily

cialis 50 mg

levitra sales uk

cialis strenght mg

buy propecia now

cheap cialis from india

levitra online sales

ordering cialis gel

levitra next day delivery

cialis prescription

cheapest viagra

cialis professional no prescription

buy cialis canada

levitra prescription

generic cialis from india

how to get viagra

generic propecia finasteride

cialis generic 100 mg

obtain viagra without prescription

canadian propecia rx

buy viagra without prescription

how much to buy viagra in pounds

buy propecia online

i need to buy propecia

levitra buy online

get propecia online pharmacy

natural viagra

buy propecia generic

online pharmacy propecia viagra

gele viagra

cialis 100 mg

fda levitra

levitra mg

levitra low price

lowest propecia prices

lowest price levitra

buy viagra china

levitra viagra cialis

cialis profesional

buy levitra us

genuine cialis pills

cheap viagra from uk

cialis delivered overnight

cheap propecia online

generic cialis sale

buy viagra on line

discount levitra online

cialis professional 100 mg

cialis on women

buy cialis in usa

canadian healthcare

how much does cialis cost

cialis en mexico

cheap order prescription propecia

buy cialis without prescription

cialis transdermal

best price for generic cialis

cialis headaches

brand name cialis

indian generic levitra

best price for propecia

buy propecia on line

cialis next day delivery

canadian healthcare viagra

online levitra

cialis online

canada cheap propecia

buy generic levitra

levitra now online

buy branded viagra

herbal propecia

lowest price propecia

cheapest propecia uk

cheap levitra uk

cialis and canada custom

discount drug propecia

buy levitra uk

cialis 20 mg

generic propecia fda approved

generic levitra purchase

buy levitra online no prescription

lowest priced propecia

cheap cialis soft

levitra from canadian pharmacy

cialis vs levitra

cialis discount

cheapest propecia prescription

cost of propecia

low cost canadian viagra

cheap levitra

canada generic propecia

china viagra

best price propecia

buy propecia online from usa pharmacy

cheap fast levitra

canadian healthcare pharmacy

buying propecia

generic propecia sale

canada online pharmacy levitra

buying propecia online

generic viagra india

canada viagra

ganeric cialis

cialis buy overnight

generic viagra made in usa

cialis to buy

cialis daily in canada

buy propecia where

next day viagra

online propecia prescriptions

cialis from canada

generic levitra vardenafil

buy canada levitra

buy levitra online from canada

drug generic propecia

best viagra

online cheap viagra

cialis professional 20 mg

buy propecia online prescription

generic propecia for sale

canada viagra generic

buy cheap generic propecia

buying generic propecia

brand viagra over the net

cialis by mail

cialis purchase

levitra 10mg

get levitra online

levitra tabs

cialis alternative

buy cheap levitra online

internet pharmacy propecia

buy can from i propecia who

brand name cialis overnight

low price levitra

canadian viagra india

canadian viagra and healthcare

buy levitra vardenafil

cheap canadian viagra

buy propecia canada

cialis 100 mg generic

lowest cost levitra

buy levitra online viagra

indian cialis

cheap prescription propecia

cialis quick shipment

levitra online prescription

indian cialis generic

online propecia uk

buy real cialis

cheap viagra canada or india

levitra online overnight delivery

5 mg original brand cialis

online viagra gel to buy

discount propecia online

cialis in mexico

canada levitra

cheapest prices for viagra

levitra in canada

lowest propecia 1 mg

online cialis

cialis daily dosage pharmacy

best price cialis

mail online order propecia

best price generic propecia

cialis for woman

buy online prescription propecia

discount cialis india

info levitra

cialis no prescription

canadian pharmacy discount code viagra

buying levitra online

generic levitra online

buying online propecia

buy cialis 5 mg

cialis 5 mg italia

generic levitra canada

levitra mail order

buy cialis fedex shipping

buy cheap generic levitra

cialis fast delivery

cost levitra low

buy cheapest propecia

levitra cheap fast

buy viagra online cheap us

indian viagra

name brand cialis

buy cialis for daily use

get cialis online

cialis overnight delivery

discount levitra purchase

cost of viagra

5 mg daily cialis

brand cialis for sale

get cialis

levitra in india

can i get viagra in mexico

bio viagra herbal

discount us propecia

daily dosage cialis

order propecia

buy fast propecia

overnight delivery cialis

how strong is 5 mg of cialis

cialis and ketoconazole

cheapest overnight cialis

canada meds viagra

order generic levitra

buy generic propecia

getting cialis from canada

generic propecia 5mg

cheap levitra tablets

levitra online

order cheap propecia

buy cheap levitra

canadian pharmacy viagra

buy cialis once daily

mexico levitra

cheapest propecia sale uk

cialis uk

combine cialis and levitra

order viagra or levitra

cheapest price propecia cheap

buy now propecia

cialis next day

discount propecia propecia

cialis price

levitra order prescription

buy propecia cheap

lowest propecia prices in canada

cheapest viagra usa

buy real viagra online

cialis tablets foreign

levitra for sale

50 mg cialis

buy viagra

cialis 5 mg buy

cheap viagra online

for sale levitra

cialis price in canada

cialis tablets

buy levitra overnight

buy generic viagra india rx

cialis refractory

buy prescription propecia without

low cost propecia

once a day viagra

levitra viagra online

how much cialis

buy propecia online pharmacy

lowest price on non generic levitra

cialis cheap

generic viagra 100 mg

buying cialis

next day delivery cialis

how to get cialis in canada

cialis soft pills

levitra discount

low cost levitra

female viagra pills

healthcare canadian pharmacy

cheap propecia uk

levitra online us

generic propecia online pharmacy

generic viagra online

cialis pharmacy

canadian viagra

cialis 5 mg

overnight delivery viagra

buy cialis online canada

buy viagra germany canadian meds

cialis and diarrhea

mail order levitra

get levitra

mexico pharmacy cialis

buying cialis soft tabs 100 mg

generic levitra cheap

cialis one a day

ordering propecia online

canadian viagra 50mg

mail order propecia

cialis price 100 mg