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


Groups > comp.arch > #31581 > unrolled thread

Between CISC and RISC

Started byQuadibloc <jsavard@ecn.ab.ca>
First post2015-12-07 20:13 -0800
Last post2015-12-26 10:07 -0800
Articles 20 on this page of 134 — 26 participants

Back to article view | Back to comp.arch


Contents

  Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-07 20:13 -0800
    Re: Between CISC and RISC Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-08 01:50 -0800
      Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-08 04:19 -0800
        Re: Between CISC and RISC Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-08 04:57 -0800
          Re: Between CISC and RISC algrant109@gmail.com - 2015-12-11 12:57 -0800
            Re: Between CISC and RISC Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-11 13:44 -0800
            Re: Between CISC and RISC Ivan Godard <ivan@millcomputing.com> - 2015-12-11 15:40 -0800
              Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-11 21:13 -0800
                Re: Between CISC and RISC Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-12 04:14 -0800
                  Re: Between CISC and RISC already5chosen@yahoo.com - 2015-12-12 12:59 -0800
              Re: Between CISC and RISC algrant109@gmail.com - 2015-12-14 08:44 -0800
          Re: Between CISC and RISC Exophase <exophase@gmail.com> - 2015-12-15 13:23 -0800
            Re: Between CISC and RISC Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-16 02:13 -0800
    Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-08 04:17 -0800
      Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-09 05:35 -0800
        Re: Between CISC and RISC jacko <jackokring@gmail.com> - 2015-12-09 08:56 -0800
        Re: Between CISC and RISC Stephen Fuld <SFuld@alumni.cmu.edu.invalid> - 2015-12-09 10:30 -0800
          Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-09 11:06 -0800
            Re: Between CISC and RISC Stephen Fuld <SFuld@alumni.cmu.edu.invalid> - 2015-12-09 12:17 -0800
              Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-09 12:56 -0800
                Re: Between CISC and RISC Stephen Fuld <SFuld@alumni.cmu.edu.invalid> - 2015-12-10 11:44 -0800
                  Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-10 22:50 -0800
                    Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-10 23:06 -0800
                    Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-11 06:01 -0800
          Re: Between CISC and RISC David W Schroth <davidschroth@harrietmanor.com> - 2015-12-10 21:37 -0600
          Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-11 10:37 -0800
            Re: Between CISC and RISC Stephen Fuld <SFuld@alumni.cmu.edu.invalid> - 2015-12-11 15:19 -0800
              Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-11 21:20 -0800
              Re: Between CISC and RISC David W Schroth <davidschroth@harrietmanor.com> - 2015-12-12 18:22 -0600
          Re: Between CISC and RISC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-12 23:20 +0000
            Re: Between CISC and RISC Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-13 07:48 +0100
              Re: Between CISC and RISC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-13 18:00 +0000
                Re: Between CISC and RISC Ivan Godard <ivan@millcomputing.com> - 2015-12-13 11:37 -0800
                Re: Between CISC and RISC Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-13 21:57 +0100
            Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-13 07:19 -0800
              Re: ones complement, was Between John Levine <johnl@iecc.com> - 2015-12-13 15:32 +0000
                Re: ones complement, was Between Quadibloc <jsavard@ecn.ab.ca> - 2015-12-13 08:32 -0800
                  Re: ones complement, was Between John Levine <johnl@iecc.com> - 2015-12-13 16:52 +0000
                    Re: ones complement, was Between Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-13 08:56 -0800
                      Re: ones complement, was Between John Levine <johnl@iecc.com> - 2015-12-13 17:03 +0000
                        Re: ones complement, was Between Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2015-12-13 10:12 -0700
                      Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-13 21:51 +0100
                        Re: ones complement, was Between Jan Coombs <jan_coombs@murmic.plus.com> - 2015-12-13 22:18 +0000
                Re: ones complement, was Between MitchAlsup <MitchAlsup@aol.com> - 2015-12-13 10:15 -0800
                  Re: ones complement, was Between Megol <golem960@gmail.com> - 2015-12-13 12:18 -0800
                  Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-13 22:00 +0100
                    Re: ones complement, was Between Ivan Godard <ivan@millcomputing.com> - 2015-12-13 13:07 -0800
                      Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-14 10:15 +0100
                        Re: ones complement, was Between Ivan Godard <ivan@millcomputing.com> - 2015-12-14 01:39 -0800
                        Re: ones complement, was Between already5chosen@yahoo.com - 2015-12-14 01:59 -0800
                          Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-14 14:21 +0100
                            Re: ones complement, was Between nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-14 14:21 +0000
                            Re: ones complement, was Between already5chosen@yahoo.com - 2015-12-14 07:03 -0800
                              Re: ones complement, was Between nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-14 15:50 +0000
                                Re: ones complement, was Between MitchAlsup <MitchAlsup@aol.com> - 2015-12-14 16:34 -0800
                                  Re: ones complement, was Between Ivan Godard <ivan@millcomputing.com> - 2015-12-14 18:42 -0800
                                    Re: ones complement, was Between nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-15 09:13 +0000
                                    Re: ones complement, was Between nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-15 09:25 +0000
                                  Re: ones complement, was Between nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-15 08:53 +0000
                              Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-14 18:25 +0100
                                Re: ones complement, was Between Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-15 02:20 -0800
                                  Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-15 11:58 +0100
                                Re: ones complement, was Between already5chosen@yahoo.com - 2015-12-20 02:45 -0800
                                  Re: ones complement, was Between already5chosen@yahoo.com - 2015-12-20 03:11 -0800
                                  Re: ones complement, was Between nj_kruse@me.com (Niels Jørgen Kruse) - 2015-12-20 14:34 +0100
                                    Re: ones complement, was Between already5chosen@yahoo.com - 2015-12-20 05:57 -0800
                                      Re: ones complement, was Between MitchAlsup <MitchAlsup@aol.com> - 2015-12-20 12:12 -0800
                                        Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-21 15:33 +0100
                                          Re: ones complement, was Between nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-21 14:58 +0000
                                            Re: ones complement, was Between Quadibloc <jsavard@ecn.ab.ca> - 2015-12-21 10:06 -0800
                                            Re: ones complement, was Between MitchAlsup <MitchAlsup@aol.com> - 2015-12-21 15:48 -0800
                                              Re: ones complement, was Between Ivan Godard <ivan@millcomputing.com> - 2015-12-21 17:13 -0800
                                  Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-20 17:47 +0100
                                    Re: ones complement, was Between jacko <jackokring@gmail.com> - 2015-12-20 10:09 -0800
                                    Re: ones complement, was Between Jean-Marc Bourguet <jm@bourguet.org> - 2015-12-20 20:09 +0100
                                  Re: ones complement, was Between Chris Gray <cg@GraySage.COM> - 2015-12-20 11:02 -0700
                                    Re: ones complement, was Between anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-21 14:11 +0000
                                      Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-21 16:08 +0100
                                        Re: ones complement, was Between nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-21 16:03 +0000
                                          Re: ones complement, was Between anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-21 16:18 +0000
                                            Re: ones complement, was Between nmm@wheeler.UUCP (Nick Maclaren) - 2015-12-21 17:53 +0000
                                          Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-21 21:29 +0100
                                        Re: ones complement, was Between anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-21 15:57 +0000
                                          Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-21 21:25 +0100
                    Re: ones complement, was Between John Levine <johnl@iecc.com> - 2015-12-14 02:11 +0000
                      Re: ones complement, was Between Quadibloc <jsavard@ecn.ab.ca> - 2015-12-14 00:27 -0800
                  Re: ones complement, was Between Quadibloc <jsavard@ecn.ab.ca> - 2015-12-13 17:16 -0800
                    Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-14 10:20 +0100
                      Re: ones complement, was Between anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-14 10:29 +0000
                        Re: ones complement, was Between anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-14 12:17 +0000
                          Re: ones complement, was Between MitchAlsup <MitchAlsup@aol.com> - 2015-12-14 06:40 -0800
                        Re: ones complement, was Between Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-14 14:26 +0100
                  Re: ones complement, was Between anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-14 08:09 +0000
            Re: Between CISC and RISC mrs@kithrup.com (Mike Stump) - 2015-12-14 00:11 +0000
        Re: Between CISC and RISC MitchAlsup <MitchAlsup@aol.com> - 2015-12-09 17:30 -0800
      Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-14 00:17 -0800
        Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-14 05:48 -0800
    Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-15 15:32 -0800
      Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-21 12:57 -0800
        Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-21 19:00 -0800
          Re: Between CISC and RISC Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-22 10:26 +0100
            Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-22 06:39 -0800
            Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-23 10:17 -0800
              Re: Between CISC and RISC Jean-Marc Bourguet <jm@bourguet.org> - 2015-12-23 19:55 +0100
                Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-23 17:15 -0800
                  Re: Between CISC and RISC Terje Mathisen <terje.mathisen@tmsw.no> - 2015-12-24 10:27 +0100
                    Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-24 04:50 -0800
                    Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-24 07:37 -0800
                      Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-24 09:47 -0800
                        Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-24 11:47 -0800
                          Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-24 12:48 -0800
                            Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-24 18:56 -0800
                              Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-25 09:34 -0800
                            Re: Between CISC and RISC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2015-12-25 17:57 +0000
                              Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-25 10:42 -0800
                                Re: Between CISC and RISC Bruce Hoult <bruce.hoult@gmail.com> - 2015-12-26 03:29 -0800
                                Re: Between CISC and RISC Jakob Brundin <jakbru@gmail.com> - 2015-12-26 07:23 -0800
                                  Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-26 09:54 -0800
                                Re: Between CISC and RISC Anne & Lynn Wheeler <lynn@garlic.com> - 2015-12-26 16:18 -0800
                            Re: Between CISC and RISC MitchAlsup <MitchAlsup@aol.com> - 2016-01-31 10:17 -0800
                              Re: Between CISC and RISC paul wallich <pw@panix.com> - 2016-01-31 13:39 -0500
                                Re: Between CISC and RISC MitchAlsup <MitchAlsup@aol.com> - 2016-01-31 19:16 -0800
                              Re: Between CISC and RISC anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2016-02-01 12:43 +0000
                                Re: Between CISC and RISC MitchAlsup <MitchAlsup@aol.com> - 2016-02-01 06:44 -0800
                    Re: Between CISC and RISC Ivan Godard <ivan@millcomputing.com> - 2015-12-24 13:03 -0800
                      Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-24 16:35 -0800
                        Re: Between CISC and RISC Ivan Godard <ivan@millcomputing.com> - 2015-12-24 16:45 -0800
                    Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2016-01-31 07:14 -0800
                  Re: Between CISC and RISC MitchAlsup <MitchAlsup@aol.com> - 2015-12-25 07:21 -0800
                    Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-25 07:39 -0800
                    Re: Between CISC and RISC George Neuner <gneuner2@comcast.net> - 2015-12-25 11:53 -0500
                      Re: Between CISC and RISC MitchAlsup <MitchAlsup@aol.com> - 2016-01-31 10:10 -0800
                        Re: Between CISC and RISC Robert Wessel <robertwessel2@yahoo.com> - 2016-01-31 23:34 -0600
            Re: Between CISC and RISC Quadibloc <jsavard@ecn.ab.ca> - 2015-12-26 10:07 -0800

