3 // Program to turn a binary file into a VHDL lookup table.
7 // This software is free to use by anyone for any purpose.
16 main(int argc
, char **argv
)
23 // Check the user has given us an input file.
26 printf("Usage: %s <binary_file>\n\n", argv
[0]);
30 // Open the input file.
31 fd
= open(argv
[1], 0);
41 s
= read(fd
, opcode
, 4);
49 break; // End of file.
52 printf("%6d => x\"%02x%02x%02x%02x\",\n",
53 addr
++, opcode
[0], opcode
[1],
54 opcode
[2], opcode
[3]);