Your task

You will make an divider capable of dividing 16-bit numbers by 8-bit numbers which will take 9 clock cycles to produce the quotient.

Why 16-by-8? Well, for the same reason when you multiply two 8-bit numbers, you get a 16-bit product; since division is backwards, you start with a 16-bit dividend, and divide by an 8-bit divisor to get an 8-bit quotient.

Why 9 cycles? Well it would be 8 but we’re starting the divisor shifted left by 8 instead of 7, so the first cycle will be a “dummy” cycle to shift it right by one.

0. Starting off

First, go to the materials page and download/open the fast_mult_4x4.circ example. I showed how this worked in class, so play around with it yourself.

Now, for your lab, to make it easier for the grader, start off by placing the following near the top-left of the circuit (you can copy it from the multiplier circuit):

This is a clock and an Input/Output > Button going into an OR gate, to produce the clock signal. By doing this, you can tick the clock by clicking the button once, instead of clicking the clock twice.

Finally, make 3 16-bit registers and name them like so:

Don’t forget to hook the clock up to the triangle inputs on these registers! Use tunnels like shown in the first pic.

Here is the algorithm you’ll implement in circuitry:

// you'll put these values into the registers with the poke tool.
divisor <<= 8;
remainder = dividend;
quotient = 0;

// ...and you'll tick the clock 9 times to do this loop :D
for(9 times) {
   // THIS is what you'll really be implementing.
   if(divisor > remainder) {
      quotient  = (quotient << 1) | 0; // "append a 0"
   } else {
      remainder = remainder - divisor;
      quotient  = (quotient << 1) | 1; // "append a 1"
   divisor >>= 1;

1. The Divisor register

This is the easiest one.

To test:

2. The subtraction step and Dividend/Remainder register

In the code above, remainder is set to remainder - divisor, but only if divisor <= remainder. We can implement this condition using the Remainder’s write enable input.

To test:

3. The Quotient register

Last is the quotient. You’re on your own for this one.

To test:

Try it with some other numbers.


Once you’re sure your circuit works, you can submit.

Name your circuit file username_lab6.circ, like jfb42_lab6.circ.

Submit here.

Drag your asm file into your browser to upload. If you can see your file, you uploaded it correctly!

You can also re-upload if you made a mistake and need to fix it.