decode에서 type이 나오고, 여기서 type == SIMD_LDST이면 simd_enable_nxt = 1'd1로 되어 버린다.




그러면 이제 type이 어떻게 결정되는지를 살펴보면, 




instruction을 보고 알 수 있다. 여기서, instruction[27:4]를 보고 type을 결정하게 되는데,




순서가 중요하다고 한다. 그래서 여기서 우리가 쓸 수 있는 instruction은




24'b1101??0?????????101????? : type = SIMD_LDST; 이것을 쓸 수 있을 것 같다. 그래서 이 instruction이 오게 된다면, on, off를 바꿔주는 것이다.




그렇다면 instruction은 어디서 오는지를 살펴봐야 된다.




assign instruction      =         instruction_sel == 2'd0 ? o_read_data               :


                                  instruction_sel == 2'd1 ? saved_current_instruction :


                                                            pre_fetch_instruction     ;


이렇게 되어있으니, 1. o_read_data나 2. saved_current_instruction이나 3. pre_fetch_instruction에서 볼 수 있다.




1. 그러면 o_read_data부터 살펴보면 다음과 같이 나온다.




이것은 always @ ( posedge i_clk )


    if (!i_fetch_stall) 


        begin                                                                                                                 


        o_read_data                 <= i_read_data;


o_simd_read_data    <= i_simd_read_data; //@sungbo


이렇게 되어있는 것으로 보아 stall상태가 아닌 경우에 i_read_data가 들어오는 것이다.




그렇다면 i_read_data는 어디서 오는 것인지를 살펴보면 




input으로 들어오는 것이다. 이것은 fetch.v의 o_read_data에서 나오는 것인데., 




assign o_read_data       = sel_cache  ? cache_read_data : 


                           sel_wb     ? wb_dat32        : //@sungbo


                                        32'he3a00000    ;


이렇게 되어있는 것으로 봐서 A. cache_read_data 혹은 B. wb_dat32 로부터 오는 것임을 알 수 있다.




1-A. 그렇다면 cache_read_data는 어디서 오는 것인지 확인해보면 cache.v에서 o_read_data와 연결이 되어 있는 것을 알 수 있다.




그렇다면 cache.v로 가서 보면 




assign o_read_data      = wb_read_buf_hit                              ? wb_read_buf_data   :


                          i_address[WORD_SEL_MSB:WORD_SEL_LSB] == 2'd0 ? hit_rdata [31:0]   :


                          i_address[WORD_SEL_MSB:WORD_SEL_LSB] == 2'd1 ? hit_rdata [63:32]  :


                          i_address[WORD_SEL_MSB:WORD_SEL_LSB] == 2'd2 ? hit_rdata [95:64]  :


                                                                         hit_rdata [127:96] ;




이렇게 되어있다. 그러면 a. wb_read_buf_data와 b. hit_rdata로 되어있으니 하나씩 살펴보면




1-A-a. wb_read_buf_data는 다음과 같다.


always @ ( posedge i_clk )

    begin

    if ( c_state == CS_FILL1 || c_state == CS_FILL2 || 

         c_state == CS_FILL3 || c_state == CS_FILL4 )

        begin

        if ( !i_wb_stall )

            begin

            wb_read_buf_valid   <= 1'd1;

            wb_read_buf_address <= i_wb_address;

            wb_read_buf_data    <= i_wb_read_data;

            end

        end

    else    

        wb_read_buf_valid   <= 1'd0;

    end


이렇게 되어있다. 그러므로 fill state일 때, i_wb_read_data가 들어오는 것이다. 그렇다면 이것은


input으로 들어오는 것인데, 이것은 fetch.v에서 i_wb_dat와 연결되고


그것은 core에서 input으로 받아서 들어오는 i_wb_dat이다.

+ Recent posts