ALU
ALU
input a, b,
output d, cout
);
assign d = (a ^ b);
assign cout = (a & b);
endmodule
module FA(
input a, b, c,
output d, cout
);
assign d = (a ^ b ^ c);
assign cout = (a & b) | (b & c) | (c & a);
endmodule
module cla8bit(
input [7:0] a, b,
input cin,
output [7:0] sum,
output cout
);
wire [7:0] g, p;
wire [8:0] c;
assign g = a & b;
assign p = a | b;
module multiplier(
input [7:0] a,
input [7:0] b,
output reg [15:0] p
);
reg [15:0] partialsum [7:0];
integer i, j;
module divider (
input [7:0] A, B,
output reg [7:0] quotient, remainder
);
always @(*) begin
if (B != 0) begin
quotient = A / B;
remainder = A % B;
end else begin
quotient = 8'd0;
remainder = 8'd0;
end
end
endmodule
module ALU1(
input [7:0] A, B,
input [3:0] ALU_Sel,
output [7:0] ALU_Out,
output CarryOut
);
reg [7:0] ALU_Result;
wire [8:0] tmp;
wire [7:0] quotient, remainder;
wire [15:0] product;
wire [7:0] sum, carry_out;
wire sum_carry_out;