electroRF
Member
Hi,
I'm trying to sketch a block diagram of the following system using discrete components (as counters, etc).
the output of this system would be
n: 1, 2, 3, 4, 5, 6 ....
n^2: 1, 4, 9, 16, 25, 36, ....
for getting n, you just use a counter.
but, how do you get n^2?
Thank you very much.
---- EDIT ----
In SW I could do the following:
if k'th bit in n is '1', I'd shift-left n by k.
then, I'd sum up all the shift results, to get n^2.
But -> How do you do that by HW?
Example:
if n = 1010
then
n^2 = 1010 << 1 + 1010 << 3
I'm trying to sketch a block diagram of the following system using discrete components (as counters, etc).
the output of this system would be
n: 1, 2, 3, 4, 5, 6 ....
n^2: 1, 4, 9, 16, 25, 36, ....
for getting n, you just use a counter.
but, how do you get n^2?
Thank you very much.
---- EDIT ----
In SW I could do the following:
if k'th bit in n is '1', I'd shift-left n by k.
then, I'd sum up all the shift results, to get n^2.
But -> How do you do that by HW?
Example:
if n = 1010
then
n^2 = 1010 << 1 + 1010 << 3
Last edited: