Skip to content

Commit 702abb9

Browse files
Narrow GPIO RegAddrWidth a bit
Narrow the `RegAddrWidth` GPIO module parameter from 12 to 9 bits. Should reduce the number of bits that need to be compared in `gpio_array` to determine which instance to select. Probably a very minor area saving, but every little counts. Also update the default `RegAddr` in `gpio_core` to be more realistic.
1 parent 71b3640 commit 702abb9

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

rtl/ip/gpio/rtl/gpio_core.sv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module gpio_core #(
77
parameter int unsigned GpoWidth = 16,
88
parameter int unsigned AddrWidth = 32,
99
parameter int unsigned DataWidth = 32,
10-
parameter int unsigned RegAddr = 12,
10+
parameter int unsigned RegAddr = 6,
1111
parameter int unsigned DbncWidth = 10
1212
) (
1313
input logic clk_i,

rtl/system/sonata_system.sv

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ module sonata_system
123123
localparam int unsigned BusAddrWidth = 32;
124124
localparam int unsigned BusByteEnable = 4;
125125
localparam int unsigned BusDataWidth = 32;
126-
localparam int unsigned RegAddrWidth = 8;
126+
localparam int unsigned PRegAddrWidth = 8; // PWM uses only 8 bits of addressing.
127127
localparam int unsigned DRegAddrWidth = 12; // Debug module uses 12 bits of addressing.
128128
localparam int unsigned TRegAddrWidth = 16; // Timer uses more address bits.
129+
localparam int unsigned GRegAddrWidth = 9; // GPIO array uses 9 bits of addressing.
129130
localparam int unsigned FixedSpiNum = 2; // Number of SPI devices that don't pass through the pinmux
130131
localparam int unsigned TotalSpiNum = SPI_NUM + FixedSpiNum; // The total number of SPI devices
131132
localparam int unsigned FixedGpioNum = 1; // Number of GPIO instances that don't pass through the pinmux
@@ -639,7 +640,7 @@ module sonata_system
639640
// Register interface.
640641
.re_o (device_re[Pwm]),
641642
.we_o (device_we[Pwm]),
642-
.addr_o (device_addr[Pwm][RegAddrWidth-1:0]),
643+
.addr_o (device_addr[Pwm][PRegAddrWidth-1:0]),
643644
.wdata_o (device_wdata[Pwm]),
644645
.be_o (device_be[Pwm]),
645646
.busy_i ('0),
@@ -648,7 +649,7 @@ module sonata_system
648649
);
649650

650651
// Tie off upper bits of address.
651-
assign device_addr[Pwm][BusAddrWidth-1:RegAddrWidth] = '0;
652+
assign device_addr[Pwm][BusAddrWidth-1:PRegAddrWidth] = '0;
652653

653654
tlul_adapter_reg #(
654655
.RegAw ( TRegAddrWidth ),
@@ -885,6 +886,9 @@ module sonata_system
885886
gpio #(
886887
.GpiMaxWidth ( GPIO_IOS_WIDTH ),
887888
.GpoMaxWidth ( GPIO_IOS_WIDTH ),
889+
.AddrWidth ( BusAddrWidth ),
890+
.DataWidth ( BusDataWidth ),
891+
.RegAddrWidth ( GRegAddrWidth ),
888892
.NumInstances ( TotalGpioNum ),
889893
.GpiInstWidths( GPIO_INST_IN_WIDTH ),
890894
.GpoInstWidths( GPIO_INST_OUT_WIDTH )

0 commit comments

Comments
 (0)