Page 5 of 7 — ← Prev page 1 2 3 4 [5] 6 7  Next page →


#32060 — Re: ones complement, was Between

Fromnmm@wheeler.UUCP (Nick Maclaren)
Date2015-12-21 17:53 +0000
SubjectRe: ones complement, was Between
Message-ID<n59eb4$p02$1@dont-email.me>
In reply to#32053
In article <2015Dec21.171818@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>>Now try:
>>
>>    for (unsigned i = 0; i < n; ++i)
>>        for (unsigned j = 0; j < n-1; ++j) {}
>>
>>Oops.  what happens if n == 0?
>
>The outer loop has 0 iterations.  Where is the problem?

Oops.  Yes.  So make them both top level.  Again, a common usage
in the sorts of code I mentioned.

>Anyway, the problem we were discussing is how to write a
>count-down-to-zero loop with an unsigned index.

Which was in the context of whether unsigned is a more reliable form
of integer in C than signed.


Regards,
Nick Maclaren.

[toc] | [prev] | [next] | [standalone]


#32075 — Re: ones complement, was Between

FromTerje Mathisen <terje.mathisen@tmsw.no>
Date2015-12-21 21:29 +0100
SubjectRe: ones complement, was Between
Message-ID<n59ng4$ri2$1@speranza.aioe.org>
In reply to#32050
Nick Maclaren wrote:
> Now try:
>
>      for (unsigned i = 0; i < n; ++i)
>          for (unsigned j = 0; j < n-1; ++j) {}
>
> Oops.  what happens if n == 0?
>
> The point is that loops like that are widespread in numerical code,
> sorting algorithms, etc., etc.  Even programmers like you and I will
> occasionally miss one and everything goes splat.  It's particularly
> horrible when n == 0 is impossible in versions 1 to 9, but becomes
> possible under difficult-to-create-to-order circumstances in later
> versions.

