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

Subversion Repositories thor

[/] [thor/] [trunk/] [rtl/] [verilog/] [Thor_icachemem.v] - Diff between revs 3 and 18

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

Rev 3 Rev 18
Line 1... Line 1...
// ============================================================================
// ============================================================================
//        __
//        __
//   \\__/ o\    (C) 2013,2015  Robert Finch, Stratford
//   \\__/ o\    (C) 2013-2016  Robert Finch, Stratford
//    \  __ /    All rights reserved.
//    \  __ /    All rights reserved.
//     \/_//     robfinch<remove>@finitron.ca
//     \/_//     robfinch<remove>@finitron.ca
//       ||
//       ||
//
//
// This source file is free software: you can redistribute it and/or modify 
// This source file is free software: you can redistribute it and/or modify 
Line 23... Line 23...
//
//
// ============================================================================
// ============================================================================
//
//
module Thor_icachemem(wclk, wce, wr, wa, wd, rclk, pc, insn);
module Thor_icachemem(wclk, wce, wr, wa, wd, rclk, pc, insn);
parameter DBW=64;
parameter DBW=64;
 
parameter ABW=32;
input wclk;
input wclk;
input wce;
input wce;
input wr;
input wr;
input [DBW-1:0] wa;
input [ABW-1:0] wa;
input [DBW-1:0] wd;
input [DBW-1:0] wd;
input rclk;
input rclk;
input [DBW-1:0] pc;
input [ABW-1:0] pc;
output reg [127:0] insn;
output reg [127:0] insn;
 
 
wire [127:0] mem0a;
wire [127:0] insn0;
wire [127:0] mem1a;
wire [127:0] insn1;
reg [14:0] pcp16;
 
 
 
