summaryrefslogtreecommitdiff
path: root/rtl/vdc/vdc_top.sv
blob: f7dacddabac2fa812dd62f07fb93ab1f426582b7 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
module vdc_top
import vdc_pkg::*, vdc_if_pkg::*;
(
	input  logic      clk,
	                  rst_n,

	       if_axil.s  host,

	       if_axib.m  stream,

	       vdc_dac.tx dac
);

	axi4lite_intf #(.ADDR_WIDTH(VDC_IF_MIN_ADDR_WIDTH)) regblock();
	vdc_if__in_t if_in;
	vdc_if__out_t if_out;

	logic csr_back_push, csr_dac_enable, csr_dac_on, csr_double_buff,
	      csr_back_set, csr_front_set, frame_done, frame_start;

	ptr csr_back, csr_back_next, csr_front, csr_front_next, csr_retired, front_base;
	geom_dim csr_lines, csr_line_len, csr_stride, lines, line_len, stride;

	assign csr_dac_enable = if_out.CTRL.DACEN.value;
	assign csr_double_buff = if_out.CTRL.DOUBLEBUFF.value;
	assign if_in.CTRL.DACON.next = csr_dac_on;

	assign csr_lines = if_out.GEOMETRY.LINES.value;
	assign csr_line_len = if_out.GEOMETRY.LENGTH.value;

	assign csr_stride = if_out.STREAM.HSTRIDE.value;

	assign csr_front = if_out.FRONT.ADDR.value;
	assign if_in.FRONT.ADDR.we = csr_front_set;
	assign if_in.FRONT.ADDR.next = csr_front_next;

	assign csr_back = if_out.BACK.ADDR.value;
	assign csr_back_push = if_out.BACK.ADDR.swmod;
	assign if_in.BACK.ADDR.we = csr_back_set;
	assign if_in.BACK.ADDR.next = csr_back_next;

	assign if_in.RETIRE.ADDR.next = csr_retired;

	vdc_if regif
	(
		.clk,
		.arst_n(rst_n),
		.s_axil(regblock.slave),
		.hwif_in(if_in),
		.hwif_out(if_out)
	);

	if_axil2regblock axil2regblock
	(
		.axis(host),
		.axim(regblock.master)
	);

	vdc_io io
	(
		.clk,
		.rst_n,
		.dac,
		.lines,
		.stream,
		.stride,
		.line_len,
		.frame_done,
		.front_base,
		.frame_start
	);

	vdc_sync sync
	(
		.clk,
		.rst_n,

		.csr_back,
		.csr_front,
		.csr_lines,
		.csr_dac_on,
		.csr_stride,
		.csr_retired,
		.csr_back_set,
		.csr_line_len,
		.csr_back_next,
		.csr_back_push,
		.csr_front_set,
		.csr_dac_enable,
		.csr_front_next,
		.csr_double_buff,

		.lines,
		.stride,
		.line_len,
		.frame_done,
		.front_base,
		.frame_start
	);

endmodule