2021-08-13 01:33:15 +00:00
|
|
|
// Copyright lowRISC contributors.
|
|
|
|
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
//
|
|
|
|
// Register Package auto-generated by `reggen` containing data structure
|
|
|
|
|
|
|
|
package gpio_reg_pkg;
|
|
|
|
|
|
|
|
// Address widths within the block
|
2021-09-10 01:51:08 +00:00
|
|
|
parameter int BlockAw = 5;
|
2021-08-13 01:33:15 +00:00
|
|
|
|
|
|
|
////////////////////////////
|
|
|
|
// Typedefs for registers //
|
|
|
|
////////////////////////////
|
|
|
|
|
|
|
|
typedef struct packed {
|
2021-09-10 01:51:08 +00:00
|
|
|
logic [31:0] q;
|
|
|
|
} gpio_reg2hw_io_mode_reg_t;
|
|
|
|
|
|
|
|
typedef struct packed {
|
|
|
|
logic [31:0] q;
|
|
|
|
} gpio_reg2hw_int_mode_reg_t;
|
2021-08-13 01:33:15 +00:00
|
|
|
|
|
|
|
typedef struct packed {
|
2021-09-10 01:51:08 +00:00
|
|
|
logic [15:0] q;
|
|
|
|
} gpio_reg2hw_int_pending_reg_t;
|
2021-08-13 01:33:15 +00:00
|
|
|
|
|
|
|
typedef struct packed {
|
2021-09-10 01:51:08 +00:00
|
|
|
logic [15:0] q;
|
2021-08-13 01:33:15 +00:00
|
|
|
} gpio_reg2hw_data_reg_t;
|
|
|
|
|
|
|
|
typedef struct packed {
|
2021-09-10 01:51:08 +00:00
|
|
|
logic [15:0] q;
|
2021-08-13 01:33:15 +00:00
|
|
|
} gpio_reg2hw_filter_reg_t;
|
|
|
|
|
|
|
|
typedef struct packed {
|
2021-09-10 01:51:08 +00:00
|
|
|
logic [15:0] d;
|
|
|
|
logic de;
|
|
|
|
} gpio_hw2reg_int_pending_reg_t;
|
2021-08-13 01:33:15 +00:00
|
|
|
|
|
|
|
typedef struct packed {
|
2021-09-10 01:51:08 +00:00
|
|
|
logic [15:0] d;
|
2021-08-13 01:33:15 +00:00
|
|
|
logic de;
|
|
|
|
} gpio_hw2reg_data_reg_t;
|
|
|
|
|
|
|
|
// Register -> HW type
|
|
|
|
typedef struct packed {
|
2021-09-10 01:51:08 +00:00
|
|
|
gpio_reg2hw_io_mode_reg_t io_mode; // [111:80]
|
|
|
|
gpio_reg2hw_int_mode_reg_t int_mode; // [79:48]
|
|
|
|
gpio_reg2hw_int_pending_reg_t int_pending; // [47:32]
|
|
|
|
gpio_reg2hw_data_reg_t data; // [31:16]
|
|
|
|
gpio_reg2hw_filter_reg_t filter; // [15:0]
|
2021-08-13 01:33:15 +00:00
|
|
|
} gpio_reg2hw_t;
|
|
|
|
|
|
|
|
// HW -> register type
|
|
|
|
typedef struct packed {
|
2021-09-10 01:51:08 +00:00
|
|
|
gpio_hw2reg_int_pending_reg_t int_pending; // [33:17]
|
|
|
|
gpio_hw2reg_data_reg_t data; // [16:0]
|
2021-08-13 01:33:15 +00:00
|
|
|
} gpio_hw2reg_t;
|
|
|
|
|
|
|
|
// Register offsets
|
2021-09-10 01:51:08 +00:00
|
|
|
parameter logic [BlockAw-1:0] GPIO_IO_MODE_OFFSET = 5'h0;
|
|
|
|
parameter logic [BlockAw-1:0] GPIO_INT_MODE_OFFSET = 5'h4;
|
|
|
|
parameter logic [BlockAw-1:0] GPIO_INT_PENDING_OFFSET = 5'h8;
|
|
|
|
parameter logic [BlockAw-1:0] GPIO_DATA_OFFSET = 5'hc;
|
|
|
|
parameter logic [BlockAw-1:0] GPIO_FILTER_OFFSET = 5'h10;
|
2021-08-13 01:33:15 +00:00
|
|
|
|
|
|
|
// Register index
|
|
|
|
typedef enum int {
|
2021-09-10 01:51:08 +00:00
|
|
|
GPIO_IO_MODE,
|
|
|
|
GPIO_INT_MODE,
|
|
|
|
GPIO_INT_PENDING,
|
2021-08-13 01:33:15 +00:00
|
|
|
GPIO_DATA,
|
|
|
|
GPIO_FILTER
|
|
|
|
} gpio_id_e;
|
|
|
|
|
|
|
|
// Register width information to check illegal writes
|
2021-09-10 01:51:08 +00:00
|
|
|
parameter logic [3:0] GPIO_PERMIT [5] = '{
|
|
|
|
4'b1111, // index[0] GPIO_IO_MODE
|
|
|
|
4'b1111, // index[1] GPIO_INT_MODE
|
|
|
|
4'b0011, // index[2] GPIO_INT_PENDING
|
|
|
|
4'b0011, // index[3] GPIO_DATA
|
|
|
|
4'b0011 // index[4] GPIO_FILTER
|
2021-08-13 01:33:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
endpackage
|
|
|
|
|