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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fpga/] [mc/] [src/] [cpu/] [cpu.v] - Diff between revs 120 and 181

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

Rev 120 Rev 181
Line 97... Line 97...
  wire tlb_entry_lo_we;         // tlb entry lo write enable
  wire tlb_entry_lo_we;         // tlb entry lo write enable
  wire [31:0] tlb_entry_lo_new;  // new tlb entry lo contents
  wire [31:0] tlb_entry_lo_new;  // new tlb entry lo contents
  wire [31:0] mmu_bad_addr;      // special register 4 (mmu bad addr) contents
  wire [31:0] mmu_bad_addr;      // special register 4 (mmu bad addr) contents
  wire mmu_bad_addr_we;         // mmu bad addr write enable
  wire mmu_bad_addr_we;         // mmu bad addr write enable
  wire [31:0] mmu_bad_addr_new;  // new mmu bad addr contents
  wire [31:0] mmu_bad_addr_new;  // new mmu bad addr contents
 
  wire [31:0] mmu_bad_accs;      // special register 5 (mmu bad accs) contents
 
  wire mmu_bad_accs_we;         // mmu bad accs write enable
 
  wire [31:0] mmu_bad_accs_new;  // new mmu bad accs contents
 
 
  // mmu & tlb
  // mmu & tlb
  wire tlb_kmissed;             // page not found in tlb, MSB of addr is 1
  wire tlb_kmissed;             // page not found in tlb, MSB of addr is 1
  wire tlb_umissed;             // page not found in tlb, MSB of addr is 0
  wire tlb_umissed;             // page not found in tlb, MSB of addr is 0
  wire tlb_invalid;             // tlb entry is invalid
  wire tlb_invalid;             // tlb entry is invalid
