Exemplo n.º 1
0
        private static int EntryPoint()
        {
            CircularNetworkFunctions.RecvOne(cfb, true, false);

            while (true)
            {
                generate_packet();
            }
        }
Exemplo n.º 2
0
        private static void generate_packet()
        {
            SetPacketData();

            HeaderGen.WriteUDPHeader(cfb, up, ep, ip, InterfaceFunctions.PORT_BROADCAST);

            if (!Kiwi.inHardware())
            {
                cfb.PrintContents();
            }

            CircularNetworkFunctions.SendWithFCS(cfb, crc);

            Kiwi.Pause();
        }
Exemplo n.º 3
0
        private static void run()
        {
            //Test Packet Generation
            SetPacketData();

            //Generate packet (uses ethernet, ip and udp generator)
            HeaderGen.WriteUDPHeader(cfb, up, ep, ip, InterfaceFunctions.PORT_BROADCAST);

            //Write Contents of Buffer
            cfb.PrintContents();

            cfb.ResetPeek();

            // Verify Parsed Values
            ep.Parse(cfb);
            System.Console.WriteLine($"src_mac: {ep.SrcMac:X12} dest_mac: {ep.DestMac:X12} ethertype: {ep.Ethertype:X4}");
            ip.Parse(cfb);
            System.Console.WriteLine($"version: {ip.Version} IHL: {ip.IHL} DSCP: {ip.DSCP} ECN: {ip.ECN}");
            System.Console.WriteLine($"total_length: {ip.TotalLength} id: {ip.Identification} flags: {ip.Flags}");
            System.Console.WriteLine($"frag_offset: {ip.FragmentOffset} TTL: {ip.TTL} protocol: {ip.Protocol}");
            System.Console.WriteLine($"src_ip: {ip.SrcIp:X8} dest_ip: {ip.DestIp:X8}");
            up.Parse(cfb, ip.IHL);
            System.Console.WriteLine($"src_port: {up.SrcPort:x4} dest_port: {up.DestPort:x4} length: {up.Length:x4}");

            // Verify Interrupts
            DebugFunctions.interrupts_enable();
            DebugFunctions.push_interrupt(DebugFunctions.Errors.PACKET_DROP);
            DebugFunctions.push_interrupt(DebugFunctions.Errors.PARSE_FAIL);
            System.Console.WriteLine($"errors: {Emu.Interrupts:X16}");
            DebugFunctions.reset_interrupt();
            System.Console.WriteLine($"errors: {Emu.Interrupts:X16}");


            // Verify Sending Packets
            CircularNetworkFunctions.SendOne(cfb, false, true);
            System.Console.WriteLine($"data0: {Emu.m_axis_tdata_0:X16}");
            System.Console.WriteLine($"data1: {Emu.m_axis_tdata_1:X16}");
            System.Console.WriteLine($"data2: {Emu.m_axis_tdata_2:X16}");
            System.Console.WriteLine($"data3: {Emu.m_axis_tdata_3:X16}");

            CircularNetworkFunctions.SendOne(cfb, false, true);
            System.Console.WriteLine($"data0: {Emu.m_axis_tdata_0:X16}");
            System.Console.WriteLine($"data1: {Emu.m_axis_tdata_1:X16}");
            System.Console.WriteLine($"data2: {Emu.m_axis_tdata_2:X16}");
            System.Console.WriteLine($"data3: {Emu.m_axis_tdata_3:X16}");
        }