OpenCores
URL https://opencores.org/ocsvn/cpu8080/cpu8080/trunk

Subversion Repositories cpu8080

[/] [cpu8080/] [trunk/] [project/] [genrom.pas] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 samiam9512
{*******************************************************************************
2
*                                                                              *
3
*                            GENERATE VERILOG ROM IMAGE                        *
4
*                                                                              *
5
* Generates a rom image from a binary file.  This program is written in        *
6
* ISO 7185 Compliant Pascal.                                                   *
7
*                                                                              *
8
* Usage: run the program as follows:                                           *
9
*                                                                              *
10
* genrom test.obj > test.lst                                                   *
11
*                                                                              *
12
* Then paste the test.lst file into the rom cell data in testbench.v.          *
13
*                                                                              *
14
*******************************************************************************}
15
 
16
program genrom(binfil, output);
17
 
18
type byte = 0..255;
19
 
20
var binfil: file of byte;
21
    b:      byte;
22
        addr:   integer;
23
 
24
begin
25
 
26
   reset(binfil); { open file }
27
   addr := 0; { clear address }
28
   while not eof(binfil) do begin { dump bytes in file }
29
 
30
      { write preamble }
31
      write('      ', addr:6, ': datao = 8''h');
32
      read(binfil, b); { read next byte }
33
          { output high digit }
34
          if b div 16 > 9 then write(chr(b div 16-10+ord('A')))
35
          else write(chr(b div 16+ord('0')));
36
          { output low digit }
37
          if b mod 16 > 9 then write(chr(b mod 16-10+ord('A')))
38
          else write(chr(b mod 16+ord('0')));
39
          { write postamble }
40
          writeln(';');
41
          addr := addr+1
42
 
43
   end
44
 
45
end.

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.