You're obviously correct, i.e. the devil is in the details:

I tend to wrap code like that in one or more global requirements, i.e.

"if (n > 2) {"

for a triple nested loop with decreasing ranges.

However, when I forget about that, then I get to suffer later. :-(

Terje

-- 
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

[toc] | [prev] | [next] | [standalone]


#32051 — Re: ones complement, was Between

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2015-12-21 15:57 +0000
SubjectRe: ones complement, was Between
Message-ID<2015Dec21.165746@mips.complang.tuwien.ac.at>
In reply to#32048
Terje Mathisen <terje.mathisen@tmsw.no> writes:
>Anton Ertl wrote:
>> Now, we could code the loop above as
>>
>> for (i=n; i<=n; i--) ...
>
>I.e.
>
>unsigned n = ...;
>for (unsigned i = n; i <= n; i--) {}
>
>This works for all n except n == MAXUNSIGNED where it becomes an 
>infinite loop.

Well, compared to the alternative of using a signed int and checking
i>=0, this is still a good range extension.

>n is of course iteration_count-1, so it cannot work if the count could 
>be zero.

That's more worrying.  We cannot have 0-iteration loops with this
idiom, and we probably want to exclude n.

>Writing
>
>   for (unsigned i = n-1; i < (unsigned) (-1); i--) {}
>
>makes it a bit more obvious that we are using wraparound from zero as 
>the termination criteria.

That looks clunky, and I am not sure if GCC and LLVM maintainers won't
find an excuse to miscompile anything containing "(unsigned) (-1)"
into arbitrary code (and maybe "optimize" the termination condition
away).  But at least it does not have the problem with n==0.

The alternative

for (unsigned i=n; i-->0; ) ...

was suggested elsewhere in this thread.  There I am worried about
additional conditions, e.g.

for (unsigned i=n; i-- > 0 && a[i] != key; ) ...

However, this does work out nicely, with i having the right value
after the >0 check.  It also works with signed i.  Looks like the best
idiom for down-counting loops yet.

- anton
-- 
M. Anton Ertl                    Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html

[toc] | [prev] | [next] | [standalone]


#32073 — Re: ones complement, was Between

FromTerje Mathisen <terje.mathisen@tmsw.no>
Date2015-12-21 21:25 +0100
SubjectRe: ones complement, was Between
Message-ID<n59n7j$r1u$1@speranza.aioe.org>
In reply to#32051
Anton Ertl wrote:
> Terje Mathisen <terje.mathisen@tmsw.no> writes:
>> Writing
>>
>>    for (unsigned i = n-1; i < (unsigned) (-1); i--) {}
>>
>> makes it a bit more obvious that we are using wraparound from zero as
>> the termination criteria.
>
> That looks clunky, and I am not sure if GCC and LLVM maintainers won't
> find an excuse to miscompile anything containing "(unsigned) (-1)"
> into arbitrary code (and maybe "optimize" the termination condition
> away).  But at least it does not have the problem with n==0.

Re miscompiling: Rather the opposite!

The (<unsigned_type>) (-1) is defined as the the portable way to 
generate a constant with all bits set.

>
> The alternative
>
> for (unsigned i=n; i-->0; ) ...
>
> was suggested elsewhere in this thread.  There I am worried about
> additional conditions, e.g.
>
> for (unsigned i=n; i-- > 0 && a[i] != key; ) ...
>
> However, this does work out nicely, with i having the right value
> after the >0 check.  It also works with signed i.  Looks like the best
> idiom for down-counting loops yet.

I agree, it is quite nice.

Terje

-- 
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

[toc] | [prev] | [next] | [standalone]


#31831 — Re: ones complement, was Between

FromJohn Levine <johnl@iecc.com>
Date2015-12-14 02:11 +0000
SubjectRe: ones complement, was Between
Message-ID<n4l8hd$13fu$1@miucha.iecc.com>
In reply to#31821
>> The real question is what is the appeal of 2-s complement?
>>
>A single instruction can do both signed and unsigned operations?
>
>I.e. an ADD gives the same binary result for both signed and unsigned 
>inputs.

Unique representation of zero.

No end-around carry or borrow

[toc] | [prev] | [next] | [standalone]


#31836 — Re: ones complement, was Between

FromQuadibloc <jsavard@ecn.ab.ca>
Date2015-12-14 00:27 -0800
SubjectRe: ones complement, was Between
Message-ID<4e413c37-5d2f-420e-a5ca-4ccb4ec232c4@googlegroups.com>
In reply to#31831
On Sunday, December 13, 2015 at 7:11:59 PM UTC-7, John Levine wrote:
> >> The real question is what is the appeal of 2-s complement?

> >A single instruction can do both signed and unsigned operations?

> >I.e. an ADD gives the same binary result for both signed and unsigned 
> >inputs.

> Unique representation of zero.

> No end-around carry or borrow

Upon further reflection, I think that two's complement arithmetic has the 
appeal that it matches the arithmetic that would be done on unsigned numbers. 
So address arithmetic and integer arithmetic are not differentiated, the add 
circuit is uniform.

The System/360 was very influential - it shifted the whole industry from 6-bit 
characters to 8-bit characters almost overnight. So if sign-magnitude enjoyed 
high prestige because that's what IBM did, and one's complement was looked upon 
as a poor man's sign-magnitude... the minute IBM withdrew its blessing from 
sign-magnitude and bestowed it on two's complement, the industry switched.

Whether or not two's complement was "better".

The popularity of the two's complement PDP-8 may have had something to do with 
this as well - it gave many programmers experience in working with two's 
complement, and gave people confidence that the respects in which one's 
complement was more symmetrical really didn't make much of a difference in 
practice - and so people asked if they were really worth even one extra gate to 
implement.

Sign-magnitude separates the sign from the number; one's complement doesn't 
completely do this, but it still maintains a boundary between the two, because 
the sign changes - and the bits of the number all invert.

Two's complement, though, treats the sign as just a part of the numeric field, 
to roll over in an odometric fashion when one goes below 0000000 - down to 
9999999 as -1 (in ten's complement, of course, the decimal analogue of two's 
complement).

John Savard

[toc] | [prev] | [next] | [standalone]


#31830 — Re: ones complement, was Between

FromQuadibloc <jsavard@ecn.ab.ca>
Date2015-12-13 17:16 -0800
SubjectRe: ones complement, was Between
Message-ID<bd3efd42-ba0d-4581-9eb0-fe4a2278cdc8@googlegroups.com>
In reply to#31813
On Sunday, December 13, 2015 at 11:15:51 AM UTC-7, MitchAlsup wrote:

> A) The speed of 1-s complement addition was equal to the speed of 2-s
> complement addition.

