Problem with ALU in Logisim

Thread Starter

maddy1

Joined Jul 17, 2018
5
I'm attempting to design an ALU on Logisim but my problem is that I cannot figure out how to add in the 'set less than' function. I thought about using a bit selector from the plexers catalog but I'm not sure how I'm gonna go about doing it. It will be connected to an output pin where it has a 1 if A < B.

Many thanks!
 

Attachments

Thread Starter

maddy1

Joined Jul 17, 2018
5
It would help if you defined the "set less than" function that you are trying to add.
'Set less than' compares inputs A and B to determine which is a smaller value. So when A is bigger than B an output 1 should come out. Otherwise the output pin shows 0.
 

WBahn

Joined Mar 31, 2012
29,976
What is your schematic of? Is it your ALU as it stands before attempting to add the new function? Or after your attempt to do so?

In your first post you said, "It will be connected to an output pin where it has a 1 if A < B."

But in your latest post you said, "So when A is bigger than B an output 1 should come out. Otherwise the output pin shows 0."

So I'm quite confused as to what this function is.

I'm guessing that your "set less than" is short for "set output True if A is less than B".

Since your output, Y, is eight bits wide, what does it mean to set it? Should the output be "00000001", "10000000", "11111111", or something else?

What is your basic approach to determining if A is less than B? It looks like you have an adder and the logic to perform A - B. How can that help you?
 

Thread Starter

maddy1

Joined Jul 17, 2018
5
What is your schematic of? Is it your ALU as it stands before attempting to add the new function? Or after your attempt to do so?

In your first post you said, "It will be connected to an output pin where it has a 1 if A < B."

But in your latest post you said, "So when A is bigger than B an output 1 should come out. Otherwise the output pin shows 0."

So I'm quite confused as to what this function is.

I'm guessing that your "set less than" is short for "set output True if A is less than B".

Since your output, Y, is eight bits wide, what does it mean to set it? Should the output be "00000001", "10000000", "11111111", or something else?

What is your basic approach to determining if A is less than B? It looks like you have an adder and the logic to perform A - B. How can that help you?
Yes you are right, I mixed up the words. The output should come from an output pin, not the Y output. I use it for the arithmetics +, &, or, minus.

I have not figured out what components are necessary to perform this task. I guess my concrete question should be: What is a good approach to compare if A is a smaller value than B.
 

WBahn

Joined Mar 31, 2012
29,976
Do you understand the ALU as you posted in your first post and how each part of it works? If not, that's the place to start?

Let's play a game.

I have two numbers, X and Y.

You get to tell me one operation, such as X + Y, Y * X, Y - X, or whatever, and I will give you the result.

Based on that result, you need to determine if X is less than Y.

What operation do you want me to perform?
 

WBahn

Joined Mar 31, 2012
29,976
I think I understand the ALU that I made but sure, I'll play.

How about X + Y

X = 0001
Y = 0100
Remember, YOU don't know what X and Y are. Only I know that. What you get to do is tell me to perform a single operation (evaluate an expression involving X and Y with a single operator) and I will tell you only the result. Based solely on the single value I tell you, you must decide whether or not X is less than Y.

So you chose X + Y.

The result of that is -5.

Is that enough to tell you whether or not X is less than Y?

What if X = -10 and Y = 5? Then X + Y = -5 and X is less than Y.

But what if X = 3 and Y = -8? Then X + Y is still -5 but X is NOT less than Y.

So X + Y won't work.

Get the idea?
 
Top