Line 45... |
Line 45... |
#include "dumpverilog.h"
|
#include "dumpverilog.h"
|
|
|
extern char *or1ksim_ver;
|
extern char *or1ksim_ver;
|
extern char *disassembled;
|
extern char *disassembled;
|
|
|
void dumpverilog(char *verilog_modname, unsigned int from, unsigned int to)
|
void dumpverilog(char *verilog_modname, oraddr_t from, oraddr_t to)
|
{
|
{
|
unsigned int i, done = 0;
|
unsigned int i, done = 0;
|
struct label_entry *tmp;
|
struct label_entry *tmp;
|
char dis[DISWIDTH + 100];
|
char dis[DISWIDTH + 100];
|
|
uint32_t insn;
|
|
int index;
|
PRINTF("// This file was generated by or1ksim version %s\n", or1ksim_ver);
|
PRINTF("// This file was generated by or1ksim version %s\n", or1ksim_ver);
|
PRINTF(OR1K_MEM_VERILOG_HEADER(verilog_modname, from/DWQ, to/DWQ, (DISWIDTH*8)));
|
PRINTF(OR1K_MEM_VERILOG_HEADER(verilog_modname, from/DWQ, to/DWQ, (DISWIDTH*8)));
|
|
|
for(i = from; i < to; i++)
|
for(i = from; i < to; i++) {
|
{
|
if(!(i & 3)) {
|
unsigned int _insn = eval_direct32 (i, 0, 0);
|
insn = eval_direct32(i, 0, 0);
|
int index = insn_decode(_insn);
|
index = insn_decode(insn);
|
if (index >= 0)
|
if (index >= 0) {
|
{
|
|
if (verify_memoryarea(i) && (tmp = get_label(i)))
|
if (verify_memoryarea(i) && (tmp = get_label(i)))
|
if (tmp)
|
if (tmp)
|
PRINTF("\n//\t%s%s", tmp->name, LABELEND_CHAR);
|
PRINTF("\n//\t%s%s", tmp->name, LABELEND_CHAR);
|
|
|
PRINTF("\n\tmem['h%x] = %d'h%.8"PRIx32";", i/DWQ, DW,
|
PRINTF("\n\tmem['h%x] = %d'h%.8"PRIx32";", i/DWQ, DW,
|
eval_direct32(i, 0, 0));
|
eval_direct32(i, 0, 0));
|
|
|
disassemble_insn (_insn);
|
disassemble_insn (insn);
|
strcpy (dis, disassembled);
|
strcpy (dis, disassembled);
|
|
|
if (strlen(dis) < DISWIDTH)
|
if (strlen(dis) < DISWIDTH)
|
memset(dis + strlen(dis), ' ', DISWIDTH);
|
memset(dis + strlen(dis), ' ', DISWIDTH);
|
dis[DISWIDTH] = '\0';
|
dis[DISWIDTH] = '\0';
|
PRINTF("\n\tdis['h%x] = {\"%s\"};", i/DWQ, dis);
|
PRINTF("\n\tdis['h%x] = {\"%s\"};", i/DWQ, dis);
|
dis[0] = '\0';
|
dis[0] = '\0';
|
i += insn_len(index) - 1;
|
i += insn_len(index) - 1;
|
} else {
|
done = 1;
|
|
continue;
|
|
}
|
|
}
|
|
|
if (i % 64 == 0)
|
if (i % 64 == 0)
|
PRINTF("\n");
|
PRINTF("\n");
|
|
|
PRINTF("\n\tmem['h%x] = 'h%.2x;", i/DWQ,
|
PRINTF("\n\tmem['h%x] = 'h%.2x;", i/DWQ, eval_direct8(i, 0, 0));
|
eval_direct8(i, 0, 0));
|
|
}
|
|
done = 1;
|
done = 1;
|
}
|
}
|
|
|
if (done)
|
if (done)
|
{
|
{
|
Line 108... |
Line 111... |
(char)eval_direct32(i, 0, 0));
|
(char)eval_direct32(i, 0, 0));
|
}
|
}
|
PRINTF(OR1K_MEM_VERILOG_FOOTER);
|
PRINTF(OR1K_MEM_VERILOG_FOOTER);
|
}
|
}
|
|
|
void dumphex(unsigned int from, unsigned int to)
|
void dumphex(oraddr_t from, oraddr_t to)
|
{
|
{
|
unsigned int i;
|
oraddr_t i;
|
|
uint32_t insn;
|
|
int index;
|
|
|
for(i = from; i < to; i++) {
|
for(i = from; i < to; i++) {
|
unsigned int _insn = eval_direct32 (i, 0, 0);
|
if(!(i & 3)) {
|
int index = insn_decode(_insn);
|
insn = eval_direct32(i, 0, 0);
|
if (index >= 0)
|
index = insn_decode(insn);
|
{
|
if(index >= 0) {
|
PRINTF("%.8"PRIx32"\n", eval_direct32(i, 0, 0));
|
PRINTF("%.8"PRIx32"\n", eval_direct32(i, 0, 0));
|
|
|
i += insn_len(index) - 1;
|
i += insn_len(index) - 1;
|
|
continue;
|
|
}
|
}
|
}
|
else
|
|
PRINTF("%.2x\n", eval_direct8(i, 0, 0));
|
PRINTF("%.2x\n", eval_direct8(i, 0, 0));
|
}
|
}
|
}
|
}
|
|
|
No newline at end of file
|
No newline at end of file
|