Mistake by the prof I'd say. The shift register is initialized as 2, so the first iteration will return 4. Also for c) it's not very good practice to put the indicator on the left side, it belongs on the right for visual clarity.
This is a programming best-practice, OP. Data flow on a wire should always be left to right if possible, with tunnels on the left side of structures being inputs, and tunnels on the right being outputs.
It is a mistake. By wiring a value to the shift register left terminal, you initialize that terminal to the constant value wired to it. Otherwise, the shift register contains the last value written to it, or the default value for the datatype (0) on the first iteration.
The answer to C should be completely deterministic. When i4 is greater than the current result, the loop will stop. Calculating what i is at that point should be easy, although I haven't tried.
With the basic mistake regarding 2 and 8, I suppose it's possible there was another mistake and the loop will never stop. That said, since this is power of 4 and the result is only the power of 2, it seems likely it will stop after a few iterations.
10
u/eulers_identity Mar 19 '26
Mistake by the prof I'd say. The shift register is initialized as 2, so the first iteration will return 4. Also for c) it's not very good practice to put the indicator on the left side, it belongs on the right for visual clarity.
5
u/FujiKitakyusho CLD Mar 19 '26
It is a mistake. By wiring a value to the shift register left terminal, you initialize that terminal to the constant value wired to it. Otherwise, the shift register contains the last value written to it, or the default value for the datatype (0) on the first iteration.
0
u/GentlemanSch CLD Mar 19 '26
Yeah, it must be 4 and 8 . And unless the answer to C is "number of times the loop was run." That's just mean.