-1
\$\begingroup\$

I am asked to make a multipier that takes a three bits input $$x=(x_1, x_2,x_3)$$ and a control signal \$s\$ so that the results will be a hexadecimal 4 bit number $$z=(z_3,z_2,z_1,z_0)$$ such that \$z = x\$ when \$s=0\$ and \$z=2x\$ when \$s=1\$

basically i need to multiply \$x\$ by \$2\$ whenever \$s\$ is high

\$\endgroup\$
  • \$\begingroup\$ It's a number; "hexadecimal" is the system that you use to write that number. In your question's context, that isn't even the notation you use (which is binary, not hexadecimal). \$\endgroup\$ – Marcus Müller Jan 27 at 13:22
4
\$\begingroup\$

When \$s\$ is 0 then the result is \$z = (z_3, z_2, z_1, z_0) = (0, x_2 ,x_1, x_0)\$ and when \$s\$ is 1 then the result is \$z = (z_3, z_2, z_1, z_0) = (x_2 ,x_1, x_0, 0)\$.

So the operation you are basically doing is just shifting input by \$s\$ bits (i.e \$z = x << s\$). This is because a multiplication by 2 is equal to a 1 bit shift.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.