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

Subversion Repositories mpmc8

[/] [mpmc8/] [trunk/] [rtl/] [mpmc10/] [mpcm10_cache_wb.sv] - Diff between revs 10 and 11

Show entire file | Details | Blame | View Log

Rev 10 Rev 11
Line 1... Line 1...
`timescale 1ns / 1ps
`timescale 1ns / 1ps
// ============================================================================
// ============================================================================
//        __
//        __
//   \\__/ o\    (C) 2015-2022  Robert Finch, Waterloo
//   \\__/ o\    (C) 2015-2023  Robert Finch, Waterloo
//    \  __ /    All rights reserved.
//    \  __ /    All rights reserved.
//     \/_//     robfinch@finitron.ca
//     \/_//     robfinch@finitron.ca
//       ||
//       ||
//
//
// BSD 3-Clause License
// BSD 3-Clause License
Line 37... Line 37...
import const_pkg::*;
import const_pkg::*;
import wishbone_pkg::*;
import wishbone_pkg::*;
import mpmc10_pkg::*;
import mpmc10_pkg::*;
 
 
module mpmc10_cache_wb (input rst, wclk, inv,
module mpmc10_cache_wb (input rst, wclk, inv,
        input wb_write_request128_t wchi,
        input wb_cmd_request128_t wchi,
        output wb_write_response_t wcho,
        output wb_write_response_t wcho,
        input wb_write_request128_t ld,
        input wb_cmd_request128_t ld,
        input ch0clk,
        input ch0clk,
        input ch1clk,
        input ch1clk,
        input ch2clk,
        input ch2clk,
        input ch3clk,
        input ch3clk,
        input ch4clk,
        input ch4clk,
        input ch5clk,
        input ch5clk,
        input ch6clk,
        input ch6clk,
        input ch7clk,
        input ch7clk,
        input wb_write_request128_t ch0i,
        input wb_cmd_request128_t ch0i,
        input wb_write_request128_t ch1i,
        input wb_cmd_request128_t ch1i,
        input wb_write_request128_t ch2i,
        input wb_cmd_request128_t ch2i,
        input wb_write_request128_t ch3i,
        input wb_cmd_request128_t ch3i,
        input wb_write_request128_t ch4i,
        input wb_cmd_request128_t ch4i,
        input wb_write_request128_t ch5i,
        input wb_cmd_request128_t ch5i,
        input wb_write_request128_t ch6i,
        input wb_cmd_request128_t ch6i,
        input wb_write_request128_t ch7i,
        input wb_cmd_request128_t ch7i,
        input ch0wack,
        input ch0wack,
        input ch1wack,
        input ch1wack,
        input ch2wack,
        input ch2wack,
        input ch3wack,
        input ch3wack,
        input ch4wack,
        input ch4wack,
        input ch5wack,
        input ch5wack,
        input ch6wack,
        input ch6wack,
        input ch7wack,
        input ch7wack,
        output wb_read_response128_t ch0o,
        output wb_cmd_response128_t ch0o,
        output wb_read_response128_t ch1o,
        output wb_cmd_response128_t ch1o,
        output wb_read_response128_t ch2o,
        output wb_cmd_response128_t ch2o,
        output wb_read_response128_t ch3o,
        output wb_cmd_response128_t ch3o,
        output wb_read_response128_t ch4o,
        output wb_cmd_response128_t ch4o,
        output wb_read_response128_t ch5o,
        output wb_cmd_response128_t ch5o,
        output wb_read_response128_t ch6o,
        output wb_cmd_response128_t ch6o,
        output wb_read_response128_t ch7o
        output wb_cmd_response128_t ch7o,
 
        output reg ch0hit,
 
        output reg ch1hit,
 
        output reg ch2hit,
 
        output reg ch3hit,
 
        output reg ch4hit,
 
        output reg ch5hit,
 
        output reg ch6hit,
 
        output reg ch7hit
);
);
parameter DEP=1024;
parameter DEP=1024;
parameter LOBIT=4;
parameter LOBIT=4;
parameter HIBIT=13;
parameter HIBIT=13;
 
 
Line 131... Line 139...
reg stb5;
reg stb5;
reg stb6;
reg stb6;
reg stb7;
reg stb7;
reg [8:0] rstb;
reg [8:0] rstb;
 
 
always_ff @(posedge ch0clk) radrr[0] <= ch0i.adr;
always_ff @(posedge ch0clk) radrr[0] <= ch0i.padr;
always_ff @(posedge ch1clk) radrr[1] <= ch1i.adr;
always_ff @(posedge ch1clk) radrr[1] <= ch1i.padr;
always_ff @(posedge ch2clk) radrr[2] <= ch2i.adr;
always_ff @(posedge ch2clk) radrr[2] <= ch2i.padr;
always_ff @(posedge ch3clk) radrr[3] <= ch3i.adr;
always_ff @(posedge ch3clk) radrr[3] <= ch3i.padr;
always_ff @(posedge ch4clk) radrr[4] <= ch4i.adr;
always_ff @(posedge ch4clk) radrr[4] <= ch4i.padr;
always_ff @(posedge ch5clk) radrr[5] <= ch5i.adr;
always_ff @(posedge ch5clk) radrr[5] <= ch5i.padr;
always_ff @(posedge ch6clk) radrr[6] <= ch6i.adr;
always_ff @(posedge ch6clk) radrr[6] <= ch6i.padr;
always_ff @(posedge ch7clk) radrr[7] <= ch7i.adr;
always_ff @(posedge ch7clk) radrr[7] <= ch7i.padr;
always_ff @(posedge wclk) radrr[8] <= ld.cyc ? ld.adr : wchi.adr;
always_ff @(posedge wclk) radrr[8] <= ld.cyc ? ld.padr : wchi.padr;
always_ff @(posedge wclk) wchi_adr1 <= wchi.adr;
always_ff @(posedge wclk) wchi_adr1 <= wchi.padr;
always_ff @(posedge wclk) wchi_adr <= wchi_adr1;
always_ff @(posedge wclk) wchi_adr <= wchi_adr1;
 
 
always_ff @(posedge ch0clk) stb0 <= ch0i.stb;
always_ff @(posedge ch0clk) stb0 <= ch0i.stb;
always_ff @(posedge ch1clk) stb1 <= ch1i.stb;
always_ff @(posedge ch1clk) stb1 <= ch1i.stb;
always_ff @(posedge ch2clk) stb2 <= ch2i.stb;
always_ff @(posedge ch2clk) stb2 <= ch2i.stb;
Line 165... Line 173...
always_comb rstb[8] <= ld.cyc ? ld.stb : wchi.stb;
always_comb rstb[8] <= ld.cyc ? ld.stb : wchi.stb;
 
 
always_ff @(posedge wclk) wchi_stb_r <= wchi.stb;
always_ff @(posedge wclk) wchi_stb_r <= wchi.stb;
always_ff @(posedge wclk) wchi_stb <= wchi_stb_r;
always_ff @(posedge wclk) wchi_stb <= wchi_stb_r;
always_ff @(posedge wclk) wchi_sel <= wchi.sel;
always_ff @(posedge wclk) wchi_sel <= wchi.sel;
always_ff @(posedge wclk) wchi_dat <= wchi.dat;
always_ff @(posedge wclk) wchi_dat <= wchi.data1;
 
 
reg [8:0] rclkp;
reg [8:0] rclkp;
always_comb
always_comb
begin
begin
        rclkp[0] = ch0clk;
        rclkp[0] = ch0clk;
