Anyone use 1's compliment or signed magnitude?

T

Tim Wescott

Guest
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

TIA.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

I'm looking for work -- see my website!
 
On 1/24/2017 11:44 PM, Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

Not sure I can be of a lot of help, but I do know these have been used
in various systems in the past. 1's compliment has an advantage of not
needing an adder to negate a number. in 1's compliment the negative is
just all bits inverted. So some of the early computers used it for that
reason. Addition is slightly complicated, or I should say subtraction
since you must add a one to make the result come out right. Not a big
deal as you can use the carry input to the lsb. Then there is the issue
of having two zeros, 000...0 and 111...1 are both zero. lol

I have seen sign magnitude used in ADCs. I believe in some designs it
is simpler to produce a magnitude and then just append a sign bit rather
than adding the logic to create a two's complement number. In the old
days the analog technology didn't lend itself to the logic so well.
Otherwise I have not seen sign magnitude used anywhere or in any
computers.

In some of the rather old business computers they used various forms of
BCD or excess 3 code to simplify arithmetic since converting between
binary and decimal digits can be a fair amount of work when you don't
have fancy hardware.

--

Rick C
 
On Wednesday, January 25, 2017 at 3:14:39 PM UTC+10:30, Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Quote:

"Some designers chose 1’s complement, where −n was obtained from n by simply inverting all bits. Some chose 2’s complement, where −n is obtained by
inverting all bits and then adding 1. The former has the drawback of featuring two forms for zero (0…0 and 1…1). This is nasty, particularly if available comparison instructions are inadequate. For example, the CDC 6000 computers had an instruction that tested for zero, recognizing both forms
correctly, but also an instruction that tested the sign bit only, classifying 1…1 as a negative number, making comparisons unnecessarily complicated. This case of inadequate design reveals 1’s complement as a bad idea. Today, all computers use 2’s complement arithmetic."

Ref: "Good Ideas, Through the Looking Glass" Niklaus Wirth, IEEE Computer. Issue No. 01 - January (2006 vol. 39).

https://www.computer.org/csdl/mags/co/2006/01/r1028-abs.html
 
Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

TIA.

If by "signed-magnitude" you mean "sign-magnitude", i.e. numbers are
always positive binary encoding with a separate sign bit, then most
floating point formats use it for the mantissa. Once again you have
the possibility of positive and negative zero, however IEEE floating
formats don't allow negative zero in the standard encoding, so you need
to check for zero when negating a number. Zero is a special case in
these formats, because otherwise there is an assumed 1 to the left of
the mantissa. The same formats use offset binary for the exponent.

--
Gabor
 
Tim Wescott wrote:

This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment or
signed-magnitude number representation for technical reasons?
The LINC computer used 1's complement. Having two zeros that did not
compare as equal was a pain!

Jon
 
On Wed, 25 Jan 2017 02:59:46 -0800, cfbsoftware wrote:

On Wednesday, January 25, 2017 at 3:14:39 PM UTC+10:30, Tim Wescott
wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment
or signed-magnitude number representation for technical reasons?

Have you ever used it in the past?


Quote:

"Some designers chose 1’s complement, where −n was obtained from n by
simply inverting all bits. Some chose 2’s complement, where −n is
obtained by inverting all bits and then adding 1. The former has the
drawback of featuring two forms for zero (0…0 and 1…1). This is nasty,
particularly if available comparison instructions are inadequate. For
example, the CDC 6000 computers had an instruction that tested for zero,
recognizing both forms correctly, but also an instruction that tested
the sign bit only, classifying 1…1 as a negative number, making
comparisons unnecessarily complicated. This case of inadequate design
reveals 1’s complement as a bad idea. Today, all computers use 2’s
complement arithmetic."

Ref: "Good Ideas, Through the Looking Glass" Niklaus Wirth, IEEE
Computer. Issue No. 01 - January (2006 vol. 39).

https://www.computer.org/csdl/mags/co/2006/01/r1028-abs.html

I'm looking for current practice, not history.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

I'm looking for work -- see my website!
 
On 1/25/2017 8:14 PM, Tim Wescott wrote:
On Wed, 25 Jan 2017 02:59:46 -0800, cfbsoftware wrote:

On Wednesday, January 25, 2017 at 3:14:39 PM UTC+10:30, Tim Wescott
wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment
or signed-magnitude number representation for technical reasons?

Have you ever used it in the past?


Quote:

