Skip to main content
added 203 characters in body
Source Link
Colin
  • 1.9k
  • 2
  • 12

To provide more of a visualization of Matt's answer, here's a good diagram of how MIPS architecture handles their operations. This is a 1-bit ALU:

enter image description here

Picture can be found in the textbook Computer Organization and Design MIPS Edition: The Hardware/Software Interface by Patterson and Hennessy.

So you can see the "Operation" bit(s) that "selects" the operation that multiplexes a particular function that can be performed between "a" and "b": add, AND, OR, less than, subtract, etc. If we invert "a" or "b", as shown with "Ainvert" and "Binvert", we can perform a subtraction. There are other operations like overflow or zero detection. More operations can be accomplished, which has been proven with more modern architectures but this is simply just an example of a 32-bit MIPS ALU:

enter image description here Picture from the same source as mentioned above.

So basically in order to get a result from two numbers, you are first choose an operation, e.g. 0x02 for addition shown here, then the binary numbers for "a" and "b", e.g. a[0:31] = 111010...001 and b[0:31] = 101010...010, and then it will output the result, e.g. 010 (for add) 111010...001 (a), 101010...010 (b) --> (1)010100...011 stored in memory but oh wait, there's an overflow with the extra (1)... Raise that flag This is pretty much how your Assembly works.

To provide more of a visualization of Matt's answer, here's a good diagram of how MIPS architecture handles their operations. This is a 1-bit ALU:

enter image description here

Picture can be found in the textbook Computer Organization and Design MIPS Edition: The Hardware/Software Interface by Patterson and Hennessy.

So you can see the "Operation" bit(s) that "selects" the operation that multiplexes a particular function that can be performed between "a" and "b": add, AND, OR, less than, subtract, etc. If we invert "a" or "b", as shown with "Ainvert" and "Binvert", we can perform a subtraction. There are other operations like overflow or zero detection. More operations can be accomplished, which has been proven with more modern architectures but this is simply just an example of a 32-bit MIPS ALU:

enter image description here Picture from the same source as mentioned above.

So basically in order to get a result from two numbers, you are first choose an operation, e.g. 0x02 for addition shown here, then the binary numbers for "a" and "b", e.g. a[0:31] = 111010...001.

To provide more of a visualization of Matt's answer, here's a good diagram of how MIPS architecture handles their operations. This is a 1-bit ALU:

enter image description here

Picture can be found in the textbook Computer Organization and Design MIPS Edition: The Hardware/Software Interface by Patterson and Hennessy.

So you can see the "Operation" bit(s) that "selects" the operation that multiplexes a particular function that can be performed between "a" and "b": add, AND, OR, less than, subtract, etc. If we invert "a" or "b", as shown with "Ainvert" and "Binvert", we can perform a subtraction. There are other operations like overflow or zero detection. More operations can be accomplished, which has been proven with more modern architectures but this is simply just an example of a 32-bit MIPS ALU:

enter image description here Picture from the same source as mentioned above.

So basically in order to get a result from two numbers, you are first choose an operation, e.g. 0x02 for addition shown here, then the binary numbers for "a" and "b", e.g. a[0:31] = 111010...001 and b[0:31] = 101010...010, and then it will output the result, e.g. 010 (for add) 111010...001 (a), 101010...010 (b) --> (1)010100...011 stored in memory but oh wait, there's an overflow with the extra (1)... Raise that flag This is pretty much how your Assembly works.

added 203 characters in body
Source Link
Colin
  • 1.9k
  • 2
  • 12

To provide more of a visualization of Matt's answer, here's a good diagram of how MIPS architecture handles their operations. This is a 1-bit ALU:

enter image description here

Picture can be found in the textbook Computer Organization and Design MIPS Edition: The Hardware/Software Interface by Patterson and Hennessy.

So you can see the "Operation" bit(s) that "selects" the operation that multiplexes a particular function that can be performed between "a" and "b": add, AND, OR, less than, subtract, etc. If we invert "a" or "b", as shown with "Ainvert" and "Binvert", we can perform a subtraction. There are other operations like overflow or zero detection. More operations can be accomplished, which has been proven with more modern architectures but this is simply just an example of a 32-bit MIPS ALU:

enter image description here Picture from the same source as mentioned above.

So basically in order to get a result from two numbers, you are first choose an operation, e.g. 0x02 for addition shown here, then the binary numbers for "a" and "b", e.g. a[0:31] = 111010...001.

To provide more of a visualization of Matt's answer, here's a good diagram of how MIPS architecture handles their operations. This is a 1-bit ALU:

enter image description here

Picture can be found in the textbook Computer Organization and Design MIPS Edition: The Hardware/Software Interface by Patterson and Hennessy.

So you can see the "Operation" bit(s) that "selects" the operation that multiplexes a particular function that can be performed between "a" and "b": add, AND, OR, less than, subtract, etc. If we invert "a" or "b", as shown with "Ainvert" and "Binvert", we can perform a subtraction. There are other operations like overflow or zero detection. More operations can be accomplished, which has been proven with more modern architectures but this is simply just an example of a 32-bit MIPS ALU:

enter image description here Picture from the same source as mentioned above.

To provide more of a visualization of Matt's answer, here's a good diagram of how MIPS architecture handles their operations. This is a 1-bit ALU:

enter image description here

Picture can be found in the textbook Computer Organization and Design MIPS Edition: The Hardware/Software Interface by Patterson and Hennessy.

So you can see the "Operation" bit(s) that "selects" the operation that multiplexes a particular function that can be performed between "a" and "b": add, AND, OR, less than, subtract, etc. If we invert "a" or "b", as shown with "Ainvert" and "Binvert", we can perform a subtraction. There are other operations like overflow or zero detection. More operations can be accomplished, which has been proven with more modern architectures but this is simply just an example of a 32-bit MIPS ALU:

enter image description here Picture from the same source as mentioned above.

So basically in order to get a result from two numbers, you are first choose an operation, e.g. 0x02 for addition shown here, then the binary numbers for "a" and "b", e.g. a[0:31] = 111010...001.

Source Link
Colin
  • 1.9k
  • 2
  • 12

To provide more of a visualization of Matt's answer, here's a good diagram of how MIPS architecture handles their operations. This is a 1-bit ALU:

enter image description here

Picture can be found in the textbook Computer Organization and Design MIPS Edition: The Hardware/Software Interface by Patterson and Hennessy.

So you can see the "Operation" bit(s) that "selects" the operation that multiplexes a particular function that can be performed between "a" and "b": add, AND, OR, less than, subtract, etc. If we invert "a" or "b", as shown with "Ainvert" and "Binvert", we can perform a subtraction. There are other operations like overflow or zero detection. More operations can be accomplished, which has been proven with more modern architectures but this is simply just an example of a 32-bit MIPS ALU:

enter image description here Picture from the same source as mentioned above.