asm: base for lec11
This commit is contained in:
parent
240db3c86b
commit
3619e58266
@ -1,3 +1,41 @@
|
||||
# lec11
|
||||
|
||||
At this point I'l mention that just reading isn't going to get you anywhere, you have to try things, and give it a real earnest attempt.
|
||||
|
||||
__ALU:__ Arithmetic Logic Unit
|
||||
|
||||
## Building a 1-bit ALU
|
||||
|
||||

|
||||
|
||||
First we'll create an example _ALU_ which implements choosing between an `and`, `or`, `xor`, or `add`.
|
||||
Whether or not our amazing _ALU_ is useful doesn't matter so we'll go one function at a time(besides `and/or`).
|
||||
|
||||
First recognize that we need to choose between `and` or `or` against our two inputs A/B.
|
||||
This means we have two inputs and/or, and we need to select between them.
|
||||
_Try to do this on your own first!_
|
||||
|
||||

|
||||
|
||||
Next we'll add on the `xor`.
|
||||
AGAIN: try to do this on your own, the main hint I'll give here is: the current mux needs to be changed.
|
||||
|
||||

|
||||
|
||||
Finally we'll add the ability to add and subtract.
|
||||
You may have also noted that we can subtract two things to see if they are the same dhowever, we can also `not` the result of the `xor` and get the same result.
|
||||
|
||||

|
||||
|
||||
At this point our _ALU_ can `and`, `or`, `xor`, and `add`/`sub`.
|
||||
The mux will choose one which logic block to use; the carry-in line will tell the `add` logic block whether to add or subtract.
|
||||
Finally the A-invert and B-invert line allow us to determine if we want to invert either A or B (inputs).
|
||||
|
||||
## N-bit ALU
|
||||
|
||||
For sanity we'll use the following block for our new ALU.
|
||||
|
||||

|
||||
|
||||
Note that we are chaining the carry-in's to the carry-out's just like a ripple adder.
|
||||
also each ALU just works with `1` bit from our given 4-bit input.
|
||||
|
Loading…
Reference in New Issue
Block a user