-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBlockRAMvec.v
62 lines (51 loc) · 1.17 KB
/
BlockRAMvec.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
module BlockRAM_Vec(clk,WE,Addr,AddrOut,MVreadOut,VecIn,VecOut);
input clk;
input [13:0] Addr,AddrOut;
input [13:0] VecIn;
input WE;
output [13:0] VecOut,MVreadOut;
reg [13:0] dump,dump2;
reg [13:0] VecMem[0:8039];
assign VecOut = VecMem[dump];
assign MVreadOut = VecMem[dump2];
integer file;
initial
begin
file = $fopen("MVectors.txt");
end
always @(posedge clk)
begin
dump <= Addr;
dump2 <= AddrOut;
if (WE)
begin
VecMem[Addr] <= VecIn;
if(VecIn[13:7] > 36)
begin
if (VecIn[6:0] > 36)
begin
$fdisplay (file, "( -%d, -%d)",~VecIn[6:0]+1'b1,~VecIn[13:7]+1'b1);
$display ("( -%d, -%d)",~VecIn[6:0]+1'b1,~VecIn[13:7]+1'b1);
end
else
begin
$fdisplay (file, "( %d, -%d)",VecIn[6:0],~VecIn[13:7]+1'b1);
$display ("( %d, -%d)",VecIn[6:0],~VecIn[13:7]+1'b1);
end
end
else
begin
if(VecIn[6:0] > 36)
begin
$fdisplay (file, "( -%d, %d)",~VecIn[6:0]+1'b1,VecIn[13:7]);
$display ("( -%d, %d)",~VecIn[6:0]+1'b1,VecIn[13:7]);
end
else
begin
$fdisplay (file, "( %d, %d)",VecIn[6:0],VecIn[13:7]);
$display ("( %d, %d)",VecIn[6:0],VecIn[13:7]);
end
end
end
end
endmodule