-
Notifications
You must be signed in to change notification settings - Fork 0
/
comparator_tb.v
65 lines (53 loc) · 1.46 KB
/
comparator_tb.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:23:23 06/29/2022
// Design Name: buffer
// Module Name: C:/Users/user3/Downloads/Documents/convolution_2/comparator.v
// Project Name: convolution_2
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: buffer
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module comparator_tb;
// Inputs
// Outputs
reg [11:0] mem0_out,mem1_out;
wire t;
assign t=mem0_out==mem1_out;
// Instantiate the Unit Under Test (UUT)
integer outfile0,outfile1,i;
initial
begin
outfile0=$fopen("out_image_verilog.txt","r");
outfile1=$fopen("output_image_matlab.txt","r");
i=0;
while (! $feof(outfile0))//read until an "end of file" is reached.
begin
$fscanf(outfile0,"%b\n",mem0_out); //scan each line and get the value as a decimal.
$fscanf(outfile1,"%b\n",mem1_out);
#50; //wait some time as needed.
i=i+1;
end
//once reading and writing is finished, close the file.
$fclose(outfile0);
$fclose(outfile1);
end
initial begin
// Initialize Inputs
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here
end
endmodule