
The HP Nanoprocessor: a high-speed processor that can't even add - IndrekR
http://www.righto.com/2020/09/inside-hp-nanoprocessor-high-speed.html
======
greenyoda
Previous discussion:
[https://news.ycombinator.com/item?id=24354950](https://news.ycombinator.com/item?id=24354950)

~~~
bluu00
huh, one more :
[https://news.ycombinator.com/item?id=24109437](https://news.ycombinator.com/item?id=24109437)

~~~
kens
I should point out that the article you linked to is a different article by
CPU Shack. The reason why two articles on the Nanoprocessor came out in a
short time is that the chip's developer recently gave the masks and documents
to CPU Shack, who wrote about it. Then I got the mask scans, so I wrote about
the details of the chip.

So you should read the CPU Shack article too, since it covers different
aspects of the Nanoprocessor: [http://www.cpushack.com/2020/08/09/the-
forgotten-ones-hp-nan...](http://www.cpushack.com/2020/08/09/the-forgotten-
ones-hp-nanoprocessor/)

------
bluu00
> lacking basic arithmetic functionality

> the Nanoprocessor provided high performance in its microcontroller role

So what was its purpose in HP products?

~~~
pmiller2
Technically, it should say it lacks built-in arithmetic instructions. Any
processor can add, subtract, multiply, or fixed width integers via some
combination of bitwise operations. For example,
[https://en.wikipedia.org/wiki/Bitwise_operation#Applications](https://en.wikipedia.org/wiki/Bitwise_operation#Applications)
shows how to do unsigned addition and multiplication.

And, of course, for better or worse, "add two numbers without using the +
operator" is one of those silly LeetCode trivia questions software engineers
occasionally get quizzed on.

~~~
Invictus0
I did this in my head and came up with -1*(-x - y); seems a little cheeky but
acceptable.

~~~
recursive
If you're allowed negation, (like `-x`) then `x - (-y)` seems even better.

~~~
egsmi
Subtract is a "built-in arithmetic instructions" so it wouldn't be allowed in
this environment. The idea is to implement arithmetic, but from bitwise
operations.
[https://en.wikipedia.org/wiki/Bitwise_operation](https://en.wikipedia.org/wiki/Bitwise_operation)

~~~
kens
This is getting far afield from the actual Nanoprocessor, which has increment
and decrement instructions. With those, you can add two numbers by repeatedly
incrementing one and decrementing the other. (Which is a bit like addition
using the Peano axioms.)

See page 126 of the Nanoprocessor User's Manual for code to add two numbers in
this way.

[https://www.hp9845.net/9845/downloads/manuals/Nanoprocessor....](https://www.hp9845.net/9845/downloads/manuals/Nanoprocessor.pdf)

~~~
egsmi
One can also use the techniques demonstrated your reversing the ALU article.
:)

[https://www.righto.com/2020/08/reverse-
engineering-8086s.htm...](https://www.righto.com/2020/08/reverse-
engineering-8086s.html)

