`include "C:\\Users\\Kevin\\Uvu\\3740\\Ds\\Final\\Params\\Inc\\AddVector.v"
`include "C:\\Users\\Kevin\\Uvu\\3740\\Ds\\Final\\Params\\Inc\\Mux.v"
module DivByTen( quotient, remainder, dividend);
output [ 2:0] quotient;
output [ 3:0] remainder;
input [ 5:0] dividend;
wire [ 6:0] sum40;
wire [ 6:0] sum20;
wire [ 5:0] sum10;
wire [ 5:0] result40;
wire [ 4:0] result20;
wire [ 3:0] result10;
AddVector av40 #(6)( sum40, dividend, 6'b011000); // Subtract 40.
AddVector av20 #(6)( sum20, result40, 6'b101100); // Subtract 20.
AddVector av10 #(5)( sum10, result20, 5'b10110 ); // Subtract 10.
// For each mux, pass through the least significant bits of the sum if the
// most significant bit is high, which indicates the subtraction is positive;
// otherwise pass through the value before the subtraction.
Mux mx40 #(6)( result40, sum40[ 6], sum40[ 5:0], dividend);
Mux mx20 #(5)( result20, sum20[ 6], sum20[ 4:0], result40[ 4:0]);
Mux mx10 #(4)( result10, sum10[ 5], sum10[ 3:0], result20[ 3:0]);
assign quotient[ 2] = sum40[ 6];
assign quotient[ 1] = sum20[ 6];
assign quotient[ 0] = sum10[ 5];
assign remainder = result10;
endmodule