more functional unit changes

This commit is contained in:
Michael Meissner 1995-11-16 19:02:52 +00:00
parent aa8a6656ee
commit 845ff5a45f
5 changed files with 945 additions and 152 deletions

View File

@ -1,3 +1,23 @@
Thu Nov 16 09:52:26 1995 Michael Meissner <meissner@tiktok.cygnus.com>
* table.c (table_entry_read): Allow the annex to have blank lines.
* ppc-instructions: Change lines in model stuff that just have a
tab to just newline. Add 601 support. Document most instructions
in terms of model specific timing information. Drop 'FUNCTION'
from PPC_FUNCTION_UNIT_xxx enums. Change PPC_UNIT_UNKNOWN ->
PPC_UNIT_BAD. Add TRACE(trace_tbd) for all data cache
instruction.s. Signal illegal instruciton if data cache block
invalidate is issued from problem state.
* igen.c (max_model_fields_len): New static to keep track of the
max size for the model specific fields.
(model_c_insn): Use max_model_fields_len to size fields.
(insn_table_insert_insn): Set max_model_fields_len.
(model_table_insert): Ditto.
* debug.c (trace_description): Add support for trace_tbd.
Wed Nov 15 17:32:13 1995 Michael Meissner <meissner@tiktok.cygnus.com>
* cpu.h (cpu_model): Add declaration.

View File

@ -63,6 +63,8 @@ static trace_option_descriptor trace_description[] = {
{ trace_core_device, "core-device" },
{ trace_stack_device, "stack-device" },
/* misc */
{ trace_opts, "options", "Print options simulator was compiled with" },
{ trace_tbd, "tbd", "Trace any missing features" },
/* sentinal */
{ nr_trace_options, NULL },
};

View File

