Some software programming languages allow compilers to perform "short cut" or "short circuit" optimizations on AND and OR operations. In a short-cut AND or OR, the second argument is not evaluated if the first argument evaluates to a controlling value. For example, in evaluating f(x) AND g(y), if f(x) is false, then g(y) will not be evaluted.
Answer whether this optimization is feasible and beneficial in hardware.
Solution:
This optimization is neither feasible nor beneficial for hardware.
Hardware executes in parallel (concurrently) and software executes sequentially (serially). In hardware, we already have the circuitry to evaluate both sides of an operand. It would require more circuitry and incur greater delay to control the evaluation of the second operand than to just use the result of the second operand.
Extra notes:
Answer whether this optimization is feasible and beneficial in hardware.
Solution:
This optimization is neither feasible nor beneficial for hardware.
Hardware executes in parallel (concurrently) and software executes sequentially (serially). In hardware, we already have the circuitry to evaluate both sides of an operand. It would require more circuitry and incur greater delay to control the evaluation of the second operand than to just use the result of the second operand.
Extra notes:
- f(x) and g(y) take multiple cycles to execute and each is executed on separate hardware, then we can execute both f(x) and g(y) at the same time and perform the short-cut optimization if the first operation to complete execution results in a controlling value.
- If f(x) and g(y) take multiple clock cycles to execute and are executed on the same hardware, then the short-cut optimization is feasible and beneficial.
hardware world.










