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

Subversion Repositories 8051

[/] [8051/] [trunk/] [rtl/] [verilog/] [oc8051_icache.v] - Diff between revs 94 and 108

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

Rev 94 Rev 108
Line 42... Line 42...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.5  2003/04/02 11:22:15  simont
 
// fix bug.
 
//
// Revision 1.4  2003/01/21 14:08:18  simont
// Revision 1.4  2003/01/21 14:08:18  simont
// fix bugs
// fix bugs
//
//
// Revision 1.3  2003/01/13 14:14:41  simont
// Revision 1.3  2003/01/13 14:14:41  simont
// replace some modules
// replace some modules
Line 112... Line 115...
reg [13-ADR_WIDTH:0] con_buf [BL_NUM:0];
reg [13-ADR_WIDTH:0] con_buf [BL_NUM:0];
// valid[x]=1 if block x is valid;
// valid[x]=1 if block x is valid;
reg [BL_NUM:0] valid;
reg [BL_NUM:0] valid;
// con0, con2 contain temporal control information of current address and corrent address+2
// con0, con2 contain temporal control information of current address and corrent address+2
// part of con_buf memory
// part of con_buf memory
reg [14-ADR_WIDTH:0] con0, con2;
reg [13-ADR_WIDTH:0] con0, con2;
//current upper address,
//current upper address,
reg [13-ADR_WIDTH:0] cadr0, cadr2;
reg [13-ADR_WIDTH:0] cadr0, cadr2;
reg stb_b;
reg stb_b;
// byte_select in 32 bit line (adr_i[1:0])
// byte_select in 32 bit line (adr_i[1:0])
reg [1:0] byte_sel;
reg [1:0] byte_sel;
Line 126... Line 129...
reg [31:0] data1_i;
reg [31:0] data1_i;
// temporaly data from ram
// temporaly data from ram
reg [15:0] tmp_data1;
reg [15:0] tmp_data1;
reg wr1, wr1_t, stb_it;
reg wr1, wr1_t, stb_it;
 
 
 
////////////////
 
 
 