Line 184... Line 192...
end
end
 
 
reg [HIBIT-LOBIT:0] radr [0:8];
reg [HIBIT-LOBIT:0] radr [0:8];
always_comb
always_comb
begin
begin
        radr[0] = ch0i.adr[HIBIT:LOBIT];
        radr[0] = ch0i.padr[HIBIT:LOBIT];
        radr[1] = ch1i.adr[HIBIT:LOBIT];
        radr[1] = ch1i.padr[HIBIT:LOBIT];
        radr[2] = ch2i.adr[HIBIT:LOBIT];
        radr[2] = ch2i.padr[HIBIT:LOBIT];
        radr[3] = ch3i.adr[HIBIT:LOBIT];
        radr[3] = ch3i.padr[HIBIT:LOBIT];
        radr[4] = ch4i.adr[HIBIT:LOBIT];
        radr[4] = ch4i.padr[HIBIT:LOBIT];
        radr[5] = ch5i.adr[HIBIT:LOBIT];
        radr[5] = ch5i.padr[HIBIT:LOBIT];
        radr[6] = ch6i.adr[HIBIT:LOBIT];
        radr[6] = ch6i.padr[HIBIT:LOBIT];
        radr[7] = ch7i.adr[HIBIT:LOBIT];
        radr[7] = ch7i.padr[HIBIT:LOBIT];
        radr[8] = ld.cyc ? ld.adr[HIBIT:LOBIT] : wchi.adr[HIBIT:LOBIT];
        radr[8] = ld.cyc ? ld.padr[HIBIT:LOBIT] : wchi.padr[HIBIT:LOBIT];
