def METHOD_NAME():
    if len(sys.argv) != 3:
        print("Usage: ", sys.argv[0], " <ASCII input> <protobuf output>")
        exit(-1)
    try:
        ascii_in = open(sys.argv[1], "r")
    except IOError:
        print("Failed to open ", sys.argv[1], " for reading")
        exit(-1)
    try:
        proto_out = open(sys.argv[2], "wb")
    except IOError:
        print("Failed to open ", sys.argv[2], " for writing")
        exit(-1)
    # Write the magic number in 4-byte Little Endian, similar to what
    # is done in src/proto/protoio.cc
    proto_out.write("gem5")
    # Add the packet header
    header = packet_pb2.PacketHeader()
    header.obj_id = "Converted ASCII trace " + sys.argv[1]
    # Assume the default tick rate
    header.tick_freq = 1000000000000
    protolib.encodeMessage(proto_out, header)
    # For each line in the ASCII trace, create a packet message and
    # write it to the encoded output
    for line in ascii_in:
        cmd, addr, size, tick = line.split(",")
        packet = packet_pb2.Packet()
        packet.tick = int(tick)
        # ReadReq is 1 and WriteReq is 4 in src/mem/packet.hh Command enum
        packet.cmd = 1 if cmd == "r" else 4
        packet.addr = int(addr)
        packet.size = int(size)
        protolib.encodeMessage(proto_out, packet)
    # We're done
    ascii_in.close()
    proto_out.close()