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