end
end
 
 
   // xpm_memory_sdpram: Simple Dual Port RAM
   // xpm_memory_sdpram: Simple Dual Port RAM
   // Xilinx Parameterized Macro, version 2020.2
   // Xilinx Parameterized Macro, version 2020.2
 
 
Line 303... Line 311...
                always_ff @(posedge ch5clk)     hit5a[g] = (doutb[5].lines[g].tag==radrr[5][31:LOBIT]) && (vbito5a[g]==1'b1);
                always_ff @(posedge ch5clk)     hit5a[g] = (doutb[5].lines[g].tag==radrr[5][31:LOBIT]) && (vbito5a[g]==1'b1);
                always_ff @(posedge ch6clk)     hit6a[g] = (doutb[6].lines[g].tag==radrr[6][31:LOBIT]) && (vbito6a[g]==1'b1);
                always_ff @(posedge ch6clk)     hit6a[g] = (doutb[6].lines[g].tag==radrr[6][31:LOBIT]) && (vbito6a[g]==1'b1);
                always_ff @(posedge ch7clk)     hit7a[g] = (doutb[7].lines[g].tag==radrr[7][31:LOBIT]) && (vbito7a[g]==1'b1);
                always_ff @(posedge ch7clk)     hit7a[g] = (doutb[7].lines[g].tag==radrr[7][31:LOBIT]) && (vbito7a[g]==1'b1);
                always_ff @(posedge wclk)       hit8a[g] = (doutb[8].lines[g].tag==radrr[8][31:LOBIT]) && (vbito8a[g]==1'b1);
                always_ff @(posedge wclk)       hit8a[g] = (doutb[8].lines[g].tag==radrr[8][31:LOBIT]) && (vbito8a[g]==1'b1);
        end
        end
        always_comb ch0o.ack = (|hit0a & stb0) | (ch0wack & stb0);
        always_comb ch0hit = |hit0a & stb0;
        always_comb ch1o.ack = (|hit1a & stb1) | (ch1wack & stb1);
        always_comb ch1hit = |hit1a & stb1;
        always_comb ch2o.ack = (|hit2a & stb2) | (ch2wack & stb2);
        always_comb ch2hit = |hit2a & stb2;
        always_comb ch3o.ack = (|hit3a & stb3) | (ch3wack & stb3);
        always_comb ch3hit = |hit3a & stb3;
        always_comb ch4o.ack = (|hit4a & stb4) | (ch4wack & stb4);
        always_comb ch4hit = |hit4a & stb4;
        always_comb ch5o.ack = (|hit5a & stb5) | (ch5wack & stb5);
        always_comb ch5hit = |hit5a & stb5;
        always_comb ch6o.ack = (|hit6a & stb6) | (ch6wack & stb6);
        always_comb ch6hit = |hit6a & stb6;
        always_comb ch7o.ack = (|hit7a & stb7) | (ch7wack & stb7);
        always_comb ch7hit = |hit7a & stb7;
 
        always_comb ch0o.ack = (|hit0a && stb0 && (ch0i.cmd==CMD_LOAD||ch0i.cmd==CMD_LOADZ)) | (ch0wack & stb0);
 
        always_comb ch1o.ack = (|hit1a && stb1 && (ch1i.cmd==CMD_LOAD||ch1i.cmd==CMD_LOADZ)) | (ch1wack & stb1);
 
        always_comb ch2o.ack = (|hit2a && stb2 && (ch2i.cmd==CMD_LOAD||ch2i.cmd==CMD_LOADZ)) | (ch2wack & stb2);
 
        always_comb ch3o.ack = (|hit3a && stb3 && (ch3i.cmd==CMD_LOAD||ch3i.cmd==CMD_LOADZ)) | (ch3wack & stb3);
 
        always_comb ch4o.ack = (|hit4a && stb4 && (ch4i.cmd==CMD_LOAD||ch4i.cmd==CMD_LOADZ)) | (ch4wack & stb4);
 
        always_comb ch5o.ack = (|hit5a && stb5 && (ch5i.cmd==CMD_LOAD||ch5i.cmd==CMD_LOADZ)) | (ch5wack & stb5);
 
        always_comb ch6o.ack = (|hit6a && stb6 && (ch6i.cmd==CMD_LOAD||ch6i.cmd==CMD_LOADZ)) | (ch6wack & stb6);
 
        always_comb ch7o.ack = (|hit7a && stb7 && (ch7i.cmd==CMD_LOAD||ch7i.cmd==CMD_LOADZ)) | (ch7wack & stb7);
        always_comb ch0o.err = 1'b0;
        always_comb ch0o.err = 1'b0;
        always_comb ch1o.err = 1'b0;
        always_comb ch1o.err = 1'b0;
        always_comb ch2o.err = 1'b0;
        always_comb ch2o.err = 1'b0;
        always_comb ch3o.err = 1'b0;
        always_comb ch3o.err = 1'b0;
        always_comb ch4o.err = 1'b0;
        always_comb ch4o.err = 1'b0;
Line 335... Line 351...
        always_comb ch3o.cid = ch3i.cid;
        always_comb ch3o.cid = ch3i.cid;
        always_comb ch4o.cid = ch4i.cid;
        always_comb ch4o.cid = ch4i.cid;
        always_comb ch5o.cid = ch5i.cid;
        always_comb ch5o.cid = ch5i.cid;
        always_comb ch6o.cid = ch6i.cid;
        always_comb ch6o.cid = ch6i.cid;
        always_comb ch7o.cid = ch7i.cid;
        always_comb ch7o.cid = ch7i.cid;
 
        always_comb ch0o.tid = ch0i.tid;
 
        always_comb ch1o.tid = ch1i.tid;
 
        always_comb ch2o.tid = ch2i.tid;
 
        always_comb ch3o.tid = ch3i.tid;
 
        always_comb ch4o.tid = ch4i.tid;
 
        always_comb ch5o.tid = ch5i.tid;
 
        always_comb ch6o.tid = ch6i.tid;
 
        always_comb ch7o.tid = ch7i.tid;
end
end
endgenerate
endgenerate
 
 
always_comb wway = hit8a[0] ? 2'd0 : hit8a[1] ? 2'd1 : hit8a[2] ? 2'd2 : hit8a[3] ? 2'd3 : 2'd0;
always_comb wway = hit8a[0] ? 2'd0 : hit8a[1] ? 2'd1 : hit8a[2] ? 2'd2 : hit8a[3] ? 2'd3 : 2'd0;
 
 
Line 401... Line 425...
// due to a read miss. For a read miss the entire line is updated, otherwise
// due to a read miss. For a read miss the entire line is updated, otherwise
// just the part of the line relevant to the write is updated.
// just the part of the line relevant to the write is updated.
always_ff @(posedge wclk)
always_ff @(posedge wclk)
begin
begin
        if (ld.cyc)
        if (ld.cyc)
                wadr <= ld.adr;
                wadr <= ld.padr;
        else if (wchi.stb)
        else if (wchi.stb)
                wadr <= wchi.adr;
                wadr <= wchi.padr;
end
end
always_ff @(posedge wclk)
always_ff @(posedge wclk)
        wadr2 <= wadr;
        wadr2 <= wadr;
always_ff @(posedge wclk)
always_ff @(posedge wclk)
        lddat1 <= ld.dat;
        lddat1 <= ld.data1;
always_ff @(posedge wclk)
always_ff @(posedge wclk)
        lddat2 <= lddat1;
        lddat2 <= lddat1;
always_ff @(posedge wclk)
always_ff @(posedge wclk)
        wstrb <= ldcycd2 | (wchi_stb & |hit8a & wchi.we);
        wstrb <= ldcycd2 | (wchi_stb & |hit8a & wchi.we);
 
 

powered by: WebSVN 2.1.0

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