-
Notifications
You must be signed in to change notification settings - Fork 1
/
ISAPostCard.sv
55 lines (46 loc) · 1.2 KB
/
ISAPostCard.sv
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
module PostSequenceMemory
(
input wire Clock,
input wire [7:0] Current,
output reg [31:0][7:0] PostSequence,
output reg [7:0] LastPostEntry,
output reg Overflow
);
initial begin
Overflow <= 1'b0;
LastPostEntry <= 8'd0;
end
always @(posedge Clock) begin
if (PostSequence[LastPostEntry] != Current) begin
if (LastPostEntry >= 8'd31) begin
Overflow <= 1'b1;
//LastPostEntry <= 5'd0;
end
else begin
LastPostEntry = LastPostEntry + 5'd1;
if (LastPostEntry <= 8'd31) PostSequence[LastPostEntry] = Current;
end
end
end
endmodule
module Dummy
(
input wire Clock,
input wire [7:0] Current,
output reg [7:0] DummyOut
);
(* keep = 1 *) wire [31:0][7:0] TempMem /* synthesis keep = 1 */;
(* keep = 1 *) wire [4:0] TempMemLen /* synthesis keep = 1 */;
wire TempOverflow;
reg [4:0] DummyFirstIndex;
initial begin
DummyFirstIndex <= 5'd0;
end
PostSequenceMemory mem(.Clock(Clock), .Current(Current), .PostSequence(TempMem),
.LastPostEntry(TempMemLen), .Overflow(TempOverflow));
always @(posedge Clock) begin
DummyOut = TempMem[DummyFirstIndex];
if (DummyFirstIndex == 5'd31) DummyFirstIndex = 5'd0;
else DummyFirstIndex = DummyFirstIndex + 5'd1;
end
endmodule