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

Subversion Repositories yifive

[/] [yifive/] [trunk/] [caravel_yifive/] [verilog/] [dv/] [io_ports/] [mgmt_core.sv] - Blame information for rev 22

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 dinesha
// SPDX-FileCopyrightText: 2020 Efabless Corporation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
// SPDX-License-Identifier: Apache-2.0
15
 
16
`default_nettype none
17
module mgmt_core (
18
`ifdef USE_POWER_PINS
19
        inout VPWR,
20
        inout VGND,
21
`endif
22
        // GPIO (dedicated pad)
23
        output gpio_out_pad,            // Connect to out on gpio pad
24
        input  gpio_in_pad,             // Connect to in on gpio pad
25
        output gpio_mode0_pad,          // Connect to dm[0] on gpio pad
26
        output gpio_mode1_pad,          // Connect to dm[2] on gpio pad
27
        output gpio_outenb_pad,         // Connect to oe_n on gpio pad
28
        output gpio_inenb_pad,          // Connect to inp_dis on gpio pad
29
        // Flash memory control (SPI master)
30
        output flash_csb,
31
        output flash_clk,
32
        output flash_csb_oeb,
33
        output flash_clk_oeb,
34
        output flash_io0_oeb,
35
        output flash_io1_oeb,
36
        output flash_io2_oeb,   // through GPIO 36
37
        output flash_io3_oeb,   // through GPIO 37
38
        output flash_csb_ieb,
39
        output flash_clk_ieb,
40
        output flash_io0_ieb,
41
        output flash_io1_ieb,
42
        output flash_io0_do,
43
        output flash_io1_do,
44
        output flash_io2_do,    // through GPIO 36
45
        output flash_io3_do,    // through GPIO 37
46
        input flash_io0_di,
47
        input flash_io1_di,
48
        // Master reset
49
        input resetb,
50
        input porb,
51
        // Clocking
52
        input clock,
53
        // LA signals
54
        input  [127:0] la_input,                // From User Project to cpu
55
        output [127:0] la_output,               // From CPU to User Project
56
        output [127:0] la_oenb,                 // LA output enable
57
        output [127:0] la_iena,                 // LA input enable
58
        // Housekeeping SPI
59
        output sdo_out,
60
        output sdo_outenb,
61
        // JTAG
62
        output jtag_out,
63
        output jtag_outenb,
64
        // User Project Control Signals
65
        input [`MPRJ_IO_PADS-1:0] mgmt_in_data,
66
        output [`MPRJ_IO_PADS-1:0] mgmt_out_data,
67
        output [`MPRJ_PWR_PADS-1:0] pwr_ctrl_out,
68
        input mprj_vcc_pwrgood,
69
        input mprj2_vcc_pwrgood,
70
        input mprj_vdd_pwrgood,
71
        input mprj2_vdd_pwrgood,
72
        output mprj_io_loader_resetn,
73
        output mprj_io_loader_clock,
74
        output mprj_io_loader_data_1,
75
        output mprj_io_loader_data_2,
76
        // WB MI A (User project)
77
        input mprj_ack_i,
78
        input [31:0] mprj_dat_i,
79
        output mprj_cyc_o,
80
        output mprj_stb_o,
81
        output mprj_we_o,
82
        output [3:0] mprj_sel_o,
83
        output [31:0] mprj_adr_o,
84
        output [31:0] mprj_dat_o,
85
 
86
        output core_clk,
87
        output user_clk,
88
        output core_rstn,
89
        input [2:0] user_irq,
90
        output [2:0] user_irq_ena,
91
 
92
        // Metal programmed user ID / mask revision vector
93
        input [31:0] mask_rev,
94
 
95
    // MGMT area R/W interface for mgmt RAM
96
    output [`RAM_BLOCKS-1:0] mgmt_ena,
97
    output [(`RAM_BLOCKS*4)-1:0] mgmt_wen_mask,
98
    output [`RAM_BLOCKS-1:0] mgmt_wen,
99
    output [7:0] mgmt_addr,
100
    output [31:0] mgmt_wdata,
101
    input  [(`RAM_BLOCKS*32)-1:0] mgmt_rdata,
102
 
103
    // MGMT area RO interface for user RAM
104
    output mgmt_ena_ro,
105
    output [7:0] mgmt_addr_ro,
106
    input  [31:0] mgmt_rdata_ro
107
);
108
        wire ext_clk_sel;
109
        wire pll_clk, pll_clk90;
110
        wire ext_reset;
111
        wire hk_connect;
112
        wire trap;
113
        wire irq_spi;
114
 
115
        // JTAG (to be implemented)
116
        wire jtag_out;
117
        wire jtag_out_pre = 1'b0;
118
        wire jtag_outenb = 1'b1;
119
        wire jtag_oenb_state;
120
 
121
        // SDO
122
        wire sdo_out;
123
        wire sdo_out_pre;
124
        wire sdo_oenb_state;
125
 
126
        // Housekeeping SPI vectors
127
        wire [4:0]  spi_pll_div;
128
        wire [2:0]  spi_pll_sel;
129
        wire [2:0]  spi_pll90_sel;
130
        wire [25:0] spi_pll_trim;
131
 
132
        // Override default function for SDO and JTAG outputs if purposely
133
        // set for override by the management SoC.
134
        assign sdo_out = (sdo_oenb_state == 1'b0) ? mgmt_out_data[1] : sdo_out_pre;
135
        assign jtag_out = (jtag_oenb_state == 1'b0) ? mgmt_out_data[0] : jtag_out_pre;
136
 
137
        caravel_clocking clocking1(
138
                .ext_clk_sel(ext_clk_sel),
139
                .ext_clk(clock),
140
                .pll_clk(pll_clk),
141
                .pll_clk90(pll_clk90),
142
                .resetb(resetb),
143
                .sel(spi_pll_sel),
144
                .sel2(spi_pll90_sel),
145
                .ext_reset(ext_reset),  // From housekeeping SPI
146
                .core_clk(core_clk),
147
                .user_clk(user_clk),
148
                .resetb_sync(core_rstn)
149
        );
150
 
151
 
152
endmodule
153
`default_nettype wire

powered by: WebSVN 2.1.0

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