-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathaxi_stream_video_image_example.sv
84 lines (69 loc) · 2 KB
/
axi_stream_video_image_example.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import bitmap_processing::*;
import axi_stream_video_image::*;
module axi_stream_video_image_example();
// Bitmaps
Bitmap inputBitmap;
Bitmap outputBitmap;
// Interfaces
logic clk;
logic [31:0] m_axis_video_out_tdata;
logic m_axis_video_out_tvalid;
logic m_axis_video_out_tlast;
logic m_axis_video_out_tuser;
logic m_axis_video_out_tready;
logic [31:0] s_axis_video_in_tdata;
logic s_axis_video_in_tvalid;
logic s_axis_video_in_tlast;
logic s_axis_video_in_tuser;
logic s_axis_video_in_tready;
assign s_axis_video_in_tdata = m_axis_video_out_tdata; // | 'hFF;
assign s_axis_video_in_tvalid = m_axis_video_out_tvalid;
assign s_axis_video_in_tlast = m_axis_video_out_tlast;
assign s_axis_video_in_tuser = m_axis_video_out_tuser;
assign s_axis_video_in_tready = m_axis_video_out_tready;
// Callback class
class VideoVIPCallback extends AxisVideoImageCallback;
virtual task SentCallback();
$display("Sent");
endtask
virtual task ReceivedCallback();
$display("Received");
$stop();
endtask
endclass
VideoVIPCallback vcallback = new();
AxisVideoImageCallback callbacks = vcallback;
axis_video_img_in_vip #(
.IMAGE_WIDTH(960),
.IMAGE_HEIGHT(540),
.PIXEL_PER_CLK(1)
)
in_vip
(
.*,
.frameBitmap(inputBitmap),
.callbacks(callbacks)
);
axis_video_img_out_vip #(
.IMAGE_WIDTH(960),
.IMAGE_HEIGHT(540),
.PIXEL_PER_CLK(1)
)
out_vip
(
.*,
.frameBitmap (outputBitmap),
.callbacks(callbacks),
);
always begin
clk = 0;
forever #5 clk = ~clk;
end
initial begin
for(int i = 0; i < 10; i++) begin
@(posedge clk);
end
out_vip.ReceiveAndSaveBitmap("out.bmp");
in_vip.ReadAndSendBitmap("in.bmp");
end
endmodule