Radical Computer Technologies
Interfaces / entity

radif_gpio_reg_block

Documentation version: 0.2.1 / Subpackage: radif_regbank / Source package: radif

RADIF-controlled GPIO register block for simple board control and status. Exposes output value, output enable, input value, edge-detect pending bits, interrupt masks, and edge polarity selection through the shared RADIF bus.

Use Cases

Block Diagram

radif_gpio_reg_block radhdl entity clk rstn gpio_i reg_wr_addr reg_rd_addr reg_wr_en reg_rd_en reg_data_in gpio_o gpio_oe_o irq_o reg_data_out reg_wr_rdy reg_rd_rdy reg_wr_valid reg_rd_valid reg_error
VHDL Include And Instantiation Template

File Header

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

library radhdl;
-- Direct entity instantiation below does not require importing the entity name.
use radhdl.interfaces.all;
-- Narrower alternative: use radhdl.interfaces_regbank.all;

Component Declaration

component radif_gpio_reg_block is
  generic (
    DATA_WIDTH : integer := 32;
    REG_ADDR_WIDTH : integer := 16;
    GPIO_WIDTH : positive := 8;
    RESET_OUT_VALUE : std_logic_vector(GPIO_WIDTH - 1 downto 0) := (others => '0');
    RESET_OUT_ENABLE : std_logic_vector(GPIO_WIDTH - 1 downto 0) := (others => '0');
    VENDOR_TAG : string := "GENERIC";
    PRODUCT_SERIES_TAG : string := "GENERIC"
  );
  port (
    clk : in std_logic;
    rstn : in std_logic;
    gpio_i : in std_logic_vector(GPIO_WIDTH - 1 downto 0);
    gpio_o : out std_logic_vector(GPIO_WIDTH - 1 downto 0);
    gpio_oe_o : out std_logic_vector(GPIO_WIDTH - 1 downto 0);
    irq_o : out std_logic;
    reg_wr_addr : in std_logic_vector(REG_ADDR_WIDTH - 1 downto 0);
    reg_rd_addr : in std_logic_vector(REG_ADDR_WIDTH - 1 downto 0);
    reg_wr_en : in std_logic;
    reg_rd_en : in std_logic;
    reg_data_in : in std_logic_vector(DATA_WIDTH - 1 downto 0);
    reg_data_out : out std_logic_vector(DATA_WIDTH - 1 downto 0);
    reg_wr_rdy : out std_logic;
    reg_rd_rdy : out std_logic;
    reg_wr_valid : out std_logic;
    reg_rd_valid : out std_logic;
    reg_error : out std_logic
  );
end component;

Direct Entity Instantiation

u_radif_gpio_reg_block : entity radhdl.radif_gpio_reg_block
  generic map (
    DATA_WIDTH         => 32,
    REG_ADDR_WIDTH     => 16,
    GPIO_WIDTH         => 8,
    RESET_OUT_VALUE    => (others => '0'),
    RESET_OUT_ENABLE   => (others => '0'),
    VENDOR_TAG         => "GENERIC",
    PRODUCT_SERIES_TAG => "GENERIC"
  )
  port map (
    clk          => <clk_signal>,
    rstn         => <rstn_signal>,
    gpio_i       => <gpio_i_signal>,
    gpio_o       => <gpio_o_signal>,
    gpio_oe_o    => <gpio_oe_o_signal>,
    irq_o        => <irq_o_signal>,
    reg_wr_addr  => <reg_wr_addr_signal>,
    reg_rd_addr  => <reg_rd_addr_signal>,
    reg_wr_en    => <reg_wr_en_signal>,
    reg_rd_en    => <reg_rd_en_signal>,
    reg_data_in  => <reg_data_in_signal>,
    reg_data_out => <reg_data_out_signal>,
    reg_wr_rdy   => <reg_wr_rdy_signal>,
    reg_rd_rdy   => <reg_rd_rdy_signal>,
    reg_wr_valid => <reg_wr_valid_signal>,
    reg_rd_valid => <reg_rd_valid_signal>,
    reg_error    => <reg_error_signal>
  );

Generics