reg vaild_h, vaild_l;
 
 
 
 
wire [31:0] data0, data1_o;
wire [31:0] data0, data1_o;
wire cy, cy1;
wire cy, cy1;
wire [BL_WIDTH-1:0] adr_i2;
wire [BL_WIDTH-1:0] adr_i2;
wire hit, hit_l, hit_h;
wire hit, hit_l, hit_h;
wire [ADR_WIDTH-1:0] adr_r, addr1;
wire [ADR_WIDTH-1:0] adr_r, addr1;
Line 139... Line 147...
wire [LINE_WIDTH-1:0] adr_r1;
wire [LINE_WIDTH-1:0] adr_r1;
 
 
 
 
assign cy = &adr_i[LINE_WIDTH+1:1];
assign cy = &adr_i[LINE_WIDTH+1:1];
assign {cy1, adr_i2} = {1'b0, adr_i[ADR_WIDTH+1:LINE_WIDTH+2]}+cy;
assign {cy1, adr_i2} = {1'b0, adr_i[ADR_WIDTH+1:LINE_WIDTH+2]}+cy;
assign hit_l =(con0=={cadr0,1'b1});
assign hit_l = (con0==cadr0) & vaild_l;
assign hit_h =(con2=={cadr2,1'b1});
assign hit_h = (con2==cadr2) & vaild_h;
assign hit = hit_l && hit_h;
assign hit = hit_l && hit_h;
 
 
assign adr_r = adr_i[ADR_WIDTH+1:2] + adr_i[1];
assign adr_r = adr_i[ADR_WIDTH+1:2] + adr_i[1];
assign addr1 = wr1 ? adr_w : adr_r;
assign addr1 = wr1 ? adr_w : adr_r;
assign adr_r1 = adr_r[LINE_WIDTH-1:0] + 2'b01;
assign adr_r1 = adr_r[LINE_WIDTH-1:0] + 2'b01;
//assign ack_o = hit;
 
assign ack_o = hit && stb_it;
assign ack_o = hit && stb_it;
 
 
assign data1 = wr1_t ? tmp_data1 : data1_o[31:16];
assign data1 = wr1_t ? tmp_data1 : data1_o[31:16];
 
 
assign adr_o = {mis_adr[15:LINE_WIDTH+2], cyc, 2'b00};
assign adr_o = {mis_adr[15:LINE_WIDTH+2], cyc, 2'b00};
 
 
 
 
 
 
oc8051_cache_ram oc8051_cache_ram1(.clk(clk), .rst(rst), .addr0(adr_i[ADR_WIDTH+1:2]),
oc8051_cache_ram oc8051_cache_ram1(.clk(clk), .rst(rst), .addr0(adr_i[ADR_WIDTH+1:2]),
       .addr1(addr1), .data0(data0), .data1_o(data1_o), .data1_i(data1_i),
       .addr1(addr1), .data0(data0), .data1_o(data1_o), .data1_i(data1_i),
       .wr1(wr1));
       .wr1(wr1));
 
 
defparam oc8051_cache_ram1.ADR_WIDTH = ADR_WIDTH;
defparam oc8051_cache_ram1.ADR_WIDTH = ADR_WIDTH;
defparam oc8051_cache_ram1.CACHE_RAM = CACHE_RAM;
defparam oc8051_cache_ram1.CACHE_RAM = CACHE_RAM;
 
 
 
 
 
 
 
/*
 
generic_dpram #(ADR_WIDTH, 32) oc8051_cache_ram1(
 
        .rclk  ( clk                  ),
 
        .rrst  ( rst                  ),
 
        .rce   ( 1'b1                 ),
 
        .oe    ( 1'b1                 ),
 
        .raddr ( adr_i[ADR_WIDTH+1:2] ),
 
        .do    ( data0                ),
 
 
 
        .wclk  ( clk                  ),
 
        .wrst  ( rst                  ),
 
        .wce   ( 1'b1                 ),
 
        .we    ( wr1                  ),
 
        .waddr ( addr1                ),
 
        .di    ( data1_i              )
 
);
 
*/
 
 
 
 
 
 
 
 
always @(stb_b or data0 or data1 or byte_sel)
always @(stb_b or data0 or data1 or byte_sel)
begin
begin
  if (stb_b) begin
  if (stb_b) begin
    case (byte_sel)
    case (byte_sel)
      2'b00  : dat_o = data0;
      2'b00  : dat_o = data0;
Line 181... Line 212...
begin
begin
  if (rst)
  if (rst)
    begin
    begin
        con0 <= #1 9'h0;
        con0 <= #1 9'h0;
        con2 <= #1 9'h0;
        con2 <= #1 9'h0;
 
        vaild_h <= #1 1'b0;
 
        vaild_l <= #1 1'b0;
    end
    end
  else
  else
    begin
    begin
        con0 <= #1 {con_buf[adr_i[ADR_WIDTH+1:LINE_WIDTH+2]], valid[adr_i[ADR_WIDTH+1:LINE_WIDTH+2]]};
        con0 <= #1 {con_buf[adr_i[ADR_WIDTH+1:LINE_WIDTH+2]]};
        con2 <= #1 {con_buf[adr_i2], valid[adr_i2]};
        con2 <= #1 {con_buf[adr_i2]};
 
        vaild_l <= #1 valid[adr_i[ADR_WIDTH+1:LINE_WIDTH+2]];
 
        vaild_h <= #1 valid[adr_i2];
    end
    end
end
end
 
 
always @(posedge clk or posedge rst)
always @(posedge clk or posedge rst)
begin
begin
Line 242... Line 277...
        if (&cyc)
        if (&cyc)
          begin
          begin
              cyc   <= #1 2'b00;
              cyc   <= #1 2'b00;
              cyc_o <= #1 1'b0;
              cyc_o <= #1 1'b0;
              stb_o <= #1 1'b0;
              stb_o <= #1 1'b0;
//              con_buf[mis_adr[ADR_WIDTH+1:LINE_WIDTH+2]] <= #1 mis_adr[15:ADR_WIDTH+2];
 
              valid[mis_adr[ADR_WIDTH+1:LINE_WIDTH+2]] <= #1 1'b1;
              valid[mis_adr[ADR_WIDTH+1:LINE_WIDTH+2]] <= #1 1'b1;
          end
          end
        else
        else
          begin
          begin
              cyc   <= #1 cyc + 1'b1;
              cyc   <= #1 cyc + 1'b1;
              cyc_o <= #1 1'b1;
              cyc_o <= #1 1'b1;
              stb_o <= #1 1'b1;
              stb_o <= #1 1'b1;
 
              valid[mis_adr[ADR_WIDTH+1:LINE_WIDTH+2]] <= #1 1'b0;
          end
          end
 
 
 
 
/*    case (cyc)
 
      2'b00: begin
 
        cyc <= #1 2'b01;
 
        cyc_o <= #1 1'b1;
 
        stb_o <= #1 1'b1;
 
      end
 
      2'b01: begin
 
        cyc <= #1 2'b10;
 
        cyc_o <= #1 1'b1;
 
        stb_o <= #1 1'b1;
 
      end
 
      2'b10: begin
 
        cyc <= #1 2'b11;
 
        cyc_o <= #1 1'b1;
 
        stb_o <= #1 1'b1;
 
      end
 
      default: begin
 
        cyc <= #1 2'b00;
 
        cyc_o <= #1 1'b0;
 
        stb_o <= #1 1'b0;
 
        con_buf[mis_adr[7:4]] <= #1 mis_adr[15:8];
 
        valid[mis_adr[7:4]] <= #1 1'b1;
 
      end
 
    endcase*/
 
    end
    end
  else
  else
    wr1 <= #1 1'b0;
    wr1 <= #1 1'b0;
end
end
 
 

powered by: WebSVN 2.1.0

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