Given the end-around carry, how did they manage that?

John Savard

[toc] | [prev] | [next] | [standalone]


#31840 — Re: ones complement, was Between

FromTerje Mathisen <terje.mathisen@tmsw.no>
Date2015-12-14 10:20 +0100
SubjectRe: ones complement, was Between
Message-ID<n4m1le$urv$3@speranza.aioe.org>
In reply to#31830
Quadibloc wrote:
> On Sunday, December 13, 2015 at 11:15:51 AM UTC-7, MitchAlsup wrote:
>
>> A) The speed of 1-s complement addition was equal to the speed of 2-s
>> complement addition.
>
> Given the end-around carry, how did they manage that?
>
> John Savard
>
Carry-select?

I.e. generate two results in parallel, one with an incoming 
(wrap-around) carry and one without, then pick the one that corresponds 
to the carry out of the top bit?

Terje

-- 
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

[toc] | [prev] | [next] | [standalone]


#31843 — Re: ones complement, was Between

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2015-12-14 10:29 +0000
SubjectRe: ones complement, was Between
Message-ID<2015Dec14.112900@mips.complang.tuwien.ac.at>
In reply to#31840
Terje Mathisen <terje.mathisen@tmsw.no> writes:
>Quadibloc wrote:
>> On Sunday, December 13, 2015 at 11:15:51 AM UTC-7, MitchAlsup wrote:
>>
>>> A) The speed of 1-s complement addition was equal to the speed of 2-s
>>> complement addition.
>>
>> Given the end-around carry, how did they manage that?
>>
>> John Savard
>>
>Carry-select?