NameTypeDefaultDescription
DATA_WIDTHinteger32Width of the RADIF register data path.
REG_ADDR_WIDTHinteger16Width of the RADIF byte address path.
GPIO_WIDTHpositive8Number of GPIO pins controlled or observed by this block.
RESET_OUT_VALUEstd_logic_vector(GPIO_WIDTH - 1 downto 0)(others => '0')Reset value for GPIO outputs.
RESET_OUT_ENABLEstd_logic_vector(GPIO_WIDTH - 1 downto 0)(others => '0')Reset value for GPIO output enables.
VENDOR_TAGstring"GENERIC"Vendor selector retained for generated package consistency.
PRODUCT_SERIES_TAGstring"GENERIC"Device-family selector retained for generated package consistency.

Ports

NameDirectionTypeDescription
clkinstd_logicRegister clock.
rstninstd_logicActive-low register reset.
gpio_iinstd_logic_vector(GPIO_WIDTH - 1 downto 0)External GPIO input pins synchronized into clk.
gpio_ooutstd_logic_vector(GPIO_WIDTH - 1 downto 0)GPIO output drive values.
gpio_oe_ooutstd_logic_vector(GPIO_WIDTH - 1 downto 0)GPIO output enable bits.
irq_ooutstd_logicInterrupt asserted when an enabled edge-detect pending bit is set.
reg_wr_addrinstd_logic_vector(REG_ADDR_WIDTH - 1 downto 0)Register write address.
reg_rd_addrinstd_logic_vector(REG_ADDR_WIDTH - 1 downto 0)Register read address.
reg_wr_eninstd_logicOne-cycle register write request.
reg_rd_eninstd_logicOne-cycle register read request.
reg_data_ininstd_logic_vector(DATA_WIDTH - 1 downto 0)Register write data.
reg_data_outoutstd_logic_vector(DATA_WIDTH - 1 downto 0)Register read data.
reg_wr_rdyoutstd_logicRegister write ready.
reg_rd_rdyoutstd_logicRegister read ready.
reg_wr_validoutstd_logicRegister write response valid.
reg_rd_validoutstd_logicRegister read response valid.
reg_erroroutstd_logicRegister transaction error.

Measured Implementation Metrics

Metrics are generated by RadBuild from real Vivado synthesis reports for representative device targets. Raw report paths are preserved in the checked summary JSON.

PartClock nsMHzLUTsFFsBRAM tilesDSPsSetup WNS nsHold WHS nsGenericsSummary
xc7z020clg400-110.0100.07583006.880.152-projects/synth_reports/radif_gpio_reg_block/xc7z020clg400-1/synth_summary.json
xczu3eg-sfvc784-1-e6.667149.9937583005.707-0.059-projects/synth_reports/radif_gpio_reg_block/xczu3eg-sfvc784-1-e/synth_summary.json

Register Interfaces

Static register maps are rendered below for this module.

InterfaceDirectionsSignalsRepresentative ports
Register control/statusin, out11reg_wr_addr, reg_rd_addr, reg_wr_en, reg_rd_en, reg_data_in, reg_data_out, reg_wr_rdy, reg_rd_rdy, +3 more

Register Maps

radif_gpio_reg_block

Source: interfaces/hdl/radif/register_maps/radif_gpio_reg_block.map.json

Controls GPIO output values, output enables, input readback, edge detection, and interrupt masking.

RegisterOffsetAccessResetDescription
out_value0x00rwRESET_OUT_VALUEGPIO output drive values.
out_enable0x04rwRESET_OUT_ENABLEGPIO output enable controls.
in_value0x08ro0x00000000Synchronized GPIO input values.
irq_status0x0Crw1c0x00000000Latched GPIO edge-detect interrupt pending bits.
irq_mask0x10rw0x00000000GPIO interrupt enable mask.
rise_enable0x14rw0x00000000Rising-edge interrupt detection enable bits.
fall_enable0x18rw0x00000000Falling-edge interrupt detection enable bits.

out_value

Offset 0x00 / Access rw / Reset RESET_OUT_VALUE

GPIO output drive values.

OutValue[15:0]
1514131211109876543210
GPIO OUT [15:0]
OutValue[31:16]
31302928272625242322212019181716
GPIO OUT [31:16]
NameRegister bit(s)Description
GPIO OUTOutValue[31:0]One output value bit per GPIO pin. Bits above GPIO_WIDTH are unused.

out_enable

Offset 0x04 / Access rw / Reset RESET_OUT_ENABLE

GPIO output enable controls.

OutEnable[15:0]
1514131211109876543210
GPIO OE [15:0]
OutEnable[31:16]
31302928272625242322212019181716
GPIO OE [31:16]
NameRegister bit(s)Description
GPIO OEOutEnable[31:0]One output-enable bit per GPIO pin. Bits above GPIO_WIDTH are unused.

