OpenCores
URL https://opencores.org/ocsvn/zap/zap/trunk

Subversion Repositories zap

[/] [zap/] [trunk/] [src/] [rtl/] [cpu/] [zap_tlb_fsm.v] - Diff between revs 29 and 43

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 29 Rev 43
Line 171... Line 171...
        begin
        begin
                if ( i_mmu_en )
                if ( i_mmu_en )
                begin
                begin
                        if ( i_walk )
                        if ( i_walk )
                        begin
                        begin
                                $display($time, "%m :: Page fault! Need to page walk! i_walk = %b", i_walk);
                                $display($time, " - %m :: Page fault! Need to page walk! i_walk = %b", i_walk);
                                $display($time, "%m :: Core generated address %x", i_address);
                                $display($time, " - %m :: Core generated address %x", i_address);
                                $display($time, "%m :: Moving to FETCH_L1_DESC. i_baddr = %x baddr_tran_base = %x addr_va_table_index = %x",
                                $display($time, " - %m :: Moving to FETCH_L1_DESC. i_baddr = %x baddr_tran_base = %x addr_va_table_index = %x",
                                         i_baddr, i_baddr[`VA__TRANSLATION_BASE], i_address[`VA__TABLE_INDEX]);
                                         i_baddr, i_baddr[`VA__TRANSLATION_BASE], i_address[`VA__TABLE_INDEX]);
 
 
                                `ifdef TLB_DEBUG
                                `ifdef TLB_DEBUG
                                        $stop;
                                        $stop;
                                `endif
                                `endif
