This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:discrete:fall2022:projects:lmr0 [2022/09/26 18:18] – [SPECIFICATIONS] spacing hcordell | notes:discrete:fall2022:projects:lmr0 [2022/09/29 03:59] (current) – pleblanc | ||
---|---|---|---|
Line 21: | Line 21: | ||
- | ROTATE-Is fed an array of bits |1|0|1|0|0|, | + | ROTATE-Is fed an array of bits |1|0|1|0|0|, |
{{ : | {{ : | ||
Line 35: | Line 35: | ||
* Xor | * Xor | ||
* Xnor | * Xnor | ||
- | * Logical shift (potentially 2 separate operations, shift left and shift right) | + | * Logical shift (potentially 2 separate operations; Shift Left / Shift Right) |
- | * Logical rotate | + | * Logical rotate |
- | We will be writing different functions that will have this functionality. | + | We will be writing different functions that will have this functionality. While it seems simple, we have to start somewhere, and you might find the later parts in shift/ |
You must define your own set of values that represent the value true/on and false/off. | You must define your own set of values that represent the value true/on and false/off. | ||
Line 48: | Line 48: | ||
Make use of the relational operators (**==**, **!=**, **>**, **<**, **>=**, **<=**) to complete this project. | Make use of the relational operators (**==**, **!=**, **>**, **<**, **>=**, **<=**) to complete this project. | ||
+ | (Comparison operators such as (**&& | ||
Each bitwise operation function will take 2 arguments and return the result of the operation. | Each bitwise operation function will take 2 arguments and return the result of the operation. | ||
Logical shift (left & right) and logical rotate take only one argument and return the result of the operation. | Logical shift (left & right) and logical rotate take only one argument and return the result of the operation. | ||
+ | |||
+ | Although this project is intended to be a library, there must be some form of demonstration in the int main() portion of your code. This can be something such as truth tables for each function you have created. | ||
*Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, | *Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, | ||
Line 56: | Line 59: | ||
*For anybody interested in editing the wiki page, here is the dokuwiki user guide: https:// | *For anybody interested in editing the wiki page, here is the dokuwiki user guide: https:// | ||
=====PROGRAM===== | =====PROGRAM===== | ||
+ | You are free to use c++ with this project as well. Remember, if you do so, to edit the makefile to be able to compile your c++ code. To do this, edit your makefile and change '' | ||
=====OUTPUT SPECIFICATIONS===== | =====OUTPUT SPECIFICATIONS===== | ||
Output the display of what the functions do by calling them and printing them inside your main function. This can also be used to confirm that all your functions work correctly. For the bit array you can either display both initial and result or find another way to get input into your bit array. | Output the display of what the functions do by calling them and printing them inside your main function. This can also be used to confirm that all your functions work correctly. For the bit array you can either display both initial and result or find another way to get input into your bit array. | ||
=====VERIFICATION===== | =====VERIFICATION===== | ||
There is no make verify with this project. Your verification can be in the form of the main function displaying the truth tables. You can also display the rotate left and right array values after calling your function. The truth tables are located above to refer to. | There is no make verify with this project. Your verification can be in the form of the main function displaying the truth tables. You can also display the rotate left and right array values after calling your function. The truth tables are located above to refer to. | ||
+ | |||
+ | =====EXAMPLE===== | ||
+ | Heres an example output: | ||
+ | <cli> | ||
+ | USER@lab46: | ||
+ | --NOT-- | ||
+ | -------- | ||
+ | x | out | ||
+ | 0 | 1 | ||
+ | 1 | 0 | ||
+ | |||
+ | --AND-- | ||
+ | x | y | out | ||
+ | ------------ | ||
+ | 0 | 0 | 0 | ||
+ | 0 | 1 | 0 | ||
+ | 1 | 0 | 0 | ||
+ | 1 | 1 | 1 | ||
+ | |||
+ | --OR-- | ||
+ | x | y | out | ||
+ | ------------ | ||
+ | 0 | 0 | 0 | ||
+ | 0 | 1 | 1 | ||
+ | 1 | 0 | 1 | ||
+ | 1 | 1 | 1 | ||
+ | |||
+ | --NOR-- | ||
+ | x | y | out | ||
+ | ------------ | ||
+ | 0 | 0 | 1 | ||
+ | 0 | 1 | 0 | ||
+ | 1 | 0 | 0 | ||
+ | 1 | 1 | 0 | ||
+ | |||
+ | --XOR-- | ||
+ | x | y | out | ||
+ | ------------ | ||
+ | 0 | 0 | 0 | ||
+ | 0 | 1 | 1 | ||
+ | 1 | 0 | 1 | ||
+ | 1 | 1 | 0 | ||
+ | |||
+ | --XNOR-- | ||
+ | x | y | out | ||
+ | ------------ | ||
+ | 0 | 0 | 1 | ||
+ | 0 | 1 | 0 | ||
+ | 1 | 0 | 0 | ||
+ | 1 | 1 | 1 | ||
+ | |||
+ | --NAND-- | ||
+ | x | y | out | ||
+ | ------------ | ||
+ | 0 | 0 | 1 | ||
+ | 0 | 1 | 1 | ||
+ | 1 | 0 | 1 | ||
+ | 1 | 1 | 0 | ||
+ | |||
+ | Bitset: | ||
+ | Bitset (after LSHIFT): 0100 | ||
+ | Bitset (after RSHIFT): 0010 | ||
+ | |||
+ | Bitset: | ||
+ | Bitset (after LROTATE): 01001 | ||
+ | Bitset (after RROTATE): 10100 | ||
+ | </ |