Carry-select has a carry as one of the inputs of the MUX, so with the
end-around carry you would get a carry-propagation cycle.  This will
settle after a while, but with 2's-complement, you can optimize the
segments to balance between the adder time and the muxing time, but
with ones-complement, you probably should make all segments the same
length, and probably have more gate delays.

But I am sure Mitch Alsup has a good solution for implementing a fast
ones-complement adder (and before him, Seymour Cray).  However, it
seems that Cray switched to 2's-complement, too, in the Cray-1 (at
least I have not seen that listed as 1s-complement machine); and that
sure was not because he was trying to mimic IBM, so I guess it had a
technical advantage at the time (maybe the existence of bit-slice
ALUs).

- anton
-- 
M. Anton Ertl                    Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html

[toc] | [prev] | [next] | [standalone]


#31844 — Re: ones complement, was Between

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2015-12-14 12:17 +0000
SubjectRe: ones complement, was Between
Message-ID<2015Dec14.131718@mips.complang.tuwien.ac.at>
In reply to#31843
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>However, it
>seems that Cray switched to 2's-complement, too, in the Cray-1 (at
>least I have not seen that listed as 1s-complement machine); and that
>sure was not because he was trying to mimic IBM, so I guess it had a
>technical advantage at the time (maybe the existence of bit-slice
>ALUs).

