Logisim Questions for Assignment

Thread Starter

Dejan Joksimovic

Joined May 9, 2017
7
Hey guys, I am very new to Logisim and logic gates in general. Anyway, I have a question that I need help with asap. The assignment is asking me to create a circuit where the user (myself) can input a value for Card 1 (C1) value (C1-1, C1-2, and C1-3) and a Card 2 (C2) value (C2-1, C2-2, and C2-3) and the circuit decodes the C1-1, C1-2, C1-3 and C2-1, C2- 2, C2-3 values using a decoder to determine if C1 + C2 < 7.

This is the requirement for the assigment. "For this assignment you are required to implement a simple game for a single player. The game has two cards (C1 and C2) as inputs. Each card value is an octal digit (3 input bits, values 0..7). The two card values C1 and C2 are added together. If C1 + C2 < 7 the player wins. If C1 + C2 > 6 the player loses. You may only use the three basic logic gates: AND, OR and NOT."

I have spent the last 2 days trying to figure this out, and I cannot come up with a solution. I have asked my lecturer and he cannot help me much which makes sense. If someone could help me understand and/or possibly show me how to do this, that would mean a lot to me since this is very important to me. Any help is greatly appreciated!

These are the values of C1 and C2:

C1: http://imgur.com/TufvFOV
Dejan_C1_TufvFOV.png
C2: http://imgur.com/8zhTNcV
Dejan_C2_8zhTNcV.png


This is what I have done so far (3-8 bit decoder and don't know what to do from this point):
http://imgur.com/JypRy0k
http://imgur.com/W0SmPTn
Dejan_sol1_JypRy0k.png


I am grateful for any help I receive, thank you guys so much <3
 
Last edited by a moderator:

WBahn

Joined Mar 31, 2012
30,071
What is your final output? That isn't specified. Is it a single output that is HI if the player wins and LO if they lose? Or something else.

You know that each decoder will make exactly one of its eight outputs high, correct? Can you identify the combinations of outputs, one from each side, that result in a win?

There are alternative ways to approach the problem, but you may not be ready for them. Do you know how to construct an adder?
 

Thread Starter

Dejan Joksimovic

Joined May 9, 2017
7
What is your final output? That isn't specified. Is it a single output that is HI if the player wins and LO if they lose? Or something else.

You know that each decoder will make exactly one of its eight outputs high, correct? Can you identify the combinations of outputs, one from each side, that result in a win?

There are alternative ways to approach the problem, but you may not be ready for them. Do you know how to construct an adder?
Well the result is meant to be a single LED output that lights up if the equation C1 + C2 <7 is satisfied. I just do not know how to set up the two 3-8 bit decoders to do this. As for the combination of outputs, all I know is that when one output (i.e 4) and the other output (i.e 2) are added together, if they equal less than 7, the LED lights up and is a win and if they add up to a higher number, the LED does not light up. I do not know how to use an adder, I am new to this program so I'm not sure.
 

WBahn

Joined Mar 31, 2012
30,071
Let's simplify the problem.

Can you use the outputs from the two decoders to create a circuit that is HI if output 3 from the left side is HI and output 2 from the right side is HI and is LO for all other combinations?
 

bertus

Joined Apr 5, 2008
22,278
Hello,

I uploaded your table images to the forum.
I also merged the two decoder images to one and added it to the post.

Bertus
 

RBR1317

Joined Nov 13, 2010
714
It is unclear whether the assignment requires implementation using the decoder method or whether you are free to use a more elegant approach. Nevertheless, with decoders generating a separate output for each possible input condition, one must select which input conditions satisfy the problem constraints then combine the decoded outputs to produce the required result.

Note that you have produced two columns of decoded outputs. Choose one from column A and one from column B, then ask whether that combination produces a WIN result. If it does, then add that combination to the signal that indicates a winner.

Column A has 8 outputs, column B has 8 outputs. That is 64 possible combinations. There are only 28 winning combinations (C1+C2<7). But at this moment the combining circuitry for the decoded outputs will only handle up to 16 winning combinations.
 

WBahn

Joined Mar 31, 2012
30,071
Column A has 8 outputs, column B has 8 outputs. That is 64 possible combinations. There are only 28 winning combinations (C1+C2<7). But at this moment the combining circuitry for the decoded outputs will only handle up to 16 winning combinations.
But with just a very tiny bit of glue logic 16 channels is WAY overkill. For instance, with a single inverter you use one channel and cover six combinations, eliminating the need for five others. Another inverter lets you use a second channel while eliminating four more. So right there you only have 17 more combinations to cover and still have 14 channels available. Beyond this requires additional 2-input gates, but just one OR gate and another inverter eliminates 4 more so now you would have 13 left to cover and 13 channels with which to cover them.

Another approach would be to cascade the decoder outputs through OR gates so that your modified decoder's outputs now mean N-or-less (so if output 4 is HI, it means that the code that was applied was 0, 1, 2, 3, or 4). You only need to do this to one side. Now you only need 7 channels of combining logic.
 

Thread Starter

Dejan Joksimovic

Joined May 9, 2017
7
I'm sorry guys, I am really trying hard to understand what you guys are trying to say. I understand that there will be a total of 64 combinations and only 28 of them are a win. How would I combine the two outputs into a gate? Would I just do it like 0 and 0, 0 and 1, 0 and 2 etc. ?

WBahn, I am not too sure what you mean by HI and LO, if you want I can attach the assignment task sheet and maybe that will help you guys understand the problem more, if you have time.

Note: I am only doing Part A of the assignment.

Thanks guys for trying to help me out <3
 

Attachments

WBahn

Joined Mar 31, 2012
30,071
HI and LO are just the two names for the logic levels. Other names are TRUE and FALSE, and ONE and ZERO.

Think of how you might describe the logic in words:

You WIN if ((one side is 0) AND (the other side is 0)) OR ((one side is 0) AND (the other side is 1)) OR ((one side is 0) AND (the other side is 2))....

Now think of some other ways you might describe it:

You WIN if ((one side is 0) AND (the other side is NOT 7)) OR ....
 

RBR1317

Joined Nov 13, 2010
714
For instance, with a single inverter you use one channel and cover six combinations, eliminating the need for five others.
I just can't seem to visualize what that means. ???

EDIT:
"You WIN if ((one side is 0) AND (the other side is NOT 7)) OR ...."

I had been thinking there would be no need to decode the 7 condition since it would never contribute to a win.
 
Last edited:

Thread Starter

Dejan Joksimovic

Joined May 9, 2017
7
Guys I have finally figured it out! It took me a long time but eventually I got with the help if you guys. Thank you all who helped me out, I really appreciate it!

I would upload the file to this comment but I am not able to upload .circ files since they are not supported on this website, I assume.

Thanks once again <3
 

WBahn

Joined Mar 31, 2012
30,071
I've done Part A but I haven't done Part B, I just don't understand it, so I left it out.
Part B is pretty straight forward except that I don't think one aspect of the rules was very well thought out and you should ask for clarification about it.

Since you always increment one counter and decrement the other, the sum of both counters must always be zero. That means that you your counter has to support negative numbers -- just consider the outcome of the first game -- both counters start at zero and you are going to have to decrease the value of one of them by one.

This also means that the length of the overall game is indeterminate since to win (or lose) you have to win (or lose) N more games than you have lost (or won). So you might have played 1000 games and have won 502 of them and lost 498 of them and your win counter would only be at 4.

Ask the instructor if this was the intent, or if the intent was that you win (or lose) if you reach a total of N wins (or losses) before reaching a total of N losses (or wins).
 
Top