Computer science - implement a function

In summary, the conversation discusses how to implement a 4-bit binary number in a circuit with a single output F, which is true for inputs between 3 and 12 inclusive. The function F(A,B,C,D) is given and the question is how many 3-to-8 decoders are needed to implement it. The conversation also explores the possibility of using OR gates along with the decoders and discusses different approaches to solving the problem. The conversation ends with a hint to think about boolean constants in order to minimize the number of OR gates needed.
  • #1
XodoX
203
0
Not sure where to put this thread. I'll just post it here. I need help with the following:
A 4-bit binary number ABCD is applied to a circuit on 4 lines A, B, C, D. The circuit has a single output F which is true if the input number is in the range of 3 to 12 inclusive. If the function F(A,B,C,D) = A’CD + A’B + AB’ + AC’D’ realize this functionality , how many 3-to-8 decoders are required to release this function? Implement the function.


Can someone tell me how to do this? I have no idea. I'd really appreciate it.
 
Mathematics news on Phys.org
  • #2
What are you allowed to use other than 3-to-8 decoders -- OR gates?
 
  • #3
CRGreathouse said:
What are you allowed to use other than 3-to-8 decoders -- OR gates?

Probably...these won't work?
 
  • #4
Without building it, I would guess that it could be done with two 3-to-8s if you allow ORs, but it certainly requires 3+ if you don't.
 
  • #5
CRGreathouse said:
Without building it, I would guess that it could be done with two 3-to-8s if you allow ORs, but it certainly requires 3+ if you don't.

a 3 to 8 decoder can implement a 2 or 3 input NOR gate. You can build all possible
logical circuits with NOR gates
 
  • #6
willem2 said:
a 3 to 8 decoder can implement a 2 or 3 input NOR gate. You can build all possible
logical circuits with NOR gates

Yes, but you'll need many 3-to-8 decoders if you build it this way! The question asked for the minimal number of decoders, so I had to know the actual requirements.
 
  • #7
Yes I can do it with just two 3-to-8 decoders plus three 2-input OR gates. I've been a bit reluctant to contribute to this thread or post a complete solution becasue it certainly looks a bit like homework.

Xodox, tell us what you already know or have done. Do you know what a "min-term" is? Do you know how to construct a boolean function as a sum of min-terms? Have you learned that a decoder can be considered as a "min-term generator"?
 
  • #8
uart said:
Yes I can do it with just two 3-to-8 decoders plus three 2-input OR gates.

Good for you. It was easy enough for me to do it with only two 3-to-8s but I used more ORs.

I wonder if 3 is the minimum number of ORs with 2 decoders.
 
  • #9
CRGreathouse said:
Good for you. It was easy enough for me to do it with only two 3-to-8s but I used more ORs.

I wonder if 3 is the minimum number of ORs with 2 decoders.

Hi CRGreathouse, I think I know where you needed more OR gates. The A’CD + AC’D’ part is easy right, just two min terms of (A,C,D); but the A’B + AB’ may require more min terms and hence more OR gates depending on how you approach it.

You can however easily make A’B + AB’ with only two min terms of (A,B,X) if you make an appropriate choice for "X". Hint: think about boolean constants rather than only variables. :)
 
  • #10
Nah, my approach was different. But thanks for the tip.
 

Related to Computer science - implement a function

1. What is a function in computer science?

A function in computer science is a block of code that performs a specific task and can be called and executed multiple times throughout a program. It helps to organize and modularize code, making it easier to read and maintain.

2. How do you implement a function in computer science?

To implement a function in computer science, you must first declare the function by giving it a name and defining its parameters and return type. Then, you can write the code for the function's task within the curly braces. Finally, you can call the function from other parts of the program to execute its code.

3. What is the purpose of using functions in computer science?

Functions in computer science serve several purposes, including modularizing and organizing code, improving readability, and reducing code duplication. They also make it easier to debug and maintain a program by isolating specific tasks within a function.

4. Can you give an example of implementing a function in computer science?

Sure, here is an example of a function in Python that calculates the area of a rectangle:

def calculate_area(length, width):
  area = length * width
  return area

length = 5
width = 3
print(calculate_area(length, width))

# Output: 15

5. What are the advantages of using functions in computer science?

The advantages of using functions in computer science include improved code organization, readability, and maintainability. Functions also help to reduce code duplication, making programs more efficient and easier to debug. Additionally, using functions allows for code reuse, as they can be called multiple times throughout a program.

Similar threads

Replies
4
Views
1K
Replies
13
Views
2K
  • General Math
Replies
1
Views
1K
Replies
10
Views
2K
  • General Math
Replies
7
Views
999
  • Engineering and Comp Sci Homework Help
Replies
1
Views
317
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
  • Programming and Computer Science
Replies
15
Views
2K
Back
Top