Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch > #4780

Re: implementation of unsigned addition on one's complement machines

From Kai Harrekilde-Petersen <khp@harrekilde.dk>
Newsgroups comp.arch
Subject Re: implementation of unsigned addition on one's complement machines
References <1ca86407-1dbc-452c-af08-1f6d1bb76e24@u9g2000vbx.googlegroups.com> <2011Nov15.182620@mips.complang.tuwien.ac.at> <en4bp8-tsm1.ln1@ntp6.tmsw.no>
Date 2011-11-15 23:25 +0100
Message-ID <84k471yqdv.fsf@harrekilde.dk> (permalink)
Organization SunSITE.dk - Supporting Open source

Show all headers | View raw


Terje Mathisen <"terje.mathisen at tmsw.no"> writes:

> Anton Ertl wrote:
>> If they want to use all the bits for unsigned numbers, then a separate
>> unsigned addition (and subtraction) is needed.  However, you can
>> define the positive subset of the signed integers supported by the
>> machine to be the unsigned numbers; then you can use the ordinary
>> (signed) addition for these "unsigned" numbers; but you don't get
>> wrap-around on overflows then.
>>
>> I wonder how C's guaranteed wraparound on unsigned overflow is
>> implemented on such machines.
>
> The easiest might be to reduce the size of unsigned values by an
> additional bit, then follow each add with a mask?

I would be surprised if they do - I guess there must be a simple way of
doing this, since the VHDL standard has been designed so it could be run
on both 1-complement and 2-complement hardware: integer range is limited
to +/-(2**31-1) for this particular reason (at least this is the reason
that is written in textbooks about VHDL).


Kai
-- 
Kai Harrekilde-Petersen <khp(at)harrekilde(dot)dk>

Back to comp.arch | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

implementation of unsigned addition on one's complement machines Luca Forlizzi <luca.forlizzi@gmail.com> - 2011-11-14 07:08 -0800
  Re: implementation of unsigned addition on one's complement machines torbenm@diku.dk (Torben Ægidius Mogensen) - 2011-11-14 17:55 +0100
    Re: implementation of unsigned addition on one's complement machines torbenm@diku.dk (Torben Ægidius Mogensen) - 2011-11-15 10:29 +0100
      Re: implementation of unsigned addition on one's complement machines Luca Forlizzi <luca.forlizzi@gmail.com> - 2011-11-15 02:12 -0800
        Re: implementation of unsigned addition on one's complement machines nmm1@cam.ac.uk - 2011-11-15 10:28 +0000
          Re: implementation of unsigned addition on one's complement machines Luca Forlizzi <luca.forlizzi@gmail.com> - 2011-11-15 03:07 -0800
            Re: implementation of unsigned addition on one's complement machines nmm1@cam.ac.uk - 2011-11-15 11:13 +0000
              Re: implementation of unsigned addition on one's complement machines anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-15 17:33 +0000
                Re: implementation of unsigned addition on one's complement machines nmm1@cam.ac.uk - 2011-11-15 18:14 +0000
                Re: implementation of unsigned addition on one's complement machines anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-16 09:34 +0000
        Re: implementation of unsigned addition on one's complement machines Michael S <already5chosen@yahoo.com> - 2011-11-16 09:04 -0800
          Re: implementation of unsigned addition on one's complement machines nmm1@cam.ac.uk - 2011-11-16 17:31 +0000
          Re: implementation of unsigned addition on one's complement machines Robert Wessel <robertwessel2@yahoo.com> - 2011-11-16 11:54 -0600
    Re: implementation of unsigned addition on one's complement machines Luca Forlizzi <luca.forlizzi@gmail.com> - 2011-11-15 03:11 -0800
  Re: implementation of unsigned addition on one's complement machines anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-15 17:26 +0000
    Re: implementation of unsigned addition on one's complement machines Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-11-15 23:12 +0100
      Re: implementation of unsigned addition on one's complement machines Kai Harrekilde-Petersen <khp@harrekilde.dk> - 2011-11-15 23:25 +0100

csiph-web