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

Subversion Repositories or1k

[/] [or1k/] [branches/] [mp3_stable/] [or1200/] [rtl/] [verilog/] [reg2mem.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:21  lampret
 
// Development version of RTL. Libraries are missing.
 
//
//
//
 
 
`include "general.h"
`include "timescale.v"
 
`include "defines.v"
 
 
module reg2mem(addr, lsu_op, regdata, memdata);
module reg2mem(addr, lsu_op, regdata, memdata);
 
 
parameter width = `OPERAND_WIDTH;
parameter width = `OPERAND_WIDTH;
 
 
 
//
 
// I/O
 
//
input [1:0] addr;
input [1:0] addr;
input [`LSUOP_WIDTH-1:0] lsu_op;
input [`LSUOP_WIDTH-1:0] lsu_op;
input [width-1:0] regdata;
input [width-1:0] regdata;
 
 
output [width-1:0] memdata;
output [width-1:0] memdata;
 
 
 
//
 
// Internal regs and wires
 
//
reg [width-1:0] memdata;
reg [width-1:0] memdata;
 
 
 
//
// Mux to memdata[31:24]
// Mux to memdata[31:24]
 
//
always @(lsu_op or addr or regdata) begin
always @(lsu_op or addr or regdata) begin
        casex({lsu_op, addr[1:0]})       // synopsys full_case parallel_case
        casex({lsu_op, addr[1:0]})       // synopsys full_case parallel_case
                {`LSUOP_SB, 2'b00} : memdata[31:24] <= #1 regdata[7:0];
                {`LSUOP_SB, 2'b00} : memdata[31:24] <= #1 regdata[7:0];
                {`LSUOP_SH, 2'b00} : memdata[31:24] <= #1 regdata[15:8];
                {`LSUOP_SH, 2'b00} : memdata[31:24] <= #1 regdata[15:8];
                default : memdata[31:24] <= #1 regdata[31:24];
                default : memdata[31:24] <= #1 regdata[31:24];
        endcase
        endcase
end
end
 
 
 
//
// Mux to memdata[23:16]
// Mux to memdata[23:16]
 
//
always @(lsu_op or addr or regdata) begin
always @(lsu_op or addr or regdata) begin
        casex({lsu_op, addr[1:0]})       // synopsys full_case parallel_case
        casex({lsu_op, addr[1:0]})       // synopsys full_case parallel_case
                {`LSUOP_SW, 2'b00} : memdata[23:16] <= #1 regdata[23:16];
                {`LSUOP_SW, 2'b00} : memdata[23:16] <= #1 regdata[23:16];
                default : memdata[23:16] <= #1 regdata[7:0];
                default : memdata[23:16] <= #1 regdata[7:0];
        endcase
        endcase
end
end
 
 
 
//
// Mux to memdata[15:8]
// Mux to memdata[15:8]
 
//
always @(lsu_op or addr or regdata) begin
always @(lsu_op or addr or regdata) begin
        casex({lsu_op, addr[1:0]})       // synopsys full_case parallel_case
        casex({lsu_op, addr[1:0]})       // synopsys full_case parallel_case
                {`LSUOP_SB, 2'b10} : memdata[15:8] <= #1 regdata[7:0];
                {`LSUOP_SB, 2'b10} : memdata[15:8] <= #1 regdata[7:0];
                default : memdata[15:8] <= #1 regdata[15:8];
                default : memdata[15:8] <= #1 regdata[15:8];
        endcase
        endcase
end
end
 
 
 
//
// Mux to memdata[7:0]
// Mux to memdata[7:0]
 
//
always @(regdata)
always @(regdata)
        memdata[7:0] <= #1 regdata[7:0];
        memdata[7:0] <= #1 regdata[7:0];
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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