Discussion:
My very first computer (puzzle 179)
Peter Hendriks
2007-05-10 07:59:43 UTC
Raw Message
Good Morning!

Sometimes the answers to my puzzles cannot be found without the help of a
computer. I sometimes forget though that not everyone is an expert in
computer programming. Therefore, this week, as a special training excercise,
a litlle programming puzzle. I designed a tiny and simple computer. With the
help of this computer you should be able to solve this weeks puzzle about
the multiplication of two random numbers.

I am a little behind in administring your solutions to previous puzzles. I
do the best I can. Please keep sending them !

Have fun with the new puzzle!
Wishing you a nice day,
Regards,
Peter http://home.planet.nl/~p.j.hendriks/ppvdw.htm + Union Jack
Frank Buss
2007-05-10 20:45:22 UTC
Raw Message
Post by Peter Hendriks
Peter http://home.planet.nl/~p.j.hendriks/ppvdw.htm + Union Jack
Nice puzzle, but there are 3 ambiguous rules:

What means "the outshifted bit is temporarily placed in the Carry (X)" for
the shifting commands? How long means "temporarily"? I assume until the
next shift or the next jump command and the other commands doesn't change
it.

Another problem is the bit size of A, B and C. The example didn't worked
with my Common Lisp implementation of ESIC (see
http://www.frank-buss.de/tmp/esic.lisp.txt ), because I have unlimited big
integer numbers (but replacing the last SAL by SAR fixed it).

The last problem is the initial state of the carry flag after BEG. I assume
it is cleared.
--
Frank Buss, ***@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Laurence Reeves
2007-05-11 14:37:06 UTC
Raw Message
Post by Frank Buss
Post by Peter Hendriks
Peter http://home.planet.nl/~p.j.hendriks/ppvdw.htm + Union Jack
What means "the outshifted bit is temporarily placed in the Carry (X)" for
the shifting commands? How long means "temporarily"? I assume until the
next shift or the next jump command and the other commands doesn't change
it.
Does this have any bearing on the size of the smallest program? Only if
it does, do you have a genuine objection. (Note that this type of
ambiguity is one that crops up in most real processors, and can often be
used to detect which version of silicon a program is running on.)

I would admit, if "temporarily" were to mean that the value could not be
relied on to be there for the immediately following instruction, there
could be a bit of a problem. The example, by being stated as a valid,
functional program, which does its job as specified, clears up this
"problem".
Post by Frank Buss
Another problem is the bit size of A, B and C. The example didn't worked
with my Common Lisp implementation of ESIC (see
http://www.frank-buss.de/tmp/esic.lisp.txt ), because I have unlimited big
integer numbers (but replacing the last SAL by SAR fixed it).
I think this is covered by the phrase "in size large enough for the
purpose of this puzzle". In fact, what you say is wrong anyway! The
example DID "work". Your choice of implementation merely meant that you
would take an infinite amount of time and memory, during the
initialisation of the random values in the registers, before getting on
to performing even the clearing of the C register. Obviously, an
infinite size for the registers is not suitable "for the purpose of this
puzzle".

Also, as above, the example must be taken as gospel.

Come to think of it, on S?L instructions, which bit did your
implementation take to be the bit being shifted out?
Post by Frank Buss
The last problem is the initial state of the carry flag after BEG. I assume
it is cleared.
Again, if this affects the solution, you have a point. If not, then it
is not a problem. Assuming that it is cleared is probably the least
likely case. RAM has a habit of being set (with a probabilistic tinge),
rather than cleared.
--
Lau
Frank Buss
2007-05-11 16:07:11 UTC
Raw Message
Post by Laurence Reeves
Does this have any bearing on the size of the smallest program? Only if
it does, do you have a genuine objection. (Note that this type of
ambiguity is one that crops up in most real processors, and can often be
used to detect which version of silicon a program is running on.)
You are right, it doesn't matter for the puzzle, maybe I'm just too much a
programmer, who likes complete descriptions of a CPU :-)

BTW: my shortest solution needs 16 positions.
--
Frank Buss, ***@frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de
Laurence Reeves
2007-05-11 18:02:45 UTC
Raw Message
Post by Frank Buss
Post by Laurence Reeves
Does this have any bearing on the size of the smallest program? Only if
it does, do you have a genuine objection. (Note that this type of
ambiguity is one that crops up in most real processors, and can often be
used to detect which version of silicon a program is running on.)
You are right, it doesn't matter for the puzzle, maybe I'm just too much a
programmer, who likes complete descriptions of a CPU :-)
Heehee! And you've set me off down the slightly painful road of getting
X-Face to work in SeaMonkey.
--
Lau