According to Wikipedia, the Cray-1 only used ICs for NOR gates and for
static RAM, so bit-slice ALUs were not the issue.

- anton
-- 
M. Anton Ertl                    Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html

[toc] | [prev] | [next] | [standalone]


#31850 — Re: ones complement, was Between

FromMitchAlsup <MitchAlsup@aol.com>
Date2015-12-14 06:40 -0800
SubjectRe: ones complement, was Between
Message-ID<9ace771e-a557-435c-b051-e6aa35a5bcc1@googlegroups.com>
In reply to#31844
On Monday, December 14, 2015 at 6:23:35 AM UTC-6, Anton Ertl wrote:
> anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
> >However, it
> >seems that Cray switched to 2's-complement, too, in the Cray-1 (at
> >least I have not seen that listed as 1s-complement machine); and that
> >sure was not because he was trying to mimic IBM, so I guess it had a
> >technical advantage at the time (maybe the existence of bit-slice
> >ALUs).
> 
> According to Wikipedia, the Cray-1 only used ICs for NOR gates and for
> static RAM, so bit-slice ALUs were not the issue.

The CRAY 1 used NOR gates for logic, a latch for storage (registers) and 
the same latch for the pipeline (not a flip-flop), clock drivers (true
complement input true complement output), all MECL 3

[toc] | [prev] | [next] | [standalone]


#31847 — Re: ones complement, was Between

FromTerje Mathisen <terje.mathisen@tmsw.no>
Date2015-12-14 14:26 +0100
SubjectRe: ones complement, was Between
Message-ID<n4mg2v$33j$1@speranza.aioe.org>
In reply to#31843
Anton Ertl wrote:
> Terje Mathisen <terje.mathisen@tmsw.no> writes:
>> Quadibloc wrote:
>>> On Sunday, December 13, 2015 at 11:15:51 AM UTC-7, MitchAlsup wrote:
>>>
>>>> A) The speed of 1-s complement addition was equal to the speed of 2-s
>>>> complement addition.
>>>
>>> Given the end-around carry, how did they manage that?
>>>
>>> John Savard
>>>
>> Carry-select?
>
> Carry-select has a carry as one of the inputs of the MUX, so with the
> end-around carry you would get a carry-propagation cycle.  This will
> settle after a while, but with 2's-complement, you can optimize the
> segments to balance between the adder time and the muxing time, but
> with ones-complement, you probably should make all segments the same
> length, and probably have more gate delays.

I assumed that a one's complement adder had no normal incoming carry in 
the bottom bit position, so I would instead use this slot to handle the 
case of an end-around carry:

It is impossible to have a double loop here, if the ADD generates a wrap 
then it will do so for both with and without an extra bottom incoming carry.
>
> But I am sure Mitch Alsup has a good solution for implementing a fast
> ones-complement adder (and before him, Seymour Cray).  However, it
> seems that Cray switched to 2's-complement, too, in the Cray-1 (at
> least I have not seen that listed as 1s-complement machine); and that
> sure was not because he was trying to mimic IBM, so I guess it had a
> technical advantage at the time (maybe the existence of bit-slice
> ALUs).

OK

Terje

-- 
- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

[toc] | [prev] | [next] | [standalone]


#31835 — Re: ones complement, was Between

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2015-12-14 08:09 +0000
SubjectRe: ones complement, was Between
Message-ID<2015Dec14.090940@mips.complang.tuwien.ac.at>
In reply to#31813
MitchAlsup <MitchAlsup@aol.com> writes:
>The real question is what is the appeal of 2-s complement?

* A nice mapping between signed and unsigned numbers.  Derived from
  that:

* Same instruction for signed and unsigned when doing addition,
  subtraction and non-expanding multiplication.  Overflow is handled
  by having separate carry (unsigned overflow) and overflow (signed
  overflow) flags.

* nice algabraic properties (arithmetic modulo 2^n) for signed numbers
  derived from the nice algebraic properties for unsigned numbers.
  Derived from that:

* You can do signed multi-precision arithmetics.  This is probably
  more complicated in ones-complement.

- anton
-- 
M. Anton Ertl                    Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html

[toc] | [prev] | [next] | [standalone]


#31829

Frommrs@kithrup.com (Mike Stump)
Date2015-12-14 00:11 +0000
Message-ID<nzBn6s.1q3s@kithrup.com>
In reply to#31778
In article <2015Dec13.002021@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>Interesting.  So this line of ones-complement machines goes the way of
>the Dodo (not that it was particularly relevant outside its own
>software universe).  Any ones-complement architectures left?

