6 .実行アドレス

実行アドレスモジュールは、その名の通り実行アドレスを生成します。順序ロジックはありません。組み合わせ回路のみです。デコーダからの指示を受け生成します。

//May.30.2004
//Jun.4.2004 add `DISP24_567
`include "define.h"

module ea_unit(clock,sync_reset,EA,irword,ea_left_sel,ea_right_sel,RO_left,alu_out,MOUT,pc_reg,next_pc_offset,int_vector);
        input clock;
        input sync_reset;
        output [23:0] EA;
        input [63:0] irword;
        input [3:0] ea_left_sel;
        input [2:0] ea_right_sel;

        input [23:0] pc_reg;
        input [31:0] RO_left;
        input [31:0] alu_out;
        input [31:0] MOUT;
        input [2:0] next_pc_offset;
        input [7:0] int_vector;
        wire [23:0] left,right;

        

        wire [7:0] IR1=irword[23+32:16+32];
        wire [15:0] IR23=irword[15+32:32];
        wire [15:0] IR45=irword[31:16];
        wire [31:0] IR2345=irword[15+32:16];
        wire [31:0] IR4567=irword[31:0];
        wire [23:0] IR567=irword[23:0];//Jun.4.2004


        assign EA=left+right;

        assign left=ea_left_sel==`PC_SEL ? pc_reg :
                            ea_left_sel==`ABS8_SEL ?    {16'hffff,IR1} :
                            ea_left_sel==`ABS16_23_SEL ? { {8{IR23[15]}},IR23} :
                            ea_left_sel==`ABS16_45_SEL ? { {8{IR45[15]}},IR45} :
                            ea_left_sel==`ABS24_4567_SEL ? IR4567[23:0] :
                            ea_left_sel==`ABS24_2345_SEL ? IR2345[23:0] :
                            ea_left_sel==`IR1H_SEL_EA   ? RO_left[23:0] :
                            ea_left_sel==`IR3H_SEL_EA  ? RO_left[23:0] :
                            ea_left_sel==`aa8_SEL ? { 16'h0000,IR1} :
                            ea_left_sel==`ALU_OUT_SEL_EA ? alu_out[23:0] : 
                            ea_left_sel==`ABS123 ? {IR1,IR23} :
                            ea_left_sel==`NEXT_PC_EA  ?  pc_reg+{next_pc_offset,1'b0} :
                            ea_left_sel==`NEXT_PC_EA2  ?  pc_reg+{next_pc_offset,1'b0} ://May.31.2004
                            ea_left_sel==`INT_VECTOR    ?  { 16'h0000,int_vector} ://May.31.2004
                            MOUT[23:0];
                                

        assign right=ea_right_sel==`ZERO_SEL ? 0 :
                             ea_right_sel==`DISP8_SEL ? {{16{IR1[7]}},IR1} :
                             ea_right_sel==`DISP16_23_SEL ? {{8{IR23[15]}},IR23} :
                             ea_right_sel==`DISP16_45_SEL ? {{8{IR45[15]}},IR45} :
                             ea_right_sel==`VAL_MINUS4_SEL ? -4 :
                             ea_right_sel==`VAL_MINUS2_SEL ? -2 : 
                             ea_right_sel==`DISP24_567 ?  IR567 : -1;//Jun.4.2004









endmodule