Implemented a system for setting the GPIO power-on defaults through

via programming.  The values for each of the GPIOs at power-up are
defined in the "user_defines.v" file.  For the verilog, they are
applied as parameters.  For the layout, they will need to be
separately defined cells for each of the GPIOs, or at least for
each set of unique default values.
This commit is contained in:
Tim Edwards 2021-10-23 17:18:30 -04:00
parent a8ccbf2890
commit e5c90daddd
7 changed files with 557 additions and 88 deletions

View File

@ -21,6 +21,7 @@
`ifdef SIM
`include "defines.v"
`include "user_defines.v"
`include "pads.v"
/* NOTE: Need to pass the PDK root directory to iverilog with option -I */
@ -61,6 +62,7 @@
`include "gl/mgmt_protect_hv.v"
`include "gl/gpio_logic_high.v"
`include "gl/gpio_control_block.v"
`include "gl/gpio_defaults_block.v"
`include "gl/sky130_fd_sc_hvl__lsbufhv2lv_1_wrapped.v"
`include "gl/caravan.v"
`else
@ -82,6 +84,7 @@
`include "mgmt_protect.v"
`include "mgmt_protect_hv.v"
`include "gpio_control_block.v"
`include "gpio_defaults_block.v"
`include "gpio_logic_high.v"
`include "sky130_fd_sc_hvl__lsbufhv2lv_1_wrapped.v"
`include "caravan.v"

View File

