Trouble getting started on my ALU

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble getting started on my ALU

Lindy
When I attempted my ALU, I got confused because of the order of the flags and that they could share the same output.  (Not sure that even makes sense. :-)  ) I think this is a fan-out thing?

Anyway this got me stuck:

if zx==1 then x=0
if nx==1 then x=0

So if both zx and nx are set, then value of x depends on the order of the if's.  Is this a "normal" way to use flags like this, or is it just a sort of short-cut that we are taking to make things easier?  What if I do set zx and nx?  Is there a logical reason that nx trumps zx, or is it an assumption that we've made?

However, after looking at the book a bit more, there is a truth table which dictates the order, so first I want to try to construct it just using those bits.  I'll probably still get stuck, but maybe not.

Thanks always for your kind help!
Lindy
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting started on my ALU

ybakos
The order here does indeed matter, so focus on wiring up "zeroing x or leaving x alone" first, then focus on taking that result and "turning it into 0 or leaving it alone."
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting started on my ALU

Lindy
I'm getting closer!  :-)  I didn't realize how elegantly simply and devious this design was.  I had to really REALLY study it, literally hours!

I think I may figure this one out.

It isn't recommended to post code here, but how would I ask if my solution was a good or common one?

Thanks!

(Lindy)
Reply | Threaded
Open this post in threaded view
|

Re: Trouble getting started on my ALU

cadet1620
Administrator
Lindy wrote
It isn't recommended to post code here, but how would I ask if my solution was a good or common one?
You can email your solution to me and I'll be happy to look at it and comment.

--Mark