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

Subversion Repositories blue

[/] [blue/] [trunk/] [blue8/] [gpreg.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 wd5gnr
/*
2
    This file is part of Blue8.
3
 
4
    Foobar is free software: you can redistribute it and/or modify
5
    it under the terms of the GNU Lesser General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
8
 
9
    Foobar is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU Lesser General Public License for more details.
13
 
14
    You should have received a copy of the GNU Lesser General Public License
15
    along with Blue8.  If not, see <http://www.gnu.org/licenses/>.
16
 
17
    Blue8 by Al Williams alw@al-williams.com
18
*/
19
 
20
`timescale 1ns / 1ps
21
////////////////////////////////////////////////////////////////////////////////
22
// Company: 
23
// Engineer:
24
//
25
// Create Date:    22:15:16 01/11/06
26
// Design Name:    
27
// Module Name:    gpreg
28
// Project Name:   
29
// Target Device:  
30
// Tool versions:  
31
// Description:
32
//
33
// Dependencies:
34
// 
35
// Revision:
36
// Revision 0.01 - File Created
37
// Additional Comments:
38
// 
39
////////////////////////////////////////////////////////////////////////////////
40
module gpreg(input clk, input wire [15:0] din, output wire [15:0] dout, input wire [3:0] wselect,
41
   input wire [3:0] sendselect, input wire write, input wire send,
42
        output wire awrite, output wire asend, output wire pwrite, output wire psend);
43
 
44
   reg [15:0] values[11];
45
 
46
 
47
        assign awrite=write & (wselect==4'h4);
48
        assign asend=send & (sendselect==4'h4);
49
        assign pwrite=write & (wselect==4'h3);
50
        assign psend= send & (sendselect==4'h3);
51
 
52
   // put a case here for write
53
        always @(posedge clk) begin
54
          if (write) begin
55
            case (wselect) begin
56
                 4'b0101: values[0]<=din;
57
                 4'b0110: values[1]<=din;
58
                 4'b0111: values[2]<=din;
59
                 4'b1000: values[3]<=din;
60
                 4'b1001: values[4]<=din;
61
                 4'b1010: values[5]<=din;
62
                 4'b1011: values[6]<=din;
63
                 4'b1100: values[7]<=din;
64
                 4'b1101: values[8]<=din;
65
                 4'b1110: values[9]<=din;
66
                 4'b1111: values[10]<=din;
67
                 default: ;
68
                 end
69
          end
70
        end
71
        // put a case here for send
72
        always @(posedge clk) begin
73
          if (send) begin
74
            case (sendselect) begin
75
                 4'b0101: dout<=values[0];
76
                 4'b0110: dout<=values[1];
77
                 4'b0111: dout<=values[2];
78
                 4'b1000: dout<=values[3];
79
                 4'b1001: dout<=values[4];
80
                 4'b1010: dout<=values[5];
81
                 4'b1011: dout<=values[6];
82
                 4'b1100: dout<=values[7];
83
                 4'b1101: dout<=values[8];
84
                 4'b1110: dout<=values[9];
85
                 4'b1111: dout<=values[10];
86
                 default: dout<=16'bz;
87
                 end
88
          end
89
        end
90
 
91
 
92
 
93
endmodule

powered by: WebSVN 2.1.0

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