Question: 1. Write four scheme functions to simulate these four gates. You will then use those functions below. 2. 3. 4. What to Turn in: Turn
1. Write four scheme functions to simulate these four gates. You will then use those functions below.
2.
3.
4.
What to Turn in:
Turn in a single Scheme file (logic.ss file) with the following functions defined (these names start with little L's, not I's or 1's):
- l-and: Takes two 1-bit integers and returns a 1-bit integer
- l-or: Takes two 1-bit integers and returns a 1-bit integer
- l-not: Takes one 1-bit integer and returns a 1-bit integer
- l-xor: Takes two 1-bit integers and returns a 1-bit integer
- fulladdr: Takes three 1-bit integers and returns a pair of two,1-bit integers
- Note: Result should be a pair: (sum . carry)
- Note: It must use the functions l-and, l-or, and l-xor.
- n-bit-addr: Takes two lists of 1-bit integers and a 1-bit integer for carry-in. It returns a pair of a list of 1-bit integers, and a 1-bit integer for carry-out
- Note: You can assume the lists are the same size
- Note: Result should be a pair: (list-sum . carry-out)
- Note: It must use the function fulladdr.
Testing:
Make sure you test your functions as you develop them.
fulladdr should behave like this:
Here are some test cases for your n-bit-addr. Of course, you can create more:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
