The HEX file initialization in Quartus is not well behaved. When you make 8-bit ROMs it works fine. When you make a 16-bit wide ROM it doesn't load corrected. That seems to be because the HEX loader in Quartus sees the file addresses as the offset to the 16-bit value rather than the byte address. For this code it then loads the address for every 16-byte line but bumps down by 1 line and tries to load the next line.
The workaround is use the srecords utility to shift the address and save the result as an Altera MIF file. The steps are:
Shift ROM addresses for Quartus FPGA Tool
- Assembler output (monitor.hex)
:2080000000000800000080084DF80C0042AE004A422E0048422E00496136610005D861009E :20802000044E49FA09D06164207C0000C00020100C80524F4D3266044EA800084E714E71EF
- Addresses start at 0x8000 (AAAA below):
:2080000000000800000080084DF80C0042AE004A422E0048422E00496136610005D861009E __AAAA_____________________________________________________________________
Shift the records down
- First convert to S-Records using srec_cat - My copy of s-record tools
[PATH_TO_SRECORD_UTILITIES]\srec_cat monitor.hex -Intel -o monitor.srec -Motorola
- S-Record output (monitor.srec)
S123800000000800000080084DF80C0042AE004A422E0048422E00496136610005D861009A S1238020044E49FA09D06164207C0000C00020100C80524F4D3266044EA800084E714E71EB
- Then shift and save as an Altera MIF file
[PATH_TO_SRECORD_UTILITIES]\srec_cat monitor.srec -offset - -minimum-addr monitor.srec -o monitor.mif -Memory_Initialization_File 16
- Result is (monitor.mif)
-- FFFF8000: http://srecord.sourceforge.net/ -- -- Generated automatically by srec_cat -o --mif -- DEPTH = 8192; WIDTH = 16; ADDRESS_RADIX = HEX; DATA_RADIX = HEX; CONTENT BEGIN 0000: 0000 0800 0000 8008 4DF8 0C00 42AE 004A 422E 0048 422E 0049 6136 6100; 000E: 05D8 6100 044E 49FA 09D0 6164 207C 0000 C000 2010 0C80 524F 4D32 6604; 001C: 4EA8 0008 4E71 4E71 4287 6128 614C 6100 0080 6100 00BE 60F0 41F9 0001; ...
- Load into Quartus in the Monitor_68K_ROM using Megawizard
- Verified using In System Memory Contents tool in Quartus
Teesside TS2 Monitor (TSBUG2) Commands
For TSBUG 2 Version 23.07.86
<address> is a hexadecimal number, e.g. FF0A Arguments in square brackets are optional.
- JUMP <address>
- Begin execution at <address>.
- MEMORY <address>
- Examines contents of <address> and allows it to be changed. Typing "-" goes to previous address, space allows entering word-size data to write to current address, <Return> exits, and any other key goes to next address.
- LOAD [<string>]
- Loads S1/S2 records from the host. <string> is sent to host.
- DUMP <start address> <end address> [<string]
- Sends S1 records to the host, preceeded by a string.
- TRAN
- Enters the transparent mode. Exited by ESC E.
- NOBR <address>
- Removes the breakpoint at <address> from the breakpoint table. If no address is given all breakpoints are removed.
- DISP
- Displays the contents of the pseudo registers.
- GO <address>
- Starts program execution at <address> and loads regs from pseudo registers.
- BRGT <address>
- Puts a breakpoint in the breakpoint table, but not in the code.
- PLAN
- Puts the breakpoints in the code.
- KILL
- Removes breakpoints from the code.
- GB [<address>]
- Sets breakpoints and then calls GO. IF <address> is omitted, uses PC value in pseudo registers.
- REG <reg> <value>
- Loads <value> into <reg> in pseudo registers. Used to preset registers before a GO or GB.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.