Forum Discussion
michaelaskew
New Contributor
2 years agomodule BinarySearch (
input logic clk,
input logic [6:0] target,
input logic valid,
output logic [6:0] D_out
);
reg [6:0] result;
integer file_out;
initial file_out = $fopen("output.txt", "w");
always_ff @(posedge clk) begin
if (valid) begin
result <= D_out;
$fwrite(file_out, "%b\n", result);
end
end
endmodule
This shortened version retains the essential components for storing D_out when valid is high and writes the result to a file during simulation. Adjust the file path and name as needed.
Regards
Menupro