in_value

Offset 0x08 / Access ro / Reset 0x00000000

Synchronized GPIO input values.

InValue[15:0]
1514131211109876543210
GPIO IN [15:0]
InValue[31:16]
31302928272625242322212019181716
GPIO IN [31:16]
NameRegister bit(s)Description
GPIO INInValue[31:0]One synchronized input value bit per GPIO pin. Bits above GPIO_WIDTH read as zero.

irq_status

Offset 0x0C / Access rw1c / Reset 0x00000000

Latched GPIO edge-detect interrupt pending bits.

IrqStatus[15:0]
1514131211109876543210
IRQ PENDING [15:0]
IrqStatus[31:16]
31302928272625242322212019181716
IRQ PENDING [31:16]
NameRegister bit(s)Description
IRQ PENDINGIrqStatus[31:0]Pending edge bits. Write 1 to clear the corresponding pending bit.

irq_mask

Offset 0x10 / Access rw / Reset 0x00000000

GPIO interrupt enable mask.

IrqMask[15:0]
1514131211109876543210
IRQ MASK [15:0]
IrqMask[31:16]
31302928272625242322212019181716
IRQ MASK [31:16]
NameRegister bit(s)Description
IRQ MASKIrqMask[31:0]A bit value of 1 allows the corresponding pending bit to assert irq_o.

rise_enable

Offset 0x14 / Access rw / Reset 0x00000000

Rising-edge interrupt detection enable bits.

RiseEnable[15:0]
1514131211109876543210
RISE EN [15:0]
RiseEnable[31:16]
31302928272625242322212019181716
RISE EN [31:16]
NameRegister bit(s)Description
RISE ENRiseEnable[31:0]A bit value of 1 latches a pending interrupt when the corresponding GPIO input rises.

fall_enable

Offset 0x18 / Access rw / Reset 0x00000000

Falling-edge interrupt detection enable bits.

FallEnable[15:0]
1514131211109876543210
FALL EN [15:0]
FallEnable[31:16]
31302928272625242322212019181716
FALL EN [31:16]
NameRegister bit(s)Description
FALL ENFallEnable[31:0]A bit value of 1 latches a pending interrupt when the corresponding GPIO input falls.

Testbenches

tb_radif_gpio_irq captured waveform

Source: interfaces/hdl/radif/testbenches/tb_radif_gpio_irq.vhd

Exercises RADIF GPIO and interrupt-controller register behavior.

Artifacts: status, vcd

Captured GHDL Waveform

Source: interfaces/hdl/radif/testbenches/tb_radif_gpio_irq.vhd

clk
rstn
gpio_i[3:0]
gpio_o[3:0]
gpio_oe[3:0]
gpio_irq
gpio_wr_addr[15:0]
gpio_rd_addr[15:0]
gpio_wr_en
gpio_rd_en
gpio_data_in[31:0]
gpio_data_out[31:0]
gpio_wr_rdy
gpio_rd_rdy
gpio_wr_valid
gpio_rd_valid
gpio_error
irq_inputs[3:0]
irq_o
irq_pending[3:0]
irq_wr_addr[15:0]
irq_rd_addr[15:0]
irq_wr_en
irq_rd_en
irq_data_in[31:0]
irq_data_out[31:0]
irq_wr_rdy
irq_rd_rdy
irq_wr_valid
irq_rd_valid
irq_error
gpio_oe_o[3:0]
reg_wr_addr[15:0]
reg_rd_addr[15:0]
reg_wr_en
reg_rd_en
reg_data_in[31:0]
reg_data_out[31:0]
reg_wr_rdy
reg_rd_rdy
reg_wr_valid
reg_rd_valid
reg_error
out_value_r[3:0]
out_en_r[3:0]
irq_stat_r[3:0]
irq_mask_r[3:0]
rise_en_r[3:0]
fall_en_r[3:0]
gpio_meta_r[3:0]
gpio_sync_r[3:0]
gpio_prev_r[3:0]
rd_data_r[31:0]
wr_valid_r
rd_valid_r
error_r
irq_i[3:0]
irq_pending_o[3:0]
control_r[31:0]
mask_r[3:0]
pending_r[3:0]
irq_meta_r[3:0]
irq_sync_r[3:0]

Sources