@ -637,6 +637,8 @@ static insn *last_model_internal;
static insn *model_data;
static insn *last_model_data;
static int max_model_fields_len;
static void
insn_table_insert_function(insn_table *table,
table_entry *file_entry)
@ -672,6 +674,15 @@ insn_table_insert_insn(insn_table *table,
is correct. */
for(insn_model_ptr = file_entry->model_first; insn_model_ptr; insn_model_ptr = insn_model_ptr->next) {
char *name = insn_model_ptr->fields[insn_model_name];
int len = strlen (insn_model_ptr->fields[insn_model_fields]);
while (len > 0 && isspace(*insn_model_ptr->fields[insn_model_fields])) {
len--;
insn_model_ptr->fields[insn_model_fields]++;
}
if (max_model_fields_len < len)
max_model_fields_len = len;
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
if (strcmp(name, model_ptr->printable_name) == 0) {
@ -956,6 +967,8 @@ static void
model_table_insert(insn_table *table,
table_entry *file_entry)
{
int len;
/* create a new model */
model *new_model = ZALLOC(model);
@ -963,6 +976,13 @@ model_table_insert(insn_table *table,
new_model->printable_name = file_entry->fields[model_name];
new_model->insn_default = file_entry->fields[model_default];
while (*new_model->insn_default && isspace(*new_model->insn_default))
new_model->insn_default++;
len = strlen(new_model->insn_default);
if (max_model_fields_len < len)
max_model_fields_len = len;
/* append it to the end of the model list */
if (last_model)
last_model->next = new_model;
@ -3079,7 +3099,8 @@ model_c_insn(insn_table *entry,
while (model_ptr) {
if (model_ptr->fields[insn_model_name] == current_name) {
lf_printf(file, " { %-48s },\t/* %s */\n",
lf_printf(file, " { %-*s }, /* %s */\n",
max_model_fields_len,
model_ptr->fields[insn_model_fields],
instruction->file_entry->fields[insn_name]);
return;
@ -3088,7 +3109,8 @@ model_c_insn(insn_table *entry,
model_ptr = model_ptr->next;
}
lf_printf(file, " { %-48s },\t/* %s */\n",
lf_printf(file, " { %-*s }, /* %s */\n",
max_model_fields_len,
data_ptr->model_ptr->insn_default,
instruction->file_entry->fields[insn_name]);
}
@ -3157,30 +3179,6 @@ gen_model_c(insn_table *table, lf *file)
model_c_or_h_function(table, file, insn_ptr->file_entry, "STATIC_INLINE_MODEL");
}
lf_printf(file, "/* Insn functional unit info */\n");
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
model_c_passed_data data;
lf_printf(file, "static const model_time model_time_%s[] = {\n", model_ptr->name);
data.file = file;
data.model_ptr = model_ptr;
insn_table_traverse_insn(table,
(void *)&data,
model_c_insn);
lf_printf(file, "};\n");
lf_printf(file, "\n");
lf_printf(file, "\f\n");
}
lf_printf(file, "STATIC_MODEL const model_time *const model_time_mapping[ (int)nr_models ] = {\n");
lf_printf(file, " (const model_time *const)0,\n");
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
lf_printf(file, " model_time_%s,\n", model_ptr->name);
}
lf_printf(file, "};\n");
lf_printf(file, "\n");
for(insn_ptr = model_internal; insn_ptr; insn_ptr = insn_ptr->next) {
model_c_function(table, file, insn_ptr->file_entry, "STATIC_INLINE_MODEL");
}
@ -3251,6 +3249,30 @@ gen_model_c(insn_table *table, lf *file)
lf_printf(file, "\n");
}
lf_printf(file, "/* Insn functional unit info */\n");
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
model_c_passed_data data;
lf_printf(file, "static const model_time model_time_%s[] = {\n", model_ptr->name);
data.file = file;
data.model_ptr = model_ptr;
insn_table_traverse_insn(table,
(void *)&data,
model_c_insn);
lf_printf(file, "};\n");
lf_printf(file, "\n");
lf_printf(file, "\f\n");
}
lf_printf(file, "STATIC_MODEL const model_time *const model_time_mapping[ (int)nr_models ] = {\n");
lf_printf(file, " (const model_time *const)0,\n");
for(model_ptr = models; model_ptr; model_ptr = model_ptr->next) {
lf_printf(file, " model_time_%s,\n", model_ptr->name);
}
lf_printf(file, "};\n");
lf_printf(file, "\n");
lf_printf(file, "\f\n");
lf_printf(file, "/* map model enumeration into printable string */\n");
lf_printf(file, "STATIC_MODEL const char *model_name[ (int)nr_models ] = {\n");

File diff suppressed because it is too large Load Diff

View File

@ -44,12 +44,14 @@ struct _table {
char *pos;
int line_nr;
int nr_fields;
int nr_model_fields;
char *file_name;
};
extern table *
table_open(char *file_name,
int nr_fields)
int nr_fields,
int nr_model_fields)
{
int fd;
struct stat stat_buf;
@ -59,6 +61,7 @@ table_open(char *file_name,
file = ZALLOC(table);
ASSERT(file != NULL);
file->nr_fields = nr_fields;
file->nr_model_fields = nr_model_fields;
/* save the file name */
file->file_name = (char*)zalloc(strlen(file_name) + 1);
@ -158,7 +161,45 @@ table_entry_read(table *file)
file->line_nr++;
entry->line_nr = file->line_nr;
/* if following lines tab indented, put in the annex */
/* if following lines begin with a star, add them to the model
section. */
while ((file->nr_model_fields > 0) && (*file->pos == '*')) {
table_model_entry *model = (table_model_entry*)zalloc(sizeof(table_model_entry)
+ (file->nr_model_fields + 1) * sizeof(char*));
if (entry->model_last)
entry->model_last->next = model;
else
entry->model_first = model;
entry->model_last = model;
/* break the line into its colon delimitered fields */
file->pos++;
for (field = 0; field < file->nr_model_fields-1; field++) {
model->fields[field] = file->pos;
while(*file->pos && *file->pos != ':' && *file->pos != '\n')
file->pos++;
if (*file->pos == ':') {
*file->pos = '\0';
file->pos++;
}
}
/* any trailing stuff not the last field */
ASSERT(field == file->nr_model_fields-1);
model->fields[field] = file->pos;
while (*file->pos && *file->pos != '\n') {
file->pos++;
}
if (*file->pos == '\n') {
*file->pos = '\0';
file->pos++;
}
file->line_nr++;
model->line_nr = file->line_nr;
}
/* if following lines are tab indented, put in the annex */
if (*file->pos == '\t') {
entry->annex = file->pos;
do {
@ -166,8 +207,18 @@ table_entry_read(table *file)
file->pos++;
} while (*file->pos != '\0' && *file->pos != '\n');
if (*file->pos == '\n') {
file->pos++;
char *save_pos = ++file->pos;
int extra_lines = 0;
file->line_nr++;
/* Allow tab indented to have blank lines */
while (*save_pos == '\n') {
save_pos++;
extra_lines++;
}
if (*save_pos == '\t') {
file->pos = save_pos;
file->line_nr += extra_lines;
}
}
} while (*file->pos != '\0' && *file->pos == '\t');
if (file->pos[-1] == '\n')