Share some tips on ALU implementation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Share some tips on ALU implementation

reflectionalist
So I have finished my ALU. Thanks to the feedback from cadet1620, I have even further improved it. As a summary, I have written down some tips that I want to share with the community and also ask for correction in case I am wrong. If the instructor or moderator find these tips give too much information, feel free to edit or remove any of them.
  • a = true sets every bit of a to 1, not only the least significant bit. Given 2's complement representation, it in effect sets a to -1. This behavior is not explicitly specified in the text but implied by an example in Appendix A (p. 286).
  • On hardware, there is no conditional calculation such as high-level if-expression/statement. It is not possible to avoid one calculation but only possible to select the result of either calculation.
  • The output pin of a chip can not be fed back to parts of it. However, an internal pin can be used to fork the pin connected to the output pin. This enables a hold of the output inside the chip.
  • The test for zero can be done by inverting a test for non-zero. A binary number in 2's complement representation is non-zero whenever any bit is set.
  • The test for negativity again employs the property that the 2's complement representation of a negative number always has 1 as its most significant bit.