0
$\begingroup$

I have a question

  Given a 16-bit register A holding a number in 2’s complement form, use a 
   single gate (e.g., AND, OR,
  XOR, NAND, NOR, NOT) with an arbitrary number of inputs to implement a 
  circuit that produces an
  output 1 if the number is divisible by 16, and an output 0 otherwise. The 
 bits are labelled A15, A14, ..., A0.

I'm confused at how this answer is expected because the question is only 2 marks my answer was that it would be a single XOR gate with inputs a0-a15 - would this be correct and why?

$\endgroup$
  • $\begingroup$ We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. $\endgroup$ – D.W. Dec 7 '17 at 6:04
  • $\begingroup$ Why don't you write some code to implement your solution, and check what it computes for all $2^{16}$ possible values of the register and check whether it is correct in all cases? That way you can check your own answer... you don't need us. $\endgroup$ – D.W. Dec 7 '17 at 6:05
0
$\begingroup$

A decimal number is divisible by 100 if it ends with two zeroes. The same thing happens in your case, and leads to a solution using a single NOR gate.

$\endgroup$
  • $\begingroup$ How is this possible? So are you saying the NOR gate would have 2 inputs A0,A1? $\endgroup$ – rahulchawla Dec 7 '17 at 14:44
  • 2
    $\begingroup$ I think I have given you enough hints. $\endgroup$ – Yuval Filmus Dec 7 '17 at 14:45
  • $\begingroup$ I'm just a little confused at the wording of question because it says 'arbitrary num of inputs' so does that mean the inputs have to include all the bits or not? $\endgroup$ – rahulchawla Dec 7 '17 at 16:31
  • $\begingroup$ The number of inputs is arbitrary. Your circuit is definitely not arbitrary. $\endgroup$ – Yuval Filmus Dec 7 '17 at 16:33

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