Line 179... Line 182...
               sreg_num, sreg_we, sreg_di, sreg_do,
               sreg_num, sreg_we, sreg_di, sreg_do,
               psw, psw_we, psw_new,
               psw, psw_we, psw_new,
               tlb_index, tlb_index_we, tlb_index_new,
               tlb_index, tlb_index_we, tlb_index_new,
               tlb_entry_hi, tlb_entry_hi_we, tlb_entry_hi_new,
               tlb_entry_hi, tlb_entry_hi_we, tlb_entry_hi_new,
               tlb_entry_lo, tlb_entry_lo_we, tlb_entry_lo_new,
               tlb_entry_lo, tlb_entry_lo_we, tlb_entry_lo_new,
               mmu_bad_addr, mmu_bad_addr_we, mmu_bad_addr_new);
               mmu_bad_addr, mmu_bad_addr_we, mmu_bad_addr_new,
 
               mmu_bad_accs, mmu_bad_accs_we, mmu_bad_accs_new);
  assign mmu_bad_addr_new = virt_addr;
  assign mmu_bad_addr_new = virt_addr;
 
  assign mmu_bad_accs_we = mmu_bad_addr_we;
 
  assign mmu_bad_accs_new = { 29'b0, bus_wr, bus_size[1:0] };
 
 
  // ctrl
  // ctrl
  ctrl ctrl1(clk, reset,
  ctrl ctrl1(clk, reset,
             opcode, alu_equ, alu_ult, alu_slt,
             opcode, alu_equ, alu_ult, alu_slt,
             bus_wt, bus_en, bus_wr, bus_size,
             bus_wt, bus_en, bus_wr, bus_size,
Line 903... Line 909...
          mar_we = 1'b0;
          mar_we = 1'b0;
          ma_src = 1'b0;
          ma_src = 1'b0;
          mmu_fnc = (exc_prv_addr | exc_ill_addr) ? 3'b000 : 3'b001;
          mmu_fnc = (exc_prv_addr | exc_ill_addr) ? 3'b000 : 3'b001;
          mdor_we = 1'b0;
          mdor_we = 1'b0;
          bus_en = 1'b0;
          bus_en = 1'b0;
          bus_wr = 1'bx;
          bus_wr = 1'b0;         // get bad_accs right in case of exc
          bus_size = 2'b10;  // enable illegal address detection
          bus_size = 2'b10;  // enable illegal address detection
          mdir_we = 1'b0;
          mdir_we = 1'b0;
          mdir_sx = 1'bx;
          mdir_sx = 1'bx;
          ir_we = 1'b0;
          ir_we = 1'b0;
          reg_src2 = 2'bxx;
          reg_src2 = 2'bxx;
Line 1248... Line 1254...
          mar_we = 1'b0;
          mar_we = 1'b0;
          ma_src = 1'b1;
          ma_src = 1'b1;
          mmu_fnc = (exc_prv_addr | exc_ill_addr) ? 3'b000 : 3'b001;
          mmu_fnc = (exc_prv_addr | exc_ill_addr) ? 3'b000 : 3'b001;
          mdor_we = 1'b0;
          mdor_we = 1'b0;
          bus_en = 1'b0;
          bus_en = 1'b0;
          bus_wr = 1'bx;
          bus_wr = 1'b0;         // get bad_accs right in case of exc
          bus_size = ldst_size;  // enable illegal address detection
          bus_size = ldst_size;  // enable illegal address detection
          mdir_we = 1'b0;
          mdir_we = 1'b0;
          mdir_sx = 1'bx;
          mdir_sx = 1'bx;
          ir_we = 1'b0;
          ir_we = 1'b0;
          reg_src2 = 2'bxx;
          reg_src2 = 2'bxx;
Line 1310... Line 1316...
          mar_we = 1'b0;
          mar_we = 1'b0;
          ma_src = 1'b1;
          ma_src = 1'b1;
          mmu_fnc = (exc_prv_addr | exc_ill_addr) ? 3'b000 : 3'b001;
          mmu_fnc = (exc_prv_addr | exc_ill_addr) ? 3'b000 : 3'b001;
          mdor_we = 1'b0;
          mdor_we = 1'b0;
          bus_en = 1'b0;
          bus_en = 1'b0;
          bus_wr = 1'bx;
          bus_wr = 1'b1;         // get bad_accs right in case of exc
          bus_size = ldst_size;  // enable illegal address detection
          bus_size = ldst_size;  // enable illegal address detection
          mdir_we = 1'b0;
          mdir_we = 1'b0;
          mdir_sx = 1'bx;
          mdir_sx = 1'bx;
          ir_we = 1'b0;
          ir_we = 1'b0;
          reg_src2 = 2'bxx;
          reg_src2 = 2'bxx;
Line 2453... Line 2459...
             rn, we, din, dout,
             rn, we, din, dout,
             psw, psw_we, psw_new,
             psw, psw_we, psw_new,
             tlb_index, tlb_index_we, tlb_index_new,
             tlb_index, tlb_index_we, tlb_index_new,
             tlb_entry_hi, tlb_entry_hi_we, tlb_entry_hi_new,
             tlb_entry_hi, tlb_entry_hi_we, tlb_entry_hi_new,
             tlb_entry_lo, tlb_entry_lo_we, tlb_entry_lo_new,
             tlb_entry_lo, tlb_entry_lo_we, tlb_entry_lo_new,
             mmu_bad_addr, mmu_bad_addr_we, mmu_bad_addr_new);
             mmu_bad_addr, mmu_bad_addr_we, mmu_bad_addr_new,
 
             mmu_bad_accs, mmu_bad_accs_we, mmu_bad_accs_new);
    input clk;
    input clk;
    input reset;
    input reset;
    input [2:0] rn;
    input [2:0] rn;
    input we;
    input we;
    input [31:0] din;
    input [31:0] din;
Line 2475... Line 2482...
    input tlb_entry_lo_we;
    input tlb_entry_lo_we;
    input [31:0] tlb_entry_lo_new;
    input [31:0] tlb_entry_lo_new;
    output [31:0] mmu_bad_addr;
    output [31:0] mmu_bad_addr;
    input mmu_bad_addr_we;
    input mmu_bad_addr_we;
    input [31:0] mmu_bad_addr_new;
    input [31:0] mmu_bad_addr_new;
 
    output [31:0] mmu_bad_accs;
 
    input mmu_bad_accs_we;
 
    input [31:0] mmu_bad_accs_new;
 
 
  // rn = 000   register = PSW
  // rn = 000   register = PSW
  //      001              TLB index
  //      001              TLB index
  //      010              TLB entry high
  //      010              TLB entry high
  //      011              TLB entry low
  //      011              TLB entry low
  //      100              MMU bad address
  //      100              MMU bad address
  //      101              - not used -
  //      101              MMU bad access
  //      110              - not used -
  //      110              - not used -
  //      111              - not used -
  //      111              - not used -
 
 
  reg [31:0] sr[0:7];
  reg [31:0] sr[0:7];
 
 
Line 2493... Line 2503...
  assign psw = sr[0];
  assign psw = sr[0];
  assign tlb_index = sr[1];
  assign tlb_index = sr[1];
  assign tlb_entry_hi = sr[2];
  assign tlb_entry_hi = sr[2];
  assign tlb_entry_lo = sr[3];
  assign tlb_entry_lo = sr[3];
  assign mmu_bad_addr = sr[4];
  assign mmu_bad_addr = sr[4];
 
  assign mmu_bad_accs = sr[5];
 
 
  always @(posedge clk) begin
  always @(posedge clk) begin
    if (reset == 1) begin
    if (reset == 1) begin
      sr[0] <= 32'h00000000;
      sr[0] <= 32'h00000000;
    end else begin
    end else begin
Line 2516... Line 2527...
          sr[3] <= tlb_entry_lo_new;
          sr[3] <= tlb_entry_lo_new;
        end
        end
        if (mmu_bad_addr_we) begin
        if (mmu_bad_addr_we) begin
          sr[4] <= mmu_bad_addr_new;
          sr[4] <= mmu_bad_addr_new;
        end
        end
 
        if (mmu_bad_accs_we) begin
 
          sr[5] <= mmu_bad_accs_new;
 
        end
      end
      end
    end
    end
  end
  end
 
 
endmodule
endmodule

powered by: WebSVN 2.1.0

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