static void print_c_semantic (lf *file, insn_entry * instruction, opcode_bits *expanded_bits, insn_opcodes *opcodes, cache_entry *cache_rules, int nr_prefetched_words) { lf_printf (file, "{\n"); lf_indent (file, +2); print_my_defines (file, instruction->name, instruction->format_name, expanded_bits); lf_printf (file, "\n"); print_icache_body (file, instruction, expanded_bits, cache_rules, (options.gen.direct_access ? define_variables : declare_variables), (options.gen.icache ? get_values_from_icache : do_not_use_icache), nr_prefetched_words); lf_printf (file, "%sinstruction_address nia;\n", options.module.global.prefix.l); print_semantic_body (file, instruction, expanded_bits, opcodes); lf_printf (file, "return nia;\n"); /* generate something to clean up any #defines created for the cache */ if (options.gen.direct_access) { print_icache_body (file, instruction, expanded_bits, cache_rules, undef_variables, (options.gen.icache ? get_values_from_icache : do_not_use_icache), nr_prefetched_words); } lf_indent (file, -2); lf_printf (file, "}\n"); }
static void print_c_semantic(lf *file, insn *instruction, insn_bits *expanded_bits, opcode_field *opcodes, cache_table *cache_rules) { lf_printf(file, "{\n"); lf_indent(file, +2); print_my_defines(file, expanded_bits, instruction->file_entry); lf_printf(file, "\n"); print_icache_body(file, instruction, expanded_bits, cache_rules, ((code & generate_with_direct_access) ? define_variables : declare_variables), ((code & generate_with_icache) ? get_values_from_icache : do_not_use_icache)); lf_printf(file, "unsigned_word nia;\n"); print_semantic_body(file, instruction, expanded_bits, opcodes); lf_printf(file, "return nia;\n"); /* generate something to clean up any #defines created for the cache */ if (code & generate_with_direct_access) print_icache_body(file, instruction, expanded_bits, cache_rules, undef_variables, ((code & generate_with_icache) ? get_values_from_icache : do_not_use_icache)); lf_indent(file, -2); lf_printf(file, "}\n"); }
static void print_icache_function(lf *file, insn *instruction, insn_bits *expanded_bits, opcode_field *opcodes, cache_table *cache_rules) { int indent; /* generate code to enter decoded instruction into the icache */ lf_printf(file, "\n"); lf_print_function_type(file, ICACHE_FUNCTION_TYPE, "EXTERN_ICACHE", "\n"); indent = print_function_name(file, instruction->file_entry->fields[insn_name], expanded_bits, function_name_prefix_icache); lf_indent(file, +indent); lf_printf(file, "(%s)\n", ICACHE_FUNCTION_FORMAL); lf_indent(file, -indent); /* function header */ lf_printf(file, "{\n"); lf_indent(file, +2); print_my_defines(file, expanded_bits, instruction->file_entry); print_itrace(file, instruction->file_entry, 1/*putting-value-in-cache*/); print_idecode_validate(file, instruction, opcodes); lf_printf(file, "\n"); lf_printf(file, "{\n"); lf_indent(file, +2); if ((code & generate_with_semantic_icache)) lf_printf(file, "unsigned_word nia;\n"); print_icache_body(file, instruction, expanded_bits, cache_rules, ((code & generate_with_direct_access) ? define_variables : declare_variables), ((code & generate_with_semantic_icache) ? both_values_and_icache : put_values_in_icache)); lf_printf(file, "\n"); lf_printf(file, "cache_entry->address = cia;\n"); lf_printf(file, "cache_entry->semantic = "); print_function_name(file, instruction->file_entry->fields[insn_name], expanded_bits, function_name_prefix_semantics); lf_printf(file, ";\n"); lf_printf(file, "\n"); if ((code & generate_with_semantic_icache)) { lf_printf(file, "/* semantic routine */\n"); print_semantic_body(file, instruction, expanded_bits, opcodes); lf_printf(file, "return nia;\n"); } if (!(code & generate_with_semantic_icache)) { lf_printf(file, "/* return the function proper */\n"); lf_printf(file, "return "); print_function_name(file, instruction->file_entry->fields[insn_name], expanded_bits, function_name_prefix_semantics); lf_printf(file, ";\n"); } if ((code & generate_with_direct_access)) print_icache_body(file, instruction, expanded_bits, cache_rules, undef_variables, ((code & generate_with_semantic_icache) ? both_values_and_icache : put_values_in_icache)); lf_indent(file, -2); lf_printf(file, "}\n"); lf_indent(file, -2); lf_printf(file, "}\n"); }
static void print_icache_function (lf *file, insn_entry * instruction, opcode_bits *expanded_bits, insn_opcodes *opcodes, cache_entry *cache_rules, int nr_prefetched_words) { int indent; /* generate code to enter decoded instruction into the icache */ lf_printf (file, "\n"); lf_print__function_type_function (file, print_icache_function_type, "EXTERN_ICACHE", "\n"); indent = print_function_name (file, instruction->name, instruction->format_name, NULL, expanded_bits, function_name_prefix_icache); indent += lf_printf (file, " "); lf_indent (file, +indent); lf_printf (file, "("); print_icache_function_formal (file, nr_prefetched_words); lf_printf (file, ")\n"); lf_indent (file, -indent); /* function header */ lf_printf (file, "{\n"); lf_indent (file, +2); print_my_defines (file, instruction->name, instruction->format_name, expanded_bits); print_itrace (file, instruction, 1 /*putting-value-in-cache */ ); print_idecode_validate (file, instruction, opcodes); lf_printf (file, "\n"); lf_printf (file, "{\n"); lf_indent (file, +2); if (options.gen.semantic_icache) lf_printf (file, "unsigned_word nia;\n"); print_icache_body (file, instruction, expanded_bits, cache_rules, (options.gen.direct_access ? define_variables : declare_variables), (options.gen.semantic_icache ? both_values_and_icache : put_values_in_icache), nr_prefetched_words); lf_printf (file, "\n"); lf_printf (file, "cache_entry->address = cia;\n"); lf_printf (file, "cache_entry->semantic = "); print_function_name (file, instruction->name, instruction->format_name, NULL, expanded_bits, function_name_prefix_semantics); lf_printf (file, ";\n"); lf_printf (file, "\n"); if (options.gen.semantic_icache) { lf_printf (file, "/* semantic routine */\n"); print_semantic_body (file, instruction, expanded_bits, opcodes); lf_printf (file, "return nia;\n"); } if (!options.gen.semantic_icache) { lf_printf (file, "/* return the function proper */\n"); lf_printf (file, "return "); print_function_name (file, instruction->name, instruction->format_name, NULL, expanded_bits, function_name_prefix_semantics); lf_printf (file, ";\n"); } if (options.gen.direct_access) { print_icache_body (file, instruction, expanded_bits, cache_rules, undef_variables, (options.gen.semantic_icache ? both_values_and_icache : put_values_in_icache), nr_prefetched_words); } lf_indent (file, -2); lf_printf (file, "}\n"); lf_indent (file, -2); lf_printf (file, "}\n"); }