Line 43... |
Line 43... |
`include "a25_config_defines.v"
|
`include "a25_config_defines.v"
|
|
|
module a25_decompile
|
module a25_decompile
|
(
|
(
|
input i_clk,
|
input i_clk,
|
input i_access_stall,
|
input i_core_stall,
|
input [31:0] i_instruction,
|
input [31:0] i_instruction,
|
input i_instruction_valid,
|
input i_instruction_valid,
|
input i_instruction_undefined,
|
input i_instruction_undefined,
|
input i_instruction_execute,
|
input i_instruction_execute,
|
input [2:0] i_interrupt, // non-zero value means interrupt triggered
|
input [2:0] i_interrupt, // non-zero value means interrupt triggered
|
Line 95... |
Line 95... |
|
|
// ========================================================
|
// ========================================================
|
// Delay instruction to Execute stage
|
// Delay instruction to Execute stage
|
// ========================================================
|
// ========================================================
|
always @( posedge i_clk )
|
always @( posedge i_clk )
|
if ( !i_access_stall && i_instruction_valid )
|
if ( !i_core_stall && i_instruction_valid )
|
begin
|
begin
|
execute_instruction <= i_instruction;
|
execute_instruction <= i_instruction;
|
execute_address <= i_instruction_address;
|
execute_address <= i_instruction_address;
|
execute_undefined <= i_instruction_undefined;
|
execute_undefined <= i_instruction_undefined;
|
execute_now <= 1'd1;
|
execute_now <= 1'd1;
|
Line 107... |
Line 107... |
else
|
else
|
execute_now <= 1'd0;
|
execute_now <= 1'd0;
|
|
|
|
|
always @ ( posedge i_clk )
|
always @ ( posedge i_clk )
|
if ( !i_access_stall )
|
if ( !i_core_stall )
|
execute_valid <= i_instruction_valid;
|
execute_valid <= i_instruction_valid;
|
|
|
// ========================================================
|
// ========================================================
|
// Open File
|
// Open File
|
// ========================================================
|
// ========================================================
|
Line 253... |
Line 253... |
xINSTRUCTION_EXECUTE_R <= xINSTRUCTION_EXECUTE;
|
xINSTRUCTION_EXECUTE_R <= xINSTRUCTION_EXECUTE;
|
|
|
always @( posedge i_clk )
|
always @( posedge i_clk )
|
clk_count <= clk_count + 1'd1;
|
clk_count <= clk_count + 1'd1;
|
|
|
|
// =================================================================================
|
|
// Memory Reads and Writes
|
|
// =================================================================================
|
|
|
|
reg [31:0] tmp_address;
|
|
|
|
|
always @( posedge i_clk )
|
always @( posedge i_clk )
|
|
begin
|
|
// Data Write
|
|
if ( get_1bit_signal(0) && !get_1bit_signal(3) )
|
|
begin
|
|
|
|
$fwrite(decompile_file, "%09d write addr ", clk_count);
|
|
tmp_address = get_32bit_signal(2);
|
|
fwrite_hex_drop_zeros(decompile_file, {tmp_address [31:2], 2'd0} );
|
|
|
|
$fwrite(decompile_file, ", data %08h, be %h",
|
|
get_32bit_signal(3), // u_cache.i_write_data
|
|
get_4bit_signal (0)); // u_cache.i_byte_enable
|
|
|
|
$fwrite(decompile_file, "\n");
|
|
end
|
|
|
|
// Data Read
|
|
if ( get_1bit_signal(4) && !get_1bit_signal(1) )
|
|
begin
|
|
$fwrite(decompile_file, "%09d read addr ", clk_count);
|
|
tmp_address = get_32bit_signal(5);
|
|
fwrite_hex_drop_zeros(decompile_file, {tmp_address[31:2], 2'd0} );
|
|
|
|
$fwrite(decompile_file, ", data %08h to ", get_32bit_signal(4));
|
|
warmreg(get_4bit_signal(1));
|
|
|
|
$fwrite(decompile_file, "\n");
|
|
end
|
|
|
|
// instruction
|
if ( execute_now )
|
if ( execute_now )
|
begin
|
begin
|
|
|
// Interrupts override instructions that are just starting
|
// Interrupts override instructions that are just starting
|
if ( interrupt_d1 == 3'd0 || interrupt_d1 == 3'd7 )
|
if ( interrupt_d1 == 3'd0 || interrupt_d1 == 3'd7 )
|
Line 380... |
Line 417... |
$fwrite( decompile_file,"%09d interrupt swi", clk_count );
|
$fwrite( decompile_file,"%09d interrupt swi", clk_count );
|
$fwrite( decompile_file,", return addr " );
|
$fwrite( decompile_file,", return addr " );
|
$fwrite( decompile_file,"%08x\n", pcf(get_reg_val(5'd21)-4'd4) );
|
$fwrite( decompile_file,"%08x\n", pcf(get_reg_val(5'd21)-4'd4) );
|
end
|
end
|
end
|
end
|
|
end
|
|
|
|
|
|
|
always @( posedge i_clk )
|
always @( posedge i_clk )
|
if ( !i_access_stall )
|
if ( !i_core_stall )
|
begin
|
begin
|
interrupt_d1 <= i_interrupt;
|
interrupt_d1 <= i_interrupt;
|
|
|
// Asynchronous Interrupts
|
// Asynchronous Interrupts
|
if ( interrupt_d1 != 3'd0 && i_interrupt_state )
|
if ( interrupt_d1 != 3'd0 && i_interrupt_state )
|
Line 420... |
Line 459... |
// Dont print a jump message for interrupts
|
// Dont print a jump message for interrupts
|
always @( posedge i_clk )
|
always @( posedge i_clk )
|
if (
|
if (
|
i_pc_sel != 3'd0 &&
|
i_pc_sel != 3'd0 &&
|
i_pc_wen &&
|
i_pc_wen &&
|
!i_access_stall &&
|
!i_core_stall &&
|
i_instruction_execute &&
|
i_instruction_execute &&
|
i_interrupt == 3'd0 &&
|
i_interrupt == 3'd0 &&
|
!execute_undefined &&
|
!execute_undefined &&
|
type != SWI &&
|
type != SWI &&
|
execute_address != get_32bit_signal(0) // Don't print jump to same address
|
execute_address != get_32bit_signal(0) // Don't print jump to same address
|
Line 436... |
Line 475... |
fwrite_hex_drop_zeros(decompile_file, pcf(get_32bit_signal(0)) ); // u_execute.pc_nxt
|
fwrite_hex_drop_zeros(decompile_file, pcf(get_32bit_signal(0)) ); // u_execute.pc_nxt
|
$fwrite(decompile_file,", r0 %08h, ", get_reg_val ( 5'd0 ));
|
$fwrite(decompile_file,", r0 %08h, ", get_reg_val ( 5'd0 ));
|
$fwrite(decompile_file,"r1 %08h\n", get_reg_val ( 5'd1 ));
|
$fwrite(decompile_file,"r1 %08h\n", get_reg_val ( 5'd1 ));
|
end
|
end
|
|
|
// =================================================================================
|
|
// Memory Reads and Writes
|
|
// =================================================================================
|
|
|
|
reg [31:0] tmp_address;
|
|
|
|
// Data access
|
|
always @( posedge i_clk )
|
|
begin
|
|
// Data Write
|
|
if ( get_1bit_signal(0) && !get_1bit_signal(3) )
|
|
begin
|
|
|
|
$fwrite(decompile_file, "%09d write addr ", clk_count);
|
|
tmp_address = get_32bit_signal(2);
|
|
fwrite_hex_drop_zeros(decompile_file, {tmp_address [31:2], 2'd0} );
|
|
|
|
$fwrite(decompile_file, ", data %08h, be %h",
|
|
get_32bit_signal(3), // u_cache.i_write_data
|
|
get_4bit_signal (0)); // u_cache.i_byte_enable
|
|
|
|
$fwrite(decompile_file, "\n");
|
|
end
|
|
|
|
// Data Read
|
|
if ( get_1bit_signal(4) && !get_1bit_signal(1) )
|
|
begin
|
|
$fwrite(decompile_file, "%09d read addr ", clk_count);
|
|
tmp_address = get_32bit_signal(5);
|
|
fwrite_hex_drop_zeros(decompile_file, {tmp_address[31:2], 2'd0} );
|
|
|
|
$fwrite(decompile_file, ", data %08h to ", get_32bit_signal(4));
|
|
warmreg(get_4bit_signal(1));
|
|
|
|
$fwrite(decompile_file, "\n");
|
|
end
|
|
end
|
|
|
|
|
|
// =================================================================================
|
// =================================================================================
|
// Tasks
|
// Tasks
|
// =================================================================================
|
// =================================================================================
|
|
|
Line 841... |
Line 842... |
begin
|
begin
|
case (num)
|
case (num)
|
3'd0: get_1bit_signal = `U_EXECUTE.o_write_enable;
|
3'd0: get_1bit_signal = `U_EXECUTE.o_write_enable;
|
3'd1: get_1bit_signal = `U_AMBER.mem_stall;
|
3'd1: get_1bit_signal = `U_AMBER.mem_stall;
|
3'd2: get_1bit_signal = `U_EXECUTE.o_daddress_valid;
|
3'd2: get_1bit_signal = `U_EXECUTE.o_daddress_valid;
|
3'd3: get_1bit_signal = `U_AMBER.access_stall;
|
3'd3: get_1bit_signal = `U_AMBER.core_stall;
|
3'd4: get_1bit_signal = `U_WB.mem_read_data_valid_r;
|
3'd4: get_1bit_signal = `U_WB.mem_read_data_valid_r;
|
endcase
|
endcase
|
end
|
end
|
endfunction
|
endfunction
|
|
|