@ -355,7 +355,7 @@ module caravel (
wire hkspi_sram_clk;
wire hkspi_sram_csb;
wire [7:0] hkspi_sram_addr;
wire [31:0] hkspi_sram_rdata;
wire [31:0] hkspi_sram_data;
// Management processor (wrapper). Any management core
// implementation must match this pinout.
@ -441,7 +441,7 @@ module caravel (
.sram_ro_clk(hkspi_sram_clk),
.sram_ro_csb(hkspi_sram_csb),
.sram_ro_addr(hkspi_sram_addr),
.sram_ro_data(hkspi_sram_rdata),
.sram_ro_data(hkspi_sram_data),
// Trap status
.trap(trap)
@ -720,7 +720,7 @@ module caravel (
.sram_ro_clk(hkspi_sram_clk),
.sram_ro_csb(hkspi_sram_csb),
.sram_ro_addr(hkspi_sram_addr),
.sram_ro_data(hkspi_sram_rdata),
.sram_ro_data(hkspi_sram_data),
.usr1_vcc_pwrgood(mprj_vcc_pwrgood),
.usr2_vcc_pwrgood(mprj2_vcc_pwrgood),
@ -728,6 +728,363 @@ module caravel (
.usr2_vdd_pwrgood(mprj2_vdd_pwrgood)
);
/* GPIO defaults (via programmed) */
wire [`MPRJ_IO_PADS*13-1:0] gpio_defaults;
/* Fixed defaults for the first 5 GPIO pins */
gpio_defaults_block #(
.GPIO_CONFIG_INIT(13'h1803)
) gpio_01_defaults [1:0] (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[25:0])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(13'h0403)
) gpio_234_defaults [2:0] (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[64:26])
);
/* Via-programmable defaults for the rest of the GPIO pins */
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_5_INIT)
) gpio_5_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[77:65])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_6_INIT)
) gpio_6_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[90:78])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_7_INIT)
) gpio_7_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[103:91])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_8_INIT)
) gpio_8_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[116:104])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_9_INIT)
) gpio_9_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[129:117])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_10_INIT)
) gpio_10_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[142:130])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_11_INIT)
) gpio_11_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[155:143])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_12_INIT)
) gpio_12_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[168:156])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_13_INIT)
) gpio_13_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[181:169])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_14_INIT)
) gpio_14_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[194:182])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_15_INIT)
) gpio_15_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[207:195])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_16_INIT)
) gpio_16_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[220:208])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_17_INIT)
) gpio_17_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[233:221])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_18_INIT)
) gpio_18_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[246:234])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_19_INIT)
) gpio_19_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[259:247])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_20_INIT)
) gpio_20_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[272:260])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_21_INIT)
) gpio_21_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[285:273])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_22_INIT)
) gpio_22_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[298:286])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_23_INIT)
) gpio_23_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[311:299])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_24_INIT)
) gpio_24_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[324:312])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_25_INIT)
) gpio_25_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[337:325])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_26_INIT)
) gpio_26_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[350:338])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_27_INIT)
) gpio_27_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[363:351])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_28_INIT)
) gpio_28_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[376:364])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_29_INIT)
) gpio_29_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[389:377])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_30_INIT)
) gpio_30_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[402:390])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_31_INIT)
) gpio_31_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[415:403])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_32_INIT)
) gpio_32_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[428:416])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_33_INIT)
) gpio_33_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[441:429])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_34_INIT)
) gpio_34_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[454:442])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_35_INIT)
) gpio_35_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[467:455])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_36_INIT)
) gpio_36_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[480:468])
);
gpio_defaults_block #(
.GPIO_CONFIG_INIT(`USER_CONFIG_GPIO_37_INIT)
) gpio_37_defaults (
`ifdef USE_POWER_PINS
.VPWR(vccd_core),
.VGND(vssd_core),
`endif
.gpio_defaults(gpio_defaults[493:481])
);
// Each control block sits next to an I/O pad in the user area.
// It gets input through a serial chain from the previous control
// block and passes it to the next control block. Due to the nature
@ -743,18 +1100,17 @@ module caravel (
// of the extra signals those pads need.
/* First two GPIOs (JTAG and SDO) */
gpio_control_block #(
.MGMT_INIT(1'b1), // Management-controlled
.OENB_INIT(1'b1), // Output controlled from bidirectional pin
.DM_INIT(3'b110) // Mode is set to ouput, no pullup/pulldown
) gpio_control_bidir_1 [1:0] (
gpio_control_block gpio_control_bidir_1 [1:0] (
`ifdef USE_POWER_PINS
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
`endif
.gpio_defaults(gpio_defaults[25:0]),
// Management Soc-facing signals
.resetn(gpio_resetn_1_shifted[1:0]),
@ -797,18 +1153,17 @@ module caravel (
/* Section 1 GPIOs (GPIO 0 to 18) */
wire [`MPRJ_IO_PADS_1-1:2] one_loop1;
/* Section 1 GPIOs (GPIO 3 to 7) that start up under management control */
/* Section 1 GPIOs (GPIO 2 to 7) that start up under management control */
gpio_control_block #(
.MGMT_INIT(1'b1), // Management-controlled
.OENB_INIT(1'b1) // Output disabled
) gpio_control_in_1a [5:0] (
`ifdef USE_POWER_PINS
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
`endif
gpio_control_block gpio_control_in_1a [5:0] (
`ifdef USE_POWER_PINS
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
`endif
.gpio_defaults(gpio_defaults[103:26]),
// Management Soc-facing signals
@ -852,12 +1207,14 @@ module caravel (
/* Section 1 GPIOs (GPIO 8 to 18) */
gpio_control_block gpio_control_in_1 [`MPRJ_IO_PADS_1-9:0] (
`ifdef USE_POWER_PINS
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
`endif
`ifdef USE_POWER_PINS
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
`endif
.gpio_defaults(gpio_defaults[(`MPRJ_IO_PADS_1*13-1):104]),
// Management Soc-facing signals
@ -898,19 +1255,18 @@ module caravel (
.pad_gpio_in(mprj_io_in[(`MPRJ_IO_PADS_1-1):8])
);
/* Last three GPIOs (spi_sdo, flash_io2, and flash_io3) */
gpio_control_block #(
.MGMT_INIT(1'b1), // Management-controlled
.OENB_INIT(1'b1) // Output controlled from bidirectional pin
) gpio_control_bidir_2 [2:0] (
gpio_control_block gpio_control_bidir_2 [2:0] (
`ifdef USE_POWER_PINS
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
`endif
.gpio_defaults(gpio_defaults[(`MPRJ_IO_PADS*13-1):(`MPRJ_IO_PADS*13-39)]),
// Management Soc-facing signals
.resetn(gpio_resetn_1_shifted[(`MPRJ_IO_PADS_2-1):(`MPRJ_IO_PADS_2-3)]),
@ -952,14 +1308,17 @@ module caravel (
/* Section 2 GPIOs (GPIO 19 to 34) */
wire [`MPRJ_IO_PADS_2-4:0] one_loop2;
gpio_control_block gpio_control_in_2 [`MPRJ_IO_PADS_2-4:0] (
`ifdef USE_POWER_PINS
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
.vccd(vccd_core),
.vssd(vssd_core),
.vccd1(vccd1_core),
.vssd1(vssd1_core),
`endif
.gpio_defaults(gpio_defaults[(`MPRJ_IO_PADS*13-40):(`MPRJ_IO_PADS_1*13)]),
// Management Soc-facing signals
.resetn(gpio_resetn_1_shifted[(`MPRJ_IO_PADS_2-4):0]),

View File

@ -21,6 +21,7 @@
`ifdef SIM
`include "defines.v"
`include "user_defines.v"
`include "pads.v"
/* NOTE: Need to pass the PDK root directory to iverilog with option -I */
@ -57,6 +58,7 @@
`include "gl/mgmt_protect.v"
`include "gl/mgmt_protect_hv.v"
`include "gl/gpio_control_block.v"
`include "gl/gpio_defaults_block.v"
`include "gl/gpio_logic_high.v"
`include "gl/sky130_fd_sc_hvl__lsbufhv2lv_1_wrapped.v"
`include "gl/caravel.v"
@ -75,6 +77,7 @@
`include "mgmt_protect.v"
`include "mgmt_protect_hv.v"
`include "gpio_control_block.v"
`include "gpio_defaults_block.v"
`include "gpio_logic_high.v"
`include "sky130_fd_sc_hvl__lsbufhv2lv_1_wrapped.v"
`include "mgmt_core_wrapper.v"

View File

@ -43,22 +43,7 @@
*/
module gpio_control_block #(
parameter PAD_CTRL_BITS = 13,
// Parameterized initial startup state of the pad.
// The default parameters if unspecified is for the pad to be
// an input with no pull-up or pull-down, so that it is disconnected
// from the outside world.
parameter MGMT_INIT = 1'b1,
parameter HOLD_INIT = 1'b0,
parameter SLOW_INIT = 1'b0,
parameter TRIP_INIT = 1'b0,
parameter IB_INIT = 1'b0,
parameter IENB_INIT = 1'b0,
parameter OENB_INIT = `OENB_INIT,
parameter DM_INIT = `DM_INIT,
parameter AENA_INIT = 1'b0,
parameter ASEL_INIT = 1'b0,
parameter APOL_INIT = 1'b0
parameter PAD_CTRL_BITS = 13
) (
`ifdef USE_POWER_PINS
inout vccd,
@ -67,10 +52,13 @@ module gpio_control_block #(
inout vssd1,
`endif
// Power-on defaults
input [PAD_CTRL_BITS-1:0] gpio_defaults,
// Management Soc-facing signals
input resetn, // Global reset, locally propagated
input resetn, // Global reset, locally propagated
output resetn_out,
input serial_clock, // Global clock, locally propatated
input serial_clock, // Global clock, locally propatated
output serial_clock_out,
output mgmt_gpio_in, // Management from pad (input only)
@ -181,18 +169,18 @@ module gpio_control_block #(
always @(posedge load_data or posedge int_reset) begin
if (int_reset == 1'b1) begin
/* Initial state on reset: Pad set to management input */
mgmt_ena <= MGMT_INIT; // Management SoC has control over all I/O
gpio_holdover <= HOLD_INIT; // All signals latched in hold mode
gpio_slow_sel <= SLOW_INIT; // Fast slew rate
gpio_vtrip_sel <= TRIP_INIT; // CMOS mode
gpio_ib_mode_sel <= IB_INIT; // CMOS mode
gpio_inenb <= IENB_INIT; // Input enabled
gpio_outenb <= OENB_INIT; // (unused placeholder)
gpio_dm <= DM_INIT; // Configured as input only
gpio_ana_en <= AENA_INIT; // Digital enabled
gpio_ana_sel <= ASEL_INIT; // Don't-care when gpio_ana_en = 0
gpio_ana_pol <= APOL_INIT; // Don't-care when gpio_ana_en = 0
/* Initial state on reset depends on applied defaults */
mgmt_ena <= gpio_defaults[MGMT_EN];
gpio_holdover <= gpio_defaults[HLDH];
gpio_slow_sel <= gpio_defaults[SLOW];
gpio_vtrip_sel <= gpio_defaults[TRIP];
gpio_ib_mode_sel <= gpio_defaults[MOD_SEL];
gpio_inenb <= gpio_defaults[INP_DIS];
gpio_outenb <= gpio_defaults[OEB];
gpio_dm <= gpio_defaults[DM+2:DM];
gpio_ana_en <= gpio_defaults[AN_EN];
gpio_ana_sel <= gpio_defaults[AN_SEL];
gpio_ana_pol <= gpio_defaults[AN_POL];
end else begin
/* Load data */
mgmt_ena <= shift_register[MGMT_EN];
@ -225,22 +213,14 @@ module gpio_control_block #(
/* Implement pad control behavior depending on state of mgmt_ena */
// assign gpio_in_unbuf = (mgmt_ena) ? 1'b0 : pad_gpio_in;
// assign mgmt_gpio_in = (mgmt_ena) ? ((gpio_inenb == 1'b0) ?
// pad_gpio_in : 1'bz) : 1'b0;
assign gpio_in_unbuf = pad_gpio_in;
// This causes conflict if output and input drivers are both enabled. . .
// assign mgmt_gpio_in = (gpio_inenb == 1'b0) ? pad_gpio_in : 1'bz;
assign mgmt_gpio_in = (gpio_inenb == 1'b0 && gpio_outenb == 1'b1)? pad_gpio_in : 1'bz;
assign pad_gpio_outenb = (mgmt_ena) ? ((mgmt_gpio_oeb == 1'b1) ? gpio_outenb :
1'b0) : user_gpio_oeb;
assign pad_gpio_out = (mgmt_ena) ?
((mgmt_gpio_oeb == 1'b1) ?
assign gpio_in_unbuf = pad_gpio_in;
assign mgmt_gpio_in = (gpio_inenb == 1'b0 && gpio_outenb == 1'b1) ?
pad_gpio_in : 1'bz;
assign pad_gpio_outenb = (mgmt_ena) ? ((mgmt_gpio_oeb == 1'b1) ?
gpio_outenb : 1'b0) : user_gpio_oeb;
assign pad_gpio_out = (mgmt_ena) ? ((mgmt_gpio_oeb == 1'b1) ?
((gpio_dm[2:1] == 2'b01) ? ~gpio_dm[0] : mgmt_gpio_out) :
mgmt_gpio_out) :
user_gpio_out;
mgmt_gpio_out) : user_gpio_out;
/* Buffer user_gpio_in with an enable that is set by the user domain vccd */

View File

@ -0,0 +1,63 @@
// SPDX-FileCopyrightText: 2020 Efabless Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// SPDX-License-Identifier: Apache-2.0
`default_nettype none
// This module represents an unprogrammed set of GPIO pad default
// values that is configured with via programming on the chip top
// level. This value is passed as a set of parameters (formerly
// part of gpio_control_block.v).
module gpio_defaults_block #(
// Parameterized initial startup state of the pad. The default
// parameters if unspecified is for the pad to be a user input
// with no pull-up or pull-down, so that it is disconnected
// from the outside world. See defs.h for configuration word
// definitions.
parameter GPIO_CONFIG_INIT = 13'h0402
) (
`ifdef USE_POWER_PINS
inout VPWR,
inout VGND,
`endif
output [12:0] gpio_defaults
);
wire [12:0] gpio_defaults;
wire [12:0] gpio_defaults_high;
wire [12:0] gpio_defaults_low;
// For the mask revision input, use an array of digital constant logic cells
sky130_fd_sc_hd__conb_1 gpio_default_value [12:0] (
`ifdef USE_POWER_PINS
.VPWR(VPWR),
.VPB(VPWR),
.VNB(VGND),
.VGND(VGND),
`endif
.HI(gpio_defaults_high),
.LO(gpio_defaults_low)
);
genvar i;
generate
for (i = 0; i < 13; i = i+1) begin
assign gpio_defaults[i] = (GPIO_CONFIG_INIT & (13'h0001 << i)) ?
gpio_defaults_high[i] : gpio_defaults_low[i];
end
endgenerate
endmodule
`default_nettype wire

View File

@ -0,0 +1,61 @@
// SPDX-FileCopyrightText: 2020 Efabless Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// SPDX-License-Identifier: Apache-2.0
`default_nettype none
`ifndef __USER_DEFINE_H
// User GPIO initial configuration parameters
`define __USER_DEFINE_H
`define USER_CONFIG_GPIO_0_INIT 13'h0403
`define USER_CONFIG_GPIO_1_INIT 13'h0403
`define USER_CONFIG_GPIO_2_INIT 13'h0403
`define USER_CONFIG_GPIO_3_INIT 13'h0403
`define USER_CONFIG_GPIO_4_INIT 13'h0403
`define USER_CONFIG_GPIO_5_INIT 13'h0403
`define USER_CONFIG_GPIO_6_INIT 13'h0403
`define USER_CONFIG_GPIO_7_INIT 13'h0403
`define USER_CONFIG_GPIO_8_INIT 13'h0403
`define USER_CONFIG_GPIO_9_INIT 13'h0403
`define USER_CONFIG_GPIO_10_INIT 13'h0403
`define USER_CONFIG_GPIO_11_INIT 13'h0403
`define USER_CONFIG_GPIO_12_INIT 13'h0403
`define USER_CONFIG_GPIO_13_INIT 13'h0403
`define USER_CONFIG_GPIO_14_INIT 13'h0403
`define USER_CONFIG_GPIO_15_INIT 13'h0403
`define USER_CONFIG_GPIO_16_INIT 13'h0403
`define USER_CONFIG_GPIO_17_INIT 13'h0403
`define USER_CONFIG_GPIO_18_INIT 13'h0403
`define USER_CONFIG_GPIO_19_INIT 13'h0403
`define USER_CONFIG_GPIO_20_INIT 13'h0403
`define USER_CONFIG_GPIO_21_INIT 13'h0403
`define USER_CONFIG_GPIO_22_INIT 13'h0403
`define USER_CONFIG_GPIO_23_INIT 13'h0403
`define USER_CONFIG_GPIO_24_INIT 13'h0403
`define USER_CONFIG_GPIO_25_INIT 13'h0403
`define USER_CONFIG_GPIO_26_INIT 13'h0403
`define USER_CONFIG_GPIO_27_INIT 13'h0403
`define USER_CONFIG_GPIO_28_INIT 13'h0403
`define USER_CONFIG_GPIO_29_INIT 13'h0403
`define USER_CONFIG_GPIO_30_INIT 13'h0403
`define USER_CONFIG_GPIO_31_INIT 13'h0403
`define USER_CONFIG_GPIO_32_INIT 13'h0403
`define USER_CONFIG_GPIO_33_INIT 13'h0403
`define USER_CONFIG_GPIO_34_INIT 13'h0403
`define USER_CONFIG_GPIO_35_INIT 13'h0403
`define USER_CONFIG_GPIO_36_INIT 13'h0403
`define USER_CONFIG_GPIO_37_INIT 13'h0403
`endif // __GLOBAL_DEFINE_H

View File

@ -20,7 +20,7 @@
// a parameter
module user_id_programming #(
parameter [ 0:0] USER_PROJECT_ID = 32'h0
parameter USER_PROJECT_ID = 32'h0
) (
`ifdef USE_POWER_PINS
inout VPWR,