generate
generate
begin : gen1
begin : cache_mem
        if (DBW==32) begin
        if (DBW==32) begin
        syncRam2kx32_1w1r uicm0a0 (
blk_mem_gen_0 uicm1 (
            .wclk(wclk),
  .clka(wclk),    // input wire clka
            .wce(wce && wa[3:2]==2'b00),
  .ena(wce),      // input wire ena
            .wr({4{wr}}),
  .wea(wr),      // input wire [0 : 0] wea
            .wa(wa[14:4]),
  .addra(wa[14:2]),  // input wire [14 : 0] addra
            .wd(wd),
  .dina(wd),    // input wire [31 : 0] dina
            .rclk(rclk),
  .clkb(rclk),    // input wire clkb
            .rce(1'b1),
  .enb(1'b1),
            .ra(pc[14:4]),
  .addrb(pc[14:4]),  // input wire [12 : 0] addrb
            .o(mem0a[31:0])
  .doutb(insn0)  // output wire [127 : 0] doutb
        );
 
        syncRam2kx32_1w1r uicm0a1 (
 
            .wclk(wclk),
 
            .wce(wce && wa[3:2]==2'b01),
 
            .wr({4{wr}}),
 
            .wa(wa[14:4]),
 
            .wd(wd),
 
            .rclk(rclk),
 
            .rce(1'b1),
 
            .ra(pc[14:4]),
 
            .o(mem0a[63:32])
 
        );
 
        syncRam2kx32_1w1r uicm0a2 (
 
            .wclk(wclk),
 
            .wce(wce && wa[3:2]==2'b10),
 
            .wr({4{wr}}),
 
            .wa(wa[14:4]),
 
            .wd(wd),
 
            .rclk(rclk),
 
            .rce(1'b1),
 
            .ra(pc[14:4]),
 
            .o(mem0a[95:64])
 
        );
 
        syncRam2kx32_1w1r uicm0a3 (
 
            .wclk(wclk),
 
            .wce(wce && wa[3:2]==2'b11),
 
            .wr({4{wr}}),
 
            .wa(wa[14:4]),
 
            .wd(wd),
 
            .rclk(rclk),
 
            .rce(1'b1),
 
            .ra(pc[14:4]),
 
            .o(mem0a[127:96])
 
        );
        );
 
 
        syncRam2kx32_1w1r uicm1a0 (
blk_mem_gen_0 uicm2 (
            .wclk(wclk),
  .clka(wclk),    // input wire clka
            .wce(wce && wa[3:2]==2'b00),
  .ena(wce),      // input wire ena
            .wr({4{wr}}),
  .wea(wr),      // input wire [0 : 0] wea
            .wa(wa[14:4]),
  .addra(wa[14:2]),  // input wire [14 : 0] addra
            .wd(wd),
  .dina(wd),    // input wire [31 : 0] dina
            .rclk(rclk),
  .clkb(rclk),    // input wire clkb
            .rce(1'b1),
  .enb(1'b1),
            .ra(pcp16[14:4]),
  .addrb(pc[14:4]+11'd1),  // input wire [12 : 0] addrb
            .o(mem1a[31:0])
  .doutb(insn1)  // output wire [127 : 0] doutb
        );
 
        syncRam2kx32_1w1r uicm1a1 (
 
            .wclk(wclk),
 
            .wce(wce && wa[3:2]==2'b01),
 
            .wr({4{wr}}),
 
            .wa(wa[14:4]),
 
            .wd(wd),
 
            .rclk(rclk),
 
            .rce(1'b1),
 
            .ra(pcp16[14:4]),
 
            .o(mem1a[63:32])
 
        );
        );
        syncRam2kx32_1w1r uicm1a2 (
end
            .wclk(wclk),
else begin
            .wce(wce && wa[3:2]==2'b10),
blk_mem_gen_1 uicm1 (
            .wr({4{wr}}),
  .clka(wclk),    // input wire clka
            .wa(wa[14:4]),
  .ena(wce),      // input wire ena
            .wd(wd),
  .wea(wr),      // input wire [0 : 0] wea
            .rclk(rclk),
  .addra(wa[14:3]),  // input wire [14 : 0] addra
            .rce(1'b1),
  .dina(wd),    // input wire [31 : 0] dina
            .ra(pcp16[14:4]),
  .clkb(rclk),    // input wire clkb
            .o(mem1a[95:64])
  .enb(1'b1),
 
  .addrb(pc[14:4]),  // input wire [12 : 0] addrb
 
  .doutb(insn0)  // output wire [127 : 0] doutb
        );
        );
        syncRam2kx32_1w1r uicm1a3 (
 
            .wclk(wclk),
blk_mem_gen_1 uicm2 (
            .wce(wce && wa[3:2]==2'b11),
  .clka(wclk),    // input wire clka
            .wr({4{wr}}),
  .ena(wce),      // input wire ena
            .wa(wa[14:4]),
  .wea(wr),      // input wire [0 : 0] wea
            .wd(wd),
  .addra(wa[14:3]),  // input wire [14 : 0] addra
            .rclk(rclk),
  .dina(wd),    // input wire [31 : 0] dina
            .rce(1'b1),
  .clkb(rclk),    // input wire clkb
            .ra(pcp16[14:4]),
  .enb(1'b1),
            .o(mem1a[127:96])
  .addrb(pc[14:4]+11'd1),  // input wire [12 : 0] addrb
 
  .doutb(insn1)  // output wire [127 : 0] doutb
        );
        );
    end
    end
 
 
end
end
endgenerate
endgenerate
 
 
always @(pc)
 
        pcp16 <= pc[14:0] + 15'd16;
 
wire [127:0] insn0 = mem0a;
 
wire [127:0] insn1 = mem1a;
 
always @(pc or insn0 or insn1)
always @(pc or insn0 or insn1)
case(pc[3:0])
case(pc[3:0])
4'd0:   insn <= insn0;
4'd0:   insn <= insn0;
4'd1:   insn <= {insn1[7:0],insn0[127:8]};
4'd1:   insn <= {insn1[7:0],insn0[127:8]};
4'd2:   insn <= {insn1[15:0],insn0[127:16]};
4'd2:   insn <= {insn1[15:0],insn0[127:16]};

powered by: WebSVN 2.1.0

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