-
Notifications
You must be signed in to change notification settings - Fork 9
/
netv2_video.py
executable file
·58 lines (43 loc) · 1.9 KB
/
netv2_video.py
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
#!/usr/bin/env python3
from netv2_base import *
from litex.soc.interconnect import stream
from litevideo.output import VideoOut
from litedram.common import LiteDRAMPort
base_cls = BaseSoC
class VideoOutSoC(base_cls):
csr_map = {
"hdmi_out": 26
}
csr_map.update(base_cls.csr_map)
def __init__(self, platform, *args, **kwargs):
base_cls.__init__(self, platform, *args, **kwargs)
# # #
mode = "ycbcr422"
if mode == "ycbcr422":
hdmi_out_dram_port = self.sdram.crossbar.get_port(mode="read", dw=16, cd="pix", reverse=True)
self.submodules.hdmi_out = VideoOut(platform.device,
platform.request("hdmi_out"),
hdmi_out_dram_port,
"ycbcr422")
elif mode == "rgb":
hdmi_out_dram_port = self.sdram.crossbar.get_port(mode="read", dw=32, cd="pix", reverse=True)
self.submodules.hdmi_out = VideoOut(platform.device,
platform.request("hdmi_out"),
hdmi_out_dram_port,
"rgb")
self.platform.add_period_constraint(self.crg.cd_sys.clk, 10.0)
self.platform.add_period_constraint(self.hdmi_out.driver.clocking.cd_pix.clk, 10.0)
self.platform.add_false_path_constraints(
self.crg.cd_sys.clk,
self.hdmi_out.driver.clocking.cd_pix.clk)
def main():
parser = argparse.ArgumentParser(description="NeTV2 LiteX SoC")
builder_args(parser)
soc_sdram_args(parser)
args = parser.parse_args()
platform = netv2.Platform()
soc = VideoOutSoC(platform, **soc_sdram_argdict(args))
builder = Builder(soc, output_dir="build")
vns = builder.build()
if __name__ == "__main__":
main()