<commit_before>#!/usr/bin/env python3

from nexys_etherbone import *

from litevideo.input import HDMIIn
from litevideo.output import VideoOut

from litescope import LiteScopeAnalyzer

from gateware.freq_measurement import FrequencyMeasurement

base_cls = EtherboneSoC


class VideoOutSoC(base_cls):
    csr_map = {
        "hdmi_in": 22,
        "hdmi_in_freq": 23,
        "hdmi_in_edid_mem": 24,
        "analyzer": 25
    }
    csr_map.update(base_cls.csr_map)

    interrupt_map = {
        "hdmi_in": 3,
    }
    interrupt_map.update(base_cls.interrupt_map)

    def __init__(self, platform, *args, **kwargs):
        base_cls.__init__(self, platform, *args, **kwargs)

        # # #

        # hdmi in
        self.submodules.hdmi_in = HDMIIn(platform.request("hdmi_in", 0),
                                         self.sdram.crossbar.get_port(mode="write"),
                                         fifo_depth=512,
                                         device="xc7")
        self.submodules.hdmi_in_freq = FrequencyMeasurement(self.hdmi_in.clocking.cd_pix.clk,
                                                            self.clk_freq)


        analyzer_signals = [
            self.hdmi_in.data0_cap.alignment.delay_value,
            self.hdmi_in.data0_cap.alignment.delay_ce,
            self.hdmi_in.data0_cap.alignment.bitslip_value,
            self.hdmi_in.data0_cap.alignment.invalid,
            self.hdmi_in.data0_cap.d,

            self.hdmi_in.data1_cap.alignment.delay_value,
            self.hdmi_in.data1_cap.alignment.delay_ce,
            self.hdmi_in.data1_cap.alignment.bitslip_value,
            self.hdmi_in.data1_cap.alignment.invalid,
            self.hdmi_in.data1_cap.d,

            self.hdmi_in.data2_cap.alignment.delay_value,
            self.hdmi_in.data2_cap.alignment.delay_ce,
            self.hdmi_in.data2_cap.alignment.bitslip_value,
            self.hdmi_in.data2_cap.alignment.invalid,
            self.hdmi_in.data2_cap.d
        ]
        self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals, 2048, cd="pix")

    def do_exit(self, vns):
        self.analyzer.export_csv(vns, "test/analyzer.csv")


def main():
    parser = argparse.ArgumentParser(description="Nexys LiteX SoC")
    builder_args(parser)
    soc_sdram_args(parser)
    parser.add_argument("--nocompile-gateware", action="store_true")
    args = parser.parse_args()

    platform = nexys.Platform()
    soc = VideoOutSoC(platform, **soc_sdram_argdict(args))
    builder = Builder(soc, output_dir="build",
                      compile_gateware=not args.nocompile_gateware,
                      csr_csv="test/csr.csv")
    vns = builder.build()

if __name__ == "__main__":
    main()

<commit_msg>nexys_video: more debug, no sdram<commit_after>#!/usr/bin/env python3

from nexys_etherbone import *

from litevideo.input import HDMIIn
from litevideo.output import VideoOut

from litescope import LiteScopeAnalyzer

from gateware.freq_measurement import FrequencyMeasurement

base_cls = EtherboneSoC


class VideoOutSoC(base_cls):
    csr_map = {
        "hdmi_in": 22,
        "hdmi_in_freq": 23,
        "hdmi_in_edid_mem": 24,
        "analyzer": 25
    }
    csr_map.update(base_cls.csr_map)

    interrupt_map = {
        "hdmi_in": 3,
    }
    interrupt_map.update(base_cls.interrupt_map)

    def __init__(self, platform, *args, **kwargs):
        base_cls.__init__(self, platform, *args, **kwargs)

        # # #

        # hdmi in
        self.submodules.hdmi_in = HDMIIn(platform.request("hdmi_in", 0),
                                         None,
                                         fifo_depth=512,
                                         device="xc7",)
        self.submodules.hdmi_in_freq = FrequencyMeasurement(self.hdmi_in.clocking.cd_pix.clk,
                                                            self.clk_freq)


        analyzer_signals = [
            self.hdmi_in.data0_cap.alignment.delay_value,
            self.hdmi_in.data0_cap.alignment.delay_ce,
            self.hdmi_in.data0_cap.alignment.bitslip_value,
            self.hdmi_in.data0_cap.alignment.invalid,
            self.hdmi_in.data0_cap.d,

            self.hdmi_in.data1_cap.alignment.delay_value,
            self.hdmi_in.data1_cap.alignment.delay_ce,
            self.hdmi_in.data1_cap.alignment.bitslip_value,
            self.hdmi_in.data1_cap.alignment.invalid,
            self.hdmi_in.data1_cap.d,

            self.hdmi_in.data2_cap.alignment.delay_value,
            self.hdmi_in.data2_cap.alignment.delay_ce,
            self.hdmi_in.data2_cap.alignment.bitslip_value,
            self.hdmi_in.data2_cap.alignment.invalid,
            self.hdmi_in.data2_cap.d,

            self.hdmi_in.syncpol.valid_o,
            self.hdmi_in.syncpol.de,
            self.hdmi_in.syncpol.hsync,
            self.hdmi_in.syncpol.vsync,
            self.hdmi_in.syncpol.r,
            self.hdmi_in.syncpol.g,
            self.hdmi_in.syncpol.b,
        ]
        self.submodules.analyzer = LiteScopeAnalyzer(analyzer_signals, 2048, cd="pix")

    def do_exit(self, vns):
        self.analyzer.export_csv(vns, "test/analyzer.csv")


def main():
    parser = argparse.ArgumentParser(description="Nexys LiteX SoC")
    builder_args(parser)
    soc_sdram_args(parser)
    parser.add_argument("--nocompile-gateware", action="store_true")
    args = parser.parse_args()

    platform = nexys.Platform()
    soc = VideoOutSoC(platform, **soc_sdram_argdict(args))
    builder = Builder(soc, output_dir="build",
                      compile_gateware=not args.nocompile_gateware,
                      csr_csv="test/csr.csv")
    vns = builder.build()

if __name__ == "__main__":
    main()


{'fraction_non_alphanumeric': 0.1002805049088359, 'fraction_numerical': 0.011921458625525946, 'mean_word_length': 2.150193263390392, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6109108', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1881, 'n_words': 237}