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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [or1200/] [rtl/] [verilog/] [dc_fsm.v] - Diff between revs 161 and 168

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

Rev 161 Rev 168
Line 42... Line 42...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.1  2001/07/20 00:46:03  lampret
 
// Development version of RTL. Libraries are missing.
 
//
//
//
 
 
`include "general.h"
`include "timescale.v"
 
`include "defines.v"
 
 
`define DCFSM_IDLE      'd0
`define DCFSM_IDLE      'd0
`define DCFSM_DOLOAD    'd1
`define DCFSM_DOLOAD    'd1
`define DCFSM_LREFILL3  'd2
`define DCFSM_LREFILL3  'd2
`define DCFSM_DOSTORE   'd3
`define DCFSM_DOSTORE   'd3
`define DCFSM_SREFILL3  'd4
`define DCFSM_SREFILL3  'd4
`define DCFSM_SMEMWR    'd5
`define DCFSM_SMEMWR    'd5
 
 
 
//
// Data cache FSM for cache line of 16 bytes (4x singleword)
// Data cache FSM for cache line of 16 bytes (4x singleword)
 
//
 
 
module dc_fsm(clk, rst, lsu_op, miss, biudata_valid, start_addr, saved_addr, refill, refill_first, refill_prepare, dcram_we, biu_read, biu_write, refill_rest, cntrbusy);
module dc_fsm(
 
        // Clock and reset
 
        clk, rst,
 
 
 
        // Internal i/f to top level DC
 
        lsu_op, miss, biudata_valid, start_addr, saved_addr,
 
        refill, refill_first, refill_prepare, dcram_we,
 
        biu_read, biu_write, refill_rest, cntrbusy
 
);
 
 
 
//
 
// I/O
 
//
input clk;
input clk;
input rst;
input rst;
input miss;
input miss;
input biudata_valid;
input biudata_valid;
input [31:0] start_addr;
input [31:0] start_addr;
Line 73... Line 90...
output biu_read;
output biu_read;
output biu_write;
output biu_write;
output refill_rest;
output refill_rest;
output cntrbusy;
output cntrbusy;
 
 
 
//
 
// Internal wires and regs
 
//
wire dcache_off = 1'b0;
wire dcache_off = 1'b0;
 
 
reg [31:0] saved_addr;
reg [31:0] saved_addr;
reg refill;
reg refill;
 
 
reg [3:0] dcram_we;
reg [3:0] dcram_we;
reg [2:0] state;
reg [2:0] state;
reg [2:0] cnt;
reg [2:0] cnt;
reg refill_first;
reg refill_first;
reg refill_prepare;
reg refill_prepare;
reg biu_read;
reg biu_read;
reg biu_write;
reg biu_write;
reg refill_rest;
reg refill_rest;
reg cntrbusy;
reg cntrbusy;
 
 
 
//
 
// Generation of DCRAM write enable
 
//
always @(refill_first or refill or biudata_valid or lsu_op or start_addr or biu_write) begin
always @(refill_first or refill or biudata_valid or lsu_op or start_addr or biu_write) begin
        if (refill_first || !refill)
        if (refill_first || !refill)
                casex({lsu_op, start_addr[1:0]})
                casex({lsu_op, start_addr[1:0]})
                        {`LSUOP_SB, 2'b00} : dcram_we <= #1 4'b1000 ^ {4{refill_first}};
                        {`LSUOP_SB, 2'b00} : dcram_we <= #1 4'b1000 ^ {4{refill_first}};
                        {`LSUOP_SB, 2'b01} : dcram_we <= #1 4'b0100 ^ {4{refill_first}};
                        {`LSUOP_SB, 2'b01} : dcram_we <= #1 4'b0100 ^ {4{refill_first}};
Line 106... Line 127...
                endcase
                endcase
        else
        else
                dcram_we <= #1 {4{refill & biudata_valid & ~biu_write}};
                dcram_we <= #1 {4{refill & biudata_valid & ~biu_write}};
end
end
 
 
 
//
 
// Main DC FSM
 
//
always @(posedge clk or posedge rst) begin
always @(posedge clk or posedge rst) begin
        if (rst) begin
        if (rst) begin
                refill <= #1 1'b0;
                refill <= #1 1'b0;
                state <= #1 3`DCFSM_IDLE;
                state <= #1 3`DCFSM_IDLE;
                biu_read <= #1 1'b0;
                biu_read <= #1 1'b0;

powered by: WebSVN 2.1.0

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