badger/tests/crc_selfcheck.c
/* Crude analog of Verilog's $readmemh */
Crude analog of Verilog's $readmemh
Crude analog of Verilog ' s $readmemh
static unsigned int readmemh(FILE *f, char *buff, size_t avail)
{
	size_t u;
	int rc;
	for (u=0; u<avail; u++) {
		unsigned int h;
		rc=fscanf(f, "%x", &h);
		if (rc!=1) break;
		buff[u]=h;
	}
	return u;
}
static unsigned int readmemh ( FILE * f , char * buff , size_t avail ) { size_t u ; int rc ; for ( u = 0 ; u < avail ; u ++ ) { unsigned int h ; rc = fscanf ( f , " " , & h ) ; if ( rc != 1 ) break ; buff [ u ] = h ; } return u ; }
Crude analog of Verilog's $readmemh
Crude analog of Verilog ' s $readmemh