Line 193... Line 193...
 
 
                                state_nxt = FETCH_L1_DESC_0;
                                state_nxt = FETCH_L1_DESC_0;
                        end
                        end
                        else if ( i_fsr[3:0] != 4'b0000 ) /* Access Violation. */
                        else if ( i_fsr[3:0] != 4'b0000 ) /* Access Violation. */
                        begin
                        begin
                                $display($time, "%m :: Access violation fsr = %x far = %x...", i_fsr, i_far);
                                $display($time, " - %m :: Access violation fsr = %x far = %x...", i_fsr, i_far);
 
 
                                `ifdef TLB_DEBUG
                                `ifdef TLB_DEBUG
                                        $stop;
                                        $stop;
                                `endif
                                `endif
 
 
Line 207... Line 207...
                                o_far   = i_far;
                                o_far   = i_far;
                        end
                        end
                        else
                        else
                        begin
                        begin
                                `ifdef DISP_TLB_SUCCESS
                                `ifdef DISP_TLB_SUCCESS
                                        $display($time, "TLB Hit for address = %x MMU enable = %x!", i_address, i_mmu_en);
                                        $display($time, " - %m :: TLB Hit for address = %x MMU enable = %x!", i_address, i_mmu_en);
                                `endif
                                `endif
 
 
                                `ifdef TLB_DEBUG
                                `ifdef TLB_DEBUG
                                        $stop;
                                        $stop;
                                `endif
                                `endif
Line 219... Line 219...
                end
                end
        end
        end
 
 
        FETCH_L1_DESC_0:
        FETCH_L1_DESC_0:
        begin
        begin
                $display($time, "%m :: In state FETCH_L1_DESC_0");
                $display($time, " - %m :: In state FETCH_L1_DESC_0");
 
 
                o_busy = 1;
                o_busy = 1;
 
 
                if ( i_wb_ack )
                if ( i_wb_ack )
                begin
                begin
                        dnxt = i_wb_dat;
                        dnxt = i_wb_dat;
                        state_nxt = FETCH_L1_DESC;
                        state_nxt = FETCH_L1_DESC;
 
 
                        $display($time, "%m :: Received %x from WB. Moving to FETCH_L1_DESC...", dnxt );
                        $display($time, " - %m :: Received %x from WB. Moving to FETCH_L1_DESC...", dnxt );
                end
                end
                else tsk_hold_wb_access;
                else tsk_hold_wb_access;
        end
        end
 
 
        FETCH_L1_DESC:
        FETCH_L1_DESC:
Line 240... Line 240...
                /*
                /*
                 * What we would have fetched is the L1 descriptor.
                 * What we would have fetched is the L1 descriptor.
                 * Examine it. dff holds the L1 descriptor.
                 * Examine it. dff holds the L1 descriptor.
                 */
                 */
 
 
                $display($time, "%m :: In FETCH_L1_DESC state...");
                $display($time, " - %m :: In FETCH_L1_DESC state...");
 
 
                o_busy = 1'd1;
                o_busy = 1'd1;
 
 
                if ( 1 )
                if ( 1 )
                begin
                begin
                        $display($time, "%m :: ACK received. Read data is %x", i_wb_dat);
                        $display($time, " - %m :: ACK received. Read data is %x", i_wb_dat);
 
 
                        `ifdef TLB_DEBUG
                        `ifdef TLB_DEBUG
                                $stop;
                                $stop;
                        `endif
                        `endif
 
 
Line 266... Line 266...
                                o_setlb_wen       = 1'd1;
                                o_setlb_wen       = 1'd1;
                                o_setlb_wdata     = {i_address[`VA__SECTION_TAG],
                                o_setlb_wdata     = {i_address[`VA__SECTION_TAG],
                                                     dff};
                                                     dff};
                                state_nxt       = REFRESH_CYCLE;
                                state_nxt       = REFRESH_CYCLE;
 
 
                                $display($time, "%m :: It is a section ID. Writing to section TLB as %x. Moving to refresh cycle...", o_setlb_wdata);
                                $display($time, " - %m :: It is a section ID. Writing to section TLB as %x. Moving to refresh cycle...", o_setlb_wdata);
 
 
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
                                $display("            SECTION DESCRIPTOR DETAILS                  #");
                                $display($time, " - %m ::             SECTION DESCRIPTOR DETAILS                  #");
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
                                $display("# BASE ADDRESS  = 0x%x ", o_setlb_wdata[`SECTION_TLB__BASE]);
                                $display($time, " - %m :: # BASE ADDRESS  = 0x%x ", o_setlb_wdata[`SECTION_TLB__BASE]);
                                $display("# DAC           = 0b%b",  o_setlb_wdata[`SECTION_TLB__DAC_SEL]);
                                $display($time, " - %m :: # DAC           = 0b%b",  o_setlb_wdata[`SECTION_TLB__DAC_SEL]);
                                $display("# AP bits       = 0b%b",  o_setlb_wdata[`SECTION_TLB__AP]);
                                $display($time, " - %m :: # AP bits       = 0b%b",  o_setlb_wdata[`SECTION_TLB__AP]);
                                $display("# Cacheable     = 0b%b",  o_setlb_wdata[`SECTION_TLB__CB] >> 1);
                                $display($time, " - %m :: # Cacheable     = 0b%b",  o_setlb_wdata[`SECTION_TLB__CB] >> 1);
                                $display("# Bufferable    = 0b%b",  o_setlb_wdata[`SECTION_TLB__CB] & 2'b01);
                                $display($time, " - %m :: # Bufferable    = 0b%b",  o_setlb_wdata[`SECTION_TLB__CB] & 2'b01);
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
 
 
                                `ifdef TLB_DEBUG
                                `ifdef TLB_DEBUG
                                        $stop;
                                        $stop;
                                `endif
                                `endif
                        end
                        end
Line 297... Line 297...
                                state_nxt       = FETCH_L2_DESC_0;
                                state_nxt       = FETCH_L2_DESC_0;
 
 
                                tsk_prpr_wb_rd({dff[`L1_PAGE__PTBR],
                                tsk_prpr_wb_rd({dff[`L1_PAGE__PTBR],
                                                  i_address[`VA__L2_TABLE_INDEX], 2'd0});
                                                  i_address[`VA__L2_TABLE_INDEX], 2'd0});
 
 
                                $display($time, "%m :: L1 received Page ID.");
                                $display($time, " - %m :: L1 received Page ID.");
 
 
                                `ifdef TLB_DEBUG
                                `ifdef TLB_DEBUG
                                        $stop;
                                        $stop;
                                `endif
                                `endif
                        end
                        end
Line 313... Line 313...
                                o_far        = i_address;
                                o_far        = i_address;
                                o_fault      = 1'd1;
                                o_fault      = 1'd1;
                                o_busy       = 1'd0;
                                o_busy       = 1'd0;
                                state_nxt    = IDLE;
                                state_nxt    = IDLE;
 
 
                                $display($time, "%m :: FSR section translation fault!");
                                $display($time, " - %m :: FSR section translation fault!");
 
 
                                `ifdef TLB_DEBUG
                                `ifdef TLB_DEBUG
                                        $stop;
                                        $stop;
                                `endif
                                `endif
                        end
                        end
Line 359... Line 359...
                                o_sptlb_wdata[`SPAGE_TLB__DAC_SEL] = dac_ff;                    /* DAC selector from L1. */
                                o_sptlb_wdata[`SPAGE_TLB__DAC_SEL] = dac_ff;                    /* DAC selector from L1. */
                                o_sptlb_wdata[`SPAGE_TLB__AP]      = dff[`L2_SPAGE__AP];
                                o_sptlb_wdata[`SPAGE_TLB__AP]      = dff[`L2_SPAGE__AP];
                                o_sptlb_wdata[`SPAGE_TLB__CB]      = dff[`L2_SPAGE__CB];
                                o_sptlb_wdata[`SPAGE_TLB__CB]      = dff[`L2_SPAGE__CB];
                                o_sptlb_wdata[`SPAGE_TLB__BASE]    = dff[`L2_SPAGE__BASE];
                                o_sptlb_wdata[`SPAGE_TLB__BASE]    = dff[`L2_SPAGE__BASE];
 
 
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
                                $display("              SPAGE DESCRIPTOR DETAILS                  #");
                                $display($time, " - %m ::               SPAGE DESCRIPTOR DETAILS                  #");
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
                                $display("# BASE ADDRESS  = 0x%x ", o_sptlb_wdata[`SPAGE_TLB__BASE]);
                                $display($time, " - %m :: # BASE ADDRESS  = 0x%x ", o_sptlb_wdata[`SPAGE_TLB__BASE]);
                                $display("# DAC           = 0b%b",  o_sptlb_wdata[`SPAGE_TLB__DAC_SEL]);
                                $display($time, " - %m :: # DAC           = 0b%b",  o_sptlb_wdata[`SPAGE_TLB__DAC_SEL]);
                                $display("# AP bits       = 0b%b",  o_sptlb_wdata[`SPAGE_TLB__AP]);
                                $display($time, " - %m :: # AP bits       = 0b%b",  o_sptlb_wdata[`SPAGE_TLB__AP]);
                                $display("# Cacheable     = 0b%b",  o_sptlb_wdata[`SPAGE_TLB__CB] >> 1);
                                $display($time, " - %m :: # Cacheable     = 0b%b",  o_sptlb_wdata[`SPAGE_TLB__CB] >> 1);
                                $display("# Bufferable    = 0b%b",  o_sptlb_wdata[`SPAGE_TLB__CB] & 2'b01);
                                $display($time, " - %m :: # Bufferable    = 0b%b",  o_sptlb_wdata[`SPAGE_TLB__CB] & 2'b01);
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
 
 
                                /* Go to REFRESH */
                                /* Go to REFRESH */
                                state_nxt   = REFRESH_CYCLE;
                                state_nxt   = REFRESH_CYCLE;
                        end
                        end
 
 
Line 381... Line 381...
                                o_lptlb_wen   = 1'd1;
                                o_lptlb_wen   = 1'd1;
 
 
                                /* DAC is inserted in between to save bits */
                                /* DAC is inserted in between to save bits */
                                o_lptlb_wdata = {i_address[`VA__LPAGE_TAG], dac_ff, dff};
                                o_lptlb_wdata = {i_address[`VA__LPAGE_TAG], dac_ff, dff};
 
 
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
                                $display("              LPAGE DESCRIPTOR DETAILS                  #");
                                $display($time, " - %m ::               LPAGE DESCRIPTOR DETAILS                  #");
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
                                $display("# BASE ADDRESS  = 0x%x ", o_lptlb_wdata[`LPAGE_TLB__BASE]);
                                $display($time, " - %m :: # BASE ADDRESS  = 0x%x ", o_lptlb_wdata[`LPAGE_TLB__BASE]);
                                $display("# DAC           = 0b%b",  o_lptlb_wdata[`LPAGE_TLB__DAC_SEL]);
                                $display($time, " - %m :: # DAC           = 0b%b",  o_lptlb_wdata[`LPAGE_TLB__DAC_SEL]);
                                $display("# AP bits       = 0b%b",  o_lptlb_wdata[`LPAGE_TLB__AP]);
                                $display($time, " - %m :: # AP bits       = 0b%b",  o_lptlb_wdata[`LPAGE_TLB__AP]);
                                $display("# Cacheable     = 0b%b",  o_lptlb_wdata[`LPAGE_TLB__CB] >> 1);
                                $display($time, " - %m :: # Cacheable     = 0b%b",  o_lptlb_wdata[`LPAGE_TLB__CB] >> 1);
                                $display("# Bufferable    = 0b%b",  o_lptlb_wdata[`LPAGE_TLB__CB] & 2'b01);
                                $display($time, " - %m :: # Bufferable    = 0b%b",  o_lptlb_wdata[`LPAGE_TLB__CB] & 2'b01);
                                $display("#########################################################");
                                $display($time, " - %m :: #########################################################");
 
 
                                state_nxt   = REFRESH_CYCLE;
                                state_nxt   = REFRESH_CYCLE;
                        end
                        end
 
 
                        default: /* Fault Class II */
                        default: /* Fault Class II */
Line 410... Line 410...
                else tsk_hold_wb_access;
                else tsk_hold_wb_access;
        end
        end
 
 
        REFRESH_CYCLE:
        REFRESH_CYCLE:
        begin
        begin
                $display($time, "%m :: Entered refresh cycle. Moving to IDLE...");
                $display($time, " - %m :: Entered refresh cycle. Moving to IDLE...");
 
 
                `ifdef TLB_DEBUG
                `ifdef TLB_DEBUG
                        $stop;
                        $stop;
                `endif
                `endif
 
 
Line 461... Line 461...
end
end
endtask
endtask
 
 
task tsk_prpr_wb_rd ( input [31:0] adr );
task tsk_prpr_wb_rd ( input [31:0] adr );
begin
begin
        $display($time, "%m :: Reading from location %x", adr);
        $display($time, " - %m :: Reading from location %x", adr);
 
 
        `ifdef TLB_DEBUG
        `ifdef TLB_DEBUG
                $stop;
                $stop;
        `endif
        `endif
 
 
Line 476... Line 476...
end
end
endtask
endtask
 
 
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
 
 
`ifndef SYNTHESIS
// assertions_start
 
 
always @ (posedge i_mmu_en)
always @ (posedge i_mmu_en)
begin
begin
        $display($time, "%m :: MMU Enabled!");
        $display($time, " - %m :: MMU Enabled!");
 
 
        `ifdef TLB_DEBUG
 
                $stop;
 
        `endif
 
end
end
 
 
always @ (negedge i_mmu_en)
always @ (negedge i_mmu_en)
begin
begin
        $display($time, "%m :: MMU Disabled!");
        $display($time, " - %m :: MMU Disabled!");
 
 
        `ifdef TLB_DEBUG
 
                $stop;
 
        `endif
 
end
end
 
 
`endif
// assertions_end
 
 
endmodule // zap_tlb_fsm.v
endmodule // zap_tlb_fsm.v
 
 
`default_nettype wire
`default_nettype wire
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.