I think the CDC machines are mostly dead now, right?

[toc] | [prev] | [next] | [standalone]


#31700

FromMitchAlsup <MitchAlsup@aol.com>
Date2015-12-09 17:30 -0800
Message-ID<33cad851-3548-4aec-bd86-9f71558e8b7c@googlegroups.com>
In reply to#31675
On Wednesday, December 9, 2015 at 7:35:35 AM UTC-6, Quadibloc wrote:

> It stores data in the confusing and unnatural little-endian fashion.

There is nothing confusing about a pure little endian machine;
however precious few LE machines are pure....I digress.
> 
> It doesn't have an easy way to address storage as though it consisted of 48-bit 
> words or 36-bit words. So this interferes with emulation of the 7090 or the 
> 1604 - at top speed, top efficiency, and with architectural extensions to 
> address all of memory.

I do not see the high performance emulation of 36-bit, 48-bit, 60-bit or 
72 bit machines adds ANY value to the architecture--especially one you 
spend so much energy trying to drive forward. How much more forward 
progress would you have achieved if you (instead) figured out how to
emulate odd memory and data sizes on a fixed width architecture!

[toc] | [prev] | [next] | [standalone]


#31834

FromQuadibloc <jsavard@ecn.ab.ca>
Date2015-12-14 00:17 -0800
Message-ID<5edc7144-7e2a-4d56-bae1-fa31b989f5c2@googlegroups.com>
In reply to#31587
On Tuesday, December 8, 2015 at 5:17:12 AM UTC-7, Quadibloc wrote:
> On Monday, December 7, 2015 at 9:13:47 PM UTC-7, Quadibloc wrote:
> > Well, I've added another outline of an ISA to my page at
> 
> > http://www.quadibloc.com/arch/srisc0302.htm
> 
> I've modified it slightly so that the same ISA can also be used when 128 
> registers are available, so now it's possible to shift gears to a higher level of 
> ILP without going to a different instruction set!

While there's still opcode space for such instructions, I've omitted them now, 
as I need to think through the implications of providing more registers first.

I've made other changes; at first the multiple register instructions were taken 
straight from CISC with eight registers, including the extra 24 only when they 
wrapped around.

Then by omitting indexing from them, I made room for a form where a four-bit 
field indicated the low register, and a five-bit field the high register.

I decided that was too irregular, and instead settled for a simpler 
non-orthogonality - only allowing the last four base registers. This 
necessitated ensuring no instructions distinguished by 0 in the base register 
field were in the same section of opcode space as them.

Finally, though, I decided that this was too much as well. And there _was_ a 
way in which I could provide one more bit in these instructions!

I had been using the SEL 32 tactic of coding the last bits of the address to 
indicate which bits were unused for aligned operands - and allowing only 
aligned operands. So operands of different lengths overlapped the same portion 
of the opcode space.

Well, in *this* segment of opcode space, I had instructions like BXH and BXLE, 
which pointed to 16 bit targets, and the load and store multiple instructions 
which had 64 bit and 128 bit targets. Nothing with 32 bit targets.

So I just used the suffixes for things half as wide, and shifted the address 
one bit right to make space to put the one bit (load or store) opcode in the 
second 16 bit halfword of the instruction!

Messy, ugly, and inelegant - but it meant that an orthogonal instruction could 
finally be squeezed in the space available!

John Savard

[toc] | [prev] | [next] | [standalone]


#31848

FromQuadibloc <jsavard@ecn.ab.ca>
Date2015-12-14 05:48 -0800
Message-ID<5fd1c220-3bb1-41fb-8a35-879e4eb8326a@googlegroups.com>
In reply to#31834
On Monday, December 14, 2015 at 1:17:05 AM UTC-7, Quadibloc wrote:

> So I just used the suffixes for things half as wide, and shifted the address 
> one bit right to make space to put the one bit (load or store) opcode in the 
> second 16 bit halfword of the instruction!

Upon further reflection, I used the unused bit in the length coding directly, and 
avoided having to displace the displacement field for these instructions.

John Savard

[toc] | [prev] | [next] | [standalone]


#31893

FromQuadibloc <jsavard@ecn.ab.ca>
Date2015-12-15 15:32 -0800
Message-ID<755a3193-72a3-4ab4-b305-dbd8cc9db677@googlegroups.com>
In reply to#31581
On Monday, December 7, 2015 at 9:13:47 PM UTC-7, Quadibloc wrote:
> Well, I've added another outline of an ISA to my page at
> 
> http://www.quadibloc.com/arch/srisc0302.htm
> 
> on the bottom of the page.

