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

Subversion Repositories microriscii

[/] [microriscii/] [trunk/] [verilog/] [rtl/] [regfile.v] - Blame information for rev 17

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 alikat
//--------------------------------------------------------------------------------------------------
2
//
3
// Title       : regfile
4
// Design      : MicroRISCII
5
// Author      : Ali Mashtizadeh
6
//
7
//-------------------------------------------------------------------------------------------------
8
`timescale 1ps / 1ps
9
 
10
module regfile(a,a_sel,b,b_sel,clk,d,d_sel,dwe);
11
        // Inputs
12
        input   [3:0]    a_sel;
13
        wire    [3:0]    a_sel;
14
        input   [3:0]    b_sel;
15
        wire    [3:0]    b_sel;
16
        input                   clk;
17
        wire                    clk;
18
        input   [31:0]   d;
19
        wire    [31:0]   d;
20
        input   [3:0]    d_sel;
21
        wire    [3:0]    d_sel;
22
        input                   dwe;
23
        wire                    dwe;
24
        // Outputs
25
        output  [31:0]   a;
26
        reg             [31:0]   a;
27
        output  [31:0]   b;
28
        reg             [31:0]   b;
29
        // Internal
30
        reg             [31:0]   regs[15:0];
31
 
32
        always @ (clk || a_sel || b_sel)
33
                if (clk == 1'b0)
34
                        begin
35
                                a = regs[a_sel];
36
                                b = regs[b_sel];
37
                        end
38
 
39
        always @ (clk)
40
                if (clk == 1'b1)
41
                        if (dwe == 1'b1)
42
                                regs[d_sel] = d;
43
 
44
endmodule

powered by: WebSVN 2.1.0

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