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

Subversion Repositories ao486

[/] [ao486/] [trunk/] [rtl/] [ao486/] [global_regs.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/*
2
 * Copyright (c) 2014, Aleksander Osman
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * * Redistributions of source code must retain the above copyright notice, this
9
 *   list of conditions and the following disclaimer.
10
 *
11
 * * Redistributions in binary form must reproduce the above copyright notice,
12
 *   this list of conditions and the following disclaimer in the documentation
13
 *   and/or other materials provided with the distribution.
14
 *
15
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
 */
26
 
27
`include "defines.v"
28
 
29
module global_regs(
30
    input               clk,
31
    input               rst_n,
32
 
33
    input               glob_param_1_set,
34
    input       [31:0]  glob_param_1_value,
35
 
36
    input               glob_param_2_set,
37
    input       [31:0]  glob_param_2_value,
38
 
39
    input               glob_param_3_set,
40
    input       [31:0]  glob_param_3_value,
41
 
42
    input               glob_param_4_set,
43
    input       [31:0]  glob_param_4_value,
44
 
45
    input               glob_param_5_set,
46
    input       [31:0]  glob_param_5_value,
47
 
48
    input               glob_descriptor_set,
49
    input       [63:0]  glob_descriptor_value,
50
 
51
    input               glob_descriptor_2_set,
52
    input       [63:0]  glob_descriptor_2_value,
53
 
54
    //output
55
    output reg  [31:0]  glob_param_1,
56
    output reg  [31:0]  glob_param_2,
57
    output reg  [31:0]  glob_param_3,
58
    output reg  [31:0]  glob_param_4,
59
    output reg  [31:0]  glob_param_5,
60
 
61
    output reg  [63:0]  glob_descriptor,
62
    output reg  [63:0]  glob_descriptor_2,
63
 
64
    output      [31:0]  glob_desc_base,
65
    output      [31:0]  glob_desc_limit,
66
    output      [31:0]  glob_desc_2_limit
67
);
68
 
69
//------------------------------------------------------------------------------
70
 
71
assign glob_desc_limit = glob_descriptor[`DESC_BIT_G]? { glob_descriptor[51:48], glob_descriptor[15:0], 12'hFFF } : { 12'd0, glob_descriptor[51:48], glob_descriptor[15:0] };
72
assign glob_desc_base  = { glob_descriptor[63:56], glob_descriptor[39:16] };
73
 
74
assign glob_desc_2_limit = glob_descriptor_2[`DESC_BIT_G]? { glob_descriptor_2[51:48], glob_descriptor_2[15:0], 12'hFFF } : { 12'd0, glob_descriptor_2[51:48], glob_descriptor_2[15:0] };
75
 
76
 
77
//------------------------------------------------------------------------------
78
 
79
always @(posedge clk or negedge rst_n) begin
80
    if(rst_n == 1'b0)           glob_param_1 <= 32'd0;
81
    else if(glob_param_1_set)   glob_param_1 <= glob_param_1_value;
82
end
83
 
84
always @(posedge clk or negedge rst_n) begin
85
    if(rst_n == 1'b0)           glob_param_2 <= 32'd0;
86
    else if(glob_param_2_set)   glob_param_2 <= glob_param_2_value;
87
end
88
 
89
always @(posedge clk or negedge rst_n) begin
90
    if(rst_n == 1'b0)           glob_param_3 <= 32'd0;
91
    else if(glob_param_3_set)   glob_param_3 <= glob_param_3_value;
92
end
93
 
94
always @(posedge clk or negedge rst_n) begin
95
    if(rst_n == 1'b0)           glob_param_4 <= 32'd0;
96
    else if(glob_param_4_set)   glob_param_4 <= glob_param_4_value;
97
end
98
 
99
always @(posedge clk or negedge rst_n) begin
100
    if(rst_n == 1'b0)           glob_param_5 <= 32'd0;
101
    else if(glob_param_5_set)   glob_param_5 <= glob_param_5_value;
102
end
103
 
104
always @(posedge clk or negedge rst_n) begin
105
    if(rst_n == 1'b0)               glob_descriptor <= 64'd0;
106
    else if(glob_descriptor_set)    glob_descriptor <= glob_descriptor_value;
107
end
108
 
109
always @(posedge clk or negedge rst_n) begin
110
    if(rst_n == 1'b0)               glob_descriptor_2 <= 64'd0;
111
    else if(glob_descriptor_2_set)  glob_descriptor_2 <= glob_descriptor_2_value;
112
end
113
 
114
//------------------------------------------------------------------------------
115
 
116
endmodule

powered by: WebSVN 2.1.0

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