Since I *liked* that one, having outdone myself in squashing a full instruction set into a small amount of opcode space, I've begun fleshing it out now as the Concertina II architecture, at

http://www.quadibloc.com/arch/ctwoint.htm
http://www.quadibloc.com/arch/ct01.htm

John Savard

[toc] | [prev] | [next] | [standalone]


#32077

FromQuadibloc <jsavard@ecn.ab.ca>
Date2015-12-21 12:57 -0800
Message-ID<76df72db-9995-459a-9f4b-1ddde74b0509@googlegroups.com>
In reply to#31893
On Tuesday, December 15, 2015 at 4:32:41 PM UTC-7, Quadibloc wrote:
> On Monday, December 7, 2015 at 9:13:47 PM UTC-7, Quadibloc wrote:
> > Well, I've added another outline of an ISA to my page at
> > 
> > http://www.quadibloc.com/arch/srisc0302.htm
> > 
> > on the bottom of the page.
> 
> Since I *liked* that one, having outdone myself in squashing a full instruction set into a small amount of opcode space, I've begun fleshing it out now as the Concertina II architecture, at
> 
> http://www.quadibloc.com/arch/ctwoint.htm
> http://www.quadibloc.com/arch/ct01.htm

It may be noted, though, that for some time, there won't be any real 
architectural excitement in the updates I make.

Instead, my updates will consist of things such as

- copying over, for the most part, from elsewhere on my site, the definition of stuff like Decimal Floating Point when I give the opcodes for instructions that operate on such data,

- squeezing in additional instructions, like vector instructions.

None of this has anything to do with any attempt to advance the existing state 
of the art, it just is part of providing another open-source ISA that people 
could use.

Later on, I'll describe how instructions of other lengths can be efficiently 
decoded so as to extend the instruction set; still not too exciting, and 
already described here in outline.

I do want to add a "DSP mode" to the architecture. But I will need to do some 
serious thinking about that, as my previous attempt at a DSP-like architecture 
had serious flaws that I could see myself; I was trying to expose lots of 
parallelism, but it wasn't clear that the amount of potential parallelism 
sought would be a good fit to any particular hardware configuration.

I know that my "DSP-like" instruction format is to be designed to offer the 
option of doing up to eight instructions at once, and maybe about a dozen such 
bundles of instructions have to be *all independent of each other* to avoid 
stalling a pipeline that is deep instead of wide.

Whether that's useful for anything, well, DSP chips sell, so it's useful for 
_some_ types of computation. Typical hardware that one can put on a chip these 
days can do many things at once, but an ISA has to give the compiler some way 
to ask for it. While I suspect multithreading, which at least provides the 
possible throughput, if nothing else, will usually be the best one can do, for 
the occasional special-case inner loop, the option of reducing latency by fully 
utilizing the hardware seems to me a legitimate thing to offer.

But, as I said, that makes sense only if I'm dealing with what a reasonable 
available set of hardware can do - and my DSP mode corresponds to that hardware.

John Savard

[toc] | [prev] | [next] | [standalone]


#32085

FromQuadibloc <jsavard@ecn.ab.ca>
Date2015-12-21 19:00 -0800
Message-ID<6979a731-c47d-4430-b1c9-8f8fb400d1e2@googlegroups.com>
In reply to#32077
On Monday, December 21, 2015 at 1:57:13 PM UTC-7, Quadibloc wrote:
 
> It may be noted, though, that for some time, there won't be any real 
> architectural excitement in the updates I make.

I did come up with something new, though;

http://www.quadibloc.com/arch/ct03.htm

now shows a rather weird idea I had.

Since I wanted an alternate format in which lengths of instructions were 
indicated by a 15-bit field at the start of a 256-bit block by marking the ends 
of instructions...

I decided that I wanted to mix in conventionally encoded instructions where the 
first bit indicates the length as well. By using the first bit of the block.

But then should I force the first instruction of a conventional block to always 
be 16 bits, or always 32 bits?

Each choice had sufficient severe drawbacks that instead I worked out a 
modified version of the instruction formats so that a subset of the 
instructions including the most common ones of both sizes would be available as 
the first instruction of a block.

This is what comes of attempting to provide two instruction formats and then 
mix them with as close to zero overhead as can be managed.

John Savard

[toc] | [prev] | [next] | [standalone]


Page 5 of 7 — ← Prev page 1 2 3 4 [5] 6 7  Next page →

Back to top | Article view | comp.arch


csiph-web