"Some designers chose 1’s complement, where −n was obtained from n by
simply inverting all bits. Some chose 2’s complement, where −n is
obtained by inverting all bits and then adding 1. The former has the
drawback of featuring two forms for zero (0…0 and 1…1). This is nasty,
particularly if available comparison instructions are inadequate. For
example, the CDC 6000 computers had an instruction that tested for zero,
recognizing both forms correctly, but also an instruction that tested
the sign bit only, classifying 1…1 as a negative number, making
comparisons unnecessarily complicated. This case of inadequate design
reveals 1’s complement as a bad idea. Today, all computers use 2’s
complement arithmetic."

Ref: "Good Ideas, Through the Looking Glass" Niklaus Wirth, IEEE
Computer. Issue No. 01 - January (2006 vol. 39).

https://www.computer.org/csdl/mags/co/2006/01/r1028-abs.html

I'm looking for current practice, not history.

Other than the few ADC parts I described that use sign-magnitude, I'm
pretty sure you won't find any computers using either 1's complement or
sign-magnitude. Pocket calculators likely still use BCD. Otherwise
everything is 2's complement binary.

--

Rick C
 
On 1/25/2017 11:50 PM, BobH wrote:
On 01/24/2017 09:44 PM, Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

TIA.


I have done hardware dividers and multipliers that only work with
positive integers, so you have to convert to positive values and track
the sign externally. This qualifies as sign magnitude, I think.

Also, working in mixed analog/digital systems, sign magnitude is pretty
common at the analog/digital boundary. The analog part accepts a
magnitude value and a sign bit. Think about a simple R2R DAC and an
analog transmission gate for accepting the true or inverted value. 2's
complement takes extra work to accept.

I don't agree. 2's compliment to a DAC only requires the sign bit to be
inverted (same as offsetting by 2**(n-1)) and that the range of the DAC
output be biased so the original zero value is at zero volts if that is
what is desired.

I have seldom seen available analog conversion parts use sign magnitude,
but they do exist.

--

Rick C
 
On 01/24/2017 09:44 PM, Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

TIA.

I have done hardware dividers and multipliers that only work with
positive integers, so you have to convert to positive values and track
the sign externally. This qualifies as sign magnitude, I think.

Also, working in mixed analog/digital systems, sign magnitude is pretty
common at the analog/digital boundary. The analog part accepts a
magnitude value and a sign bit. Think about a simple R2R DAC and an
analog transmission gate for accepting the true or inverted value. 2's
complement takes extra work to accept.

BobH
 
On Thu, 26 Jan 2017 11:07:23 +0000, Allan Herriman wrote:

Every time you surf the web you use 1's comp arithmetic for the IP and
TCP header checksum calculations. That's just what the spec says. I'm
sure someone at one time thought it had some technical advantage over
other sorts of checksums, but it's actually quite poor in terms of its
error detection capabilities and isn't that fast to calculate.

The ones-complement sum of the 16-bits words is invariant with respect to
byte swapping. That is, it just works on either big-endian or little-
endian machines. I've never read anything saying that's why they chose
it but it's what I've always suspected.
 
On Tue, 24 Jan 2017 22:44:32 -0600, Tim Wescott wrote:

This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment
or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

Every time you surf the web you use 1's comp arithmetic for the IP and TCP
header checksum calculations. That's just what the spec says. I'm sure
someone at one time thought it had some technical advantage over other
sorts of checksums, but it's actually quite poor in terms of its error
detection capabilities and isn't that fast to calculate.

In two different jobs I've designed FPGA-based systems that would alter a
field in the IP or TCP header then adjust the checksum to suit rather
than recalculating it from scratch. This requires a firm knowledge of
1's comp arithmetic, e.g. you need to know that the +0 and -0 aren't
equivalent in this context.

As an aside, I once used an HP Ethernet switch didn't do it correctly
and would corrupt non-IP frames that happened to have particular values
(IIRC it was 0000 or ffff) in the same position as the IP checksum field
in the packet header.


There are multiple RFCs describing how it's done. Some of them are even
correct.

Regards,
Allan
 
On Thursday, January 26, 2017 at 11:44:58 AM UTC+10:30, Tim Wescott wrote:
On Wednesday, January 25, 2017 at 3:14:39 PM UTC+10:30, Tim Wescott
wrote:
I need some perspective (possibly historical)


I'm looking for current practice, not history.

?????
 
On 1/26/2017 8:57 PM, BobH wrote:
On 01/25/2017 11:15 PM, rickman wrote:
On 1/25/2017 11:50 PM, BobH wrote:
On 01/24/2017 09:44 PM, Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's
compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

TIA.


I have done hardware dividers and multipliers that only work with
positive integers, so you have to convert to positive values and track
the sign externally. This qualifies as sign magnitude, I think.

Also, working in mixed analog/digital systems, sign magnitude is pretty
common at the analog/digital boundary. The analog part accepts a
magnitude value and a sign bit. Think about a simple R2R DAC and an
analog transmission gate for accepting the true or inverted value. 2's
complement takes extra work to accept.

I don't agree. 2's compliment to a DAC only requires the sign bit to be
inverted (same as offsetting by 2**(n-1)) and that the range of the DAC
output be biased so the original zero value is at zero volts if that is
what is desired.

I have seldom seen available analog conversion parts use sign magnitude,
but they do exist.

These are not customer visible interfaces Rick. These are trim DACs used
for part parameter trimming that the customer never sees or even knows
that they exist. I spent the last 7 years dealing with this at a couple
of large semiconductor houses.

What does "customer visible" have to do with it? You seem to be talking
about rolling your own DAC using a bunch of I/O pins and resistors with
analog inversion circuitry after. I'm explaining how it can be done
more easily. If you don't need bipolar outputs, why do you need
negative binary values at all?

I've said there are a few sign magnitude DAC parts out there, but not so
many. I can't recall ever using one.

--

Rick C
 
On 01/25/2017 11:15 PM, rickman wrote:
On 1/25/2017 11:50 PM, BobH wrote:
On 01/24/2017 09:44 PM, Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's
compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

TIA.


I have done hardware dividers and multipliers that only work with
positive integers, so you have to convert to positive values and track
the sign externally. This qualifies as sign magnitude, I think.

Also, working in mixed analog/digital systems, sign magnitude is pretty
common at the analog/digital boundary. The analog part accepts a
magnitude value and a sign bit. Think about a simple R2R DAC and an
analog transmission gate for accepting the true or inverted value. 2's
complement takes extra work to accept.

I don't agree. 2's compliment to a DAC only requires the sign bit to be
inverted (same as offsetting by 2**(n-1)) and that the range of the DAC
output be biased so the original zero value is at zero volts if that is
what is desired.

I have seldom seen available analog conversion parts use sign magnitude,
but they do exist.
These are not customer visible interfaces Rick. These are trim DACs used
for part parameter trimming that the customer never sees or even knows
that they exist. I spent the last 7 years dealing with this at a couple
of large semiconductor houses.

BobH
 
On 27/01/17 05:15, rickman wrote:
On 1/26/2017 8:57 PM, BobH wrote:
On 01/25/2017 11:15 PM, rickman wrote:
On 1/25/2017 11:50 PM, BobH wrote:
On 01/24/2017 09:44 PM, Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly
historical)

Are there any digital systems that you know of that use 1's
compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

TIA.


I have done hardware dividers and multipliers that only work with
positive integers, so you have to convert to positive values and track
the sign externally. This qualifies as sign magnitude, I think.

Also, working in mixed analog/digital systems, sign magnitude is pretty
common at the analog/digital boundary. The analog part accepts a
magnitude value and a sign bit. Think about a simple R2R DAC and an
analog transmission gate for accepting the true or inverted value. 2's
complement takes extra work to accept.

I don't agree. 2's compliment to a DAC only requires the sign bit to be
inverted (same as offsetting by 2**(n-1)) and that the range of the DAC
output be biased so the original zero value is at zero volts if that is
what is desired.

I have seldom seen available analog conversion parts use sign magnitude,
but they do exist.

These are not customer visible interfaces Rick. These are trim DACs used
for part parameter trimming that the customer never sees or even knows
that they exist. I spent the last 7 years dealing with this at a couple
of large semiconductor houses.

What does "customer visible" have to do with it? You seem to be talking
about rolling your own DAC using a bunch of I/O pins and resistors with
analog inversion circuitry after. I'm explaining how it can be done
more easily. If you don't need bipolar outputs, why do you need
negative binary values at all?

I've said there are a few sign magnitude DAC parts out there, but not so
many. I can't recall ever using one.

My understanding of Bob's post here is that the "customer" in this case
is the hardware design that is buying the chip, not the end-user or even
the board's programmer. So when you buy an ADC with a precision 2.5V
internal reference, Bob is talking about the trim DAC that is factory
calibrated to modify the base reference - /you/ are the customer for
whom this interface is invisible.
 
On 01/26/2017 09:15 PM, rickman wrote:
Snip

What does "customer visible" have to do with it? You seem to be talking
about rolling your own DAC using a bunch of I/O pins and resistors with
analog inversion circuitry after. I'm explaining how it can be done
more easily. If you don't need bipolar outputs, why do you need
negative binary values at all?

I've said there are a few sign magnitude DAC parts out there, but not so
many. I can't recall ever using one.

"Not customer visible" means that the person that buys one of these
parts to stick on a board is un-aware of the interface between the
internal digital logic and internal analog circuitry. The people
designing the analog guts of a mixed signal chip do "roll their own"
DACs in several flavors. Unless you work in mixed signal IC design or
test, you would never see these interfaces. For a DAC or ADC product,
"customer visible" has a lot to do with it because people want 2's
complement or biased binary at the system interface so that it plays
nice with the arithmetic in the rest of the system or doesn't confuse
the firmware people. For internals of a chip, as a digital design
engineer or test engineer, you just deal with it. As for why it is done
the way it is, I am not completely sure, it is just what analog
designers do.

Even fairly analog seeming components like the voltage reference that
David mentioned generally have a digital section with flash or OTP
memory that gets read at power up and sets DACs used to configure the
reference output to the 1% or whatever the part spec is. Bandgaps have 3
or 4 analog parameters effecting output voltage and output flatness over
temperature that need to be set. As part of final test on the silicon
die, they measure the device performance and set the values in the
memory. This allows the manufacturer to correct for process variations
and uniformity issues across a wafer the size of a dinner plate. When
you see "NC" pins on small analog devices, they are often used for the
access to these memories. The actual signalling methods are pretty
closely held and not something a customer is likely to stumble on.

The "I/O pins" in use are interconnects between the digital block and
the analog section on the die. The last chip that I worked on had 100+
digital signals crossing the analog/digital boundary. Some were control
signals and some were trim signals. I think that there were 5 or 6
parallel interfaced DACs from 4 bits to 11 bits. Of those, 2 or 3 used
sign magnitude format to pass the trim information across.

BobH
 
On 26/01/2017 01:14, Tim Wescott wrote:
On Wed, 25 Jan 2017 02:59:46 -0800, cfbsoftware wrote:

On Wednesday, January 25, 2017 at 3:14:39 PM UTC+10:30, Tim Wescott
wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment
or signed-magnitude number representation for technical reasons?

Have you ever used it in the past?


Quote:

"Some designers chose 1’s complement, where −n was obtained from n by
simply inverting all bits. Some chose 2’s complement, where −n is
obtained by inverting all bits and then adding 1. The former has the
drawback of featuring two forms for zero (0…0 and 1…1). This is nasty,
particularly if available comparison instructions are inadequate. For
example, the CDC 6000 computers had an instruction that tested for zero,
recognizing both forms correctly, but also an instruction that tested
the sign bit only, classifying 1…1 as a negative number, making
comparisons unnecessarily complicated. This case of inadequate design
reveals 1’s complement as a bad idea. Today, all computers use 2’s
complement arithmetic."

Ref: "Good Ideas, Through the Looking Glass" Niklaus Wirth, IEEE
Computer. Issue No. 01 - January (2006 vol. 39).

https://www.computer.org/csdl/mags/co/2006/01/r1028-abs.html

I'm looking for current practice, not history.

1's complement is nearly the very definition of history as implied by
"Have you ever used it in the past?"

The only machine I am aware used 1's complement is a 1970's mainframe.

I have not been aware of any since, its a daft idea.

--
Mike Perkins
Video Solutions Ltd
www.videosolutions.ltd.uk
 
On Wednesday, 25 January 2017 05:44:39 UTC+1, Tim Wescott wrote:
This is kind of a survey; I need some perspective (possibly historical)

Are there any digital systems that you know of that use 1's compliment or
signed-magnitude number representation for technical reasons?

Have you ever used it in the past?

Is the world down to legacy applications and interfacing with legacy
sensors?

TIA.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com

I'm looking for work -- see my website!

I've used sign-magnitude for some compression schemes, in which case the sign bit takes the least significant place.
10 = -1
11 = +1
100 = -2
101 = +2
110 = -3
111 = +3
1000 = -4
....
 

Welcome to EDABoard.com

Sponsor

Back
Top