Without Assign
Without Assign
reg [7:0] g, p;
reg [7:0] c;
always @* begin
g = a & b;
p = a ^ b;
c[0] = carry_in; // Use carry_in for the first carry
c[1] = g[0] | (p[0] & c[0]);
c[2] = g[1] | (p[1] & c[1]);
c[3] = g[2] | (p[2] & c[2]);
c[4] = g[3] | (p[3] & c[3]);
c[5] = g[4] | (p[4] & c[4]);
c[6] = g[5] | (p[5] & c[5]);
c[7] = g[6] | (p[6] & c[6]);
carry_out = g[7] | (p[7] & c[7]);
sum = p ^ c;
end
endmodule
module karatsuba_multiplier (
input wire [7:0] a,
input wire [7:0] b,
output reg [15:0] product
);
module tb_fir_lfsr;
// Testbench signals
reg clk;
reg reset;
wire [7:0] lfsr_out;
wire [15:0] fir_out;
// Clock generation
initial begin
clk = 0;
forever #5 clk = ~clk; // 10ns clock period
end
// Stimulus generation
initial begin
// Initialize signals
reset = 1;
#10;
reset = 0;
// End simulation
$finish;
end
// Monitor signals
initial begin
$monitor("Time: %0t | LFSR Out: %h | FIR Out: %h", $time, lfsr_out,
fir_out);
end
endmodule