예제 #1
0
// *****************************************************************************
void frontend_chip_cbc_tb::generate_stubs()
{
    frontend_chip::input_stub_t stim_stub;

    // at 60 ns
    wait(60, SC_NS);
    write_stub(0xFF, 0x1);

    // at 92 ns
    wait(32, SC_NS);
    write_stub(0x80, 0x2);
    write_stub(0x85, 0x3);

    // at 93 ns
    wait(1, SC_NS);
    write_stub(0x81, 0x4);

    // at 94 ns
    wait(1, SC_NS);
    write_stub(0x82, 0x5);

    // at 119 ns
    wait(25, SC_NS);
    write_stub(0x1, 0x6);

    // at 144 ns
    wait(25, SC_NS);
    write_stub(0x12, 0x7);
    write_stub(0x13, 0x8);

    // at 160 ns
    wait(16, SC_NS);
    write_stub(0xD, 0x9);

    // at 161 ns
    wait(1, SC_NS);
    write_stub(0x1, 0x1);

    // at 200 ns
    wait(64, SC_NS);
    write_stub(0x14, 0x9);

    // at 201 ns
    wait(1, SC_NS);
    write_stub(0x1, 0x1);

    return;
}
예제 #2
0
int main(int argc, char** argv)
{
    pid_t target_pid;
    struct list proc_image;
    int c;
    int flags = 0;
    int get_children = 0;
    int fd;
    long offset = 0;

    /* Parse options */
    while (1) {
	int option_index = 0;
	static struct option long_options[] = {
	    {"libraries", 0, 0, 'l'},
	    {"kill", 0, 0, 'k'},
	    {"pid", 0, 0, 'P'},
	    /*
	    {"files", 0, 0, 'f'},
	    {"children", 0, 0, 'c'},
	    {"writer", 1, 0, 'w'},
	    */
	    {0, 0, 0, 0},
	};

	c = getopt_long(argc, argv, "lkP"/*"fcw:"*/, long_options, &option_index);
	if (c == -1)
	    break;
	switch(c) {
	    case 'l':
		flags |= GET_LIBRARIES_TOO;
		break;
	    case 'f':
		flags |= GET_OPEN_FILE_CONTENTS;
		break;
	    case 'k':
		flags |= KILL_ORIGINAL_PROCESS;
		break;
	    case 'P':
		flags |= REFRESH_PID;
		break;
	    case 'c':
		get_children = 1;
		break;
	    /*
	    case 'w':
		set_writer(optarg);
		break;
		*/
	    case '?':
		/* invalid option */
		usage(argv[0]);
		break;
	}
    }

    if (argc - optind != 2) {
	usage(argv[0]);
	return 1;
    }

    assert(stream_ops != NULL);

    target_pid = atoi(argv[optind+1]);
    if (target_pid <= 1) {
	fprintf(stderr, "Invalid pid: %d\n", target_pid);
	return 1;
    }

    list_init(proc_image);
    get_process(target_pid, flags, &proc_image, &offset);

    fd = open(argv[optind], O_CREAT|O_WRONLY|O_TRUNC, 0777);
    if (fd == -1) {
	fprintf(stderr, "Couldn't open %s for writing: %s\n", argv[optind],
	    strerror(errno));
	return 1;
    }

    write_stub(fd, offset);

    write_process(fd, proc_image);

    close(fd);

    return 0;
}