Add gpio_all_bidir_user test

This commit is contained in:
M0stafaRady 2022-10-10 15:59:20 -07:00
parent 8cca3a5002
commit 7fe790649d
9 changed files with 285 additions and 34 deletions

View File

@ -69,6 +69,12 @@
"GL":["r_gl","push_gl","nightly","weekly","tape_out"],
"GL_SDF":["r_sdf","weekly","tape_out"],
"description":"configure all gpios as mgmt bidir using automatic approach firmware and check them"}
,"gpio_all_bidir_user" :{"level":0,
"SW":true,
"RTL":["r_rtl","setup","push","push_gl","nightly","weekly","tape_out"],
"GL":["r_gl","push_gl","nightly","weekly","tape_out"],
"GL_SDF":["r_sdf","weekly","tape_out"],
"description":"configure all gpios as user bidir using automatic approach firmware and check them"}
,"bitbang_cpu_all_10" :{"level":0,
"SW":true,
"RTL":["r_rtl","setup","push","push_gl","nightly","weekly","tape_out"],

View File

@ -0,0 +1,115 @@
#include <defs.h>
#include <stub.c>
#define reg_mprj_userl (*(volatile uint32_t*)0x300FFFF0)
#define reg_mprj_userh (*(volatile uint32_t*)0x300FFFF4)
#define reg_oeb_userl (*(volatile uint32_t*)0x300FFFEC)
#define reg_oeb_userh (*(volatile uint32_t*)0x300FFFE8)
void main(){
unsigned int i, j, k;
reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
reg_debug_1 = 0x0;
reg_debug_2 = 0x0;
reg_hkspi_disable = 1;
reg_mprj_io_37 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_36 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_35 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_34 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_33 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_32 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_31 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_30 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_29 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_28 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_27 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_26 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_25 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_24 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_23 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_22 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_21 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_20 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_19 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_18 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_17 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_16 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_15 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_14 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_13 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_12 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_11 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_10 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_9 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_8 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_7 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_6 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_5 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_4 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_3 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_2 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_1 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_io_0 = GPIO_MODE_USER_STD_BIDIRECTIONAL;
reg_mprj_xfer = 1;
while (reg_mprj_xfer == 1);
reg_oeb_userl = 0x0;
reg_oeb_userh = 0x0;
reg_debug_1 = 0x1A; // try the gpios as output
reg_mprj_userl = 0x0;
reg_mprj_userh = 0x0;
i = 0x20;
for (j = 0; j < 5; j++) {
reg_mprj_userh = i;
reg_debug_2 = 37-j;
reg_mprj_userh = 0x00000000;
reg_debug_2 = 0;
i >>=1;
i |= 0x20;
}
i = 0x80000000;
for (j = 0; j < 32; j++) {
reg_mprj_userh = 0x3f;
reg_mprj_userl = i;
reg_debug_2 = 32-j;
reg_mprj_userh = 0x00;
reg_mprj_userl = 0x00000000;
reg_debug_2 = 0;
i >>=1;
i |= 0x80000000;
}
reg_oeb_userl = 0xFFFFFFFF;
reg_oeb_userh = 0x3F;
reg_mprj_userl =0;
reg_mprj_userh =0;
// test input
reg_debug_1 = 0XAA; // configuration done wait environment to send 0xFFFFFFFF to reg_mprj_userl
while (reg_mprj_userl != 0xFFFFFFFF);
reg_debug_2 = reg_mprj_userl;
reg_debug_1 = 0XBB; // configuration done wait environment to send 0xAAAAAAAA to reg_mprj_userl
while (reg_mprj_userl != 0xAAAAAAAA);
reg_debug_2 = reg_mprj_userl;
reg_debug_1 = 0XCC; // configuration done wait environment to send 0x55555555 to reg_mprj_userl
while (reg_mprj_userl != 0x55555555);
reg_debug_2 = reg_mprj_userl;
reg_debug_1 = 0XDD; // configuration done wait environment to send 0x0 to reg_mprj_userl
while (reg_mprj_userl != 0x0);
reg_debug_2 = reg_mprj_userl;
reg_debug_1 = 0XD1;
while (reg_mprj_userh != 0x3F);
reg_debug_2 = reg_mprj_userh;
reg_debug_1 = 0XD2;
while (reg_mprj_userh != 0x0);
reg_debug_2 = reg_mprj_userh;
reg_debug_1 = 0XD3;
while (reg_mprj_userh != 0x15);
reg_debug_2 = reg_mprj_userh;
reg_debug_1 = 0XD4;
while (reg_mprj_userh != 0x2A);
reg_debug_2 = reg_mprj_userh;
reg_debug_1 = 0XD5;
reg_debug_2=0xFF;
}

View File

@ -1,7 +1,10 @@
#include <defs.h>
#include <stub.c>
#include "../bitbang/bitbang_functions.c"
#define reg_mprj_userl (*(volatile uint32_t*)0x300FFFF0)
#define reg_mprj_userh (*(volatile uint32_t*)0x300FFFF4)
#define reg_oeb_userl (*(volatile uint32_t*)0x300FFFEC)
#define reg_oeb_userh (*(volatile uint32_t*)0x300FFFE8)
void main(){
unsigned int i, j, k;
reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
@ -47,7 +50,10 @@ void main(){
reg_mprj_io_1 = GPIO_MODE_USER_STD_INPUT_PULLUP;
reg_mprj_io_0 = GPIO_MODE_USER_STD_INPUT_PULLUP;
reg_mprj_io_0 = GPIO_MODE_USER_STD_INPUT_PULLUP;
reg_mprj_userl = 0xFFFFFFFF;
reg_mprj_userh = 0x3F;
reg_oeb_userl = 0x0;
reg_oeb_userh = 0x0;
reg_mprj_xfer = 1;
while (reg_mprj_xfer == 1);

View File

@ -50,8 +50,6 @@ void main(){
reg_mprj_io_1 = GPIO_MODE_USER_STD_INPUT_NOPULL;
reg_mprj_io_0 = GPIO_MODE_USER_STD_INPUT_NOPULL;
reg_mprj_io_0 = GPIO_MODE_USER_STD_INPUT_NOPULL;
reg_mprj_userl = 0xFFFFFFFF;
reg_mprj_userh = 0x3F;
reg_mprj_xfer = 1;
while (reg_mprj_xfer == 1);

View File

@ -4,7 +4,8 @@
// Debug reg DEBUG_ON
#define reg_mprj_userl (*(volatile uint32_t*)0x300FFFF0)
#define reg_mprj_userh (*(volatile uint32_t*)0x300FFFF4)
#define reg_oeb_userl (*(volatile uint32_t*)0x300FFFEC)
#define reg_oeb_userh (*(volatile uint32_t*)0x300FFFE8)
void main(){
unsigned int i, j, k;
reg_wb_enable =1; // for enable writing to reg_debug_1 and reg_debug_2
@ -53,7 +54,8 @@ void main(){
reg_mprj_xfer = 1;
while (reg_mprj_xfer == 1);
reg_oeb_userl = 0x0;
reg_oeb_userh = 0x0;
reg_debug_1 = 0xAA; // finish configuration
reg_mprj_userl = 0x0;
reg_mprj_userh = 0x0;

View File

@ -354,3 +354,113 @@ async def gpio_all_i_pd_user(dut):
if gpio[i] != "0":
cocotb.log.error(f"[TEST] gpio[{i}] is having wrong value {gpio[i]} instead of 0 while configured as input pulldown and all released")
await ClockCycles(caravelEnv.clk,1000)
@cocotb.test()
@repot_test
async def gpio_all_bidir_user(dut):
caravelEnv,clock = await test_configure(dut,timeout_cycles=290455)
cpu = RiskV(dut)
cpu.cpu_force_reset()
cpu.cpu_release_reset()
uut = dut.uut
await wait_reg1(cpu,caravelEnv,0x1A)
cocotb.log.info("[TEST] finish configuring ")
i= 0x20
for j in range(5):
await wait_reg2(cpu,caravelEnv,37-j)
cocotb.log.info(f'[Test] gpio out = {caravelEnv.monitor_gpio((37,0))} j = {j}')
if caravelEnv.monitor_gpio((37,0)).integer != i << 32:
cocotb.log.error(f'[TEST] Wrong gpio high bits output {caravelEnv.monitor_gpio((37,0))} instead of {bin(i << 32)}')
await wait_reg2(cpu,caravelEnv,0)
if caravelEnv.monitor_gpio((37,0)).integer != 0:
cocotb.log.error(f'[TEST] Wrong gpio output {caravelEnv.monitor_gpio((37,0))} instead of {bin(0x00000)}')
i = i >> 1
i |= 0x20
i= 0x80000000
for j in range(32):
await wait_reg2(cpu,caravelEnv,32-j)
cocotb.log.info(f'[Test] gpio out = {caravelEnv.monitor_gpio((37,0))} j = {j}')
if caravelEnv.monitor_gpio((37,32)).integer != 0x3f:
cocotb.log.error(f'[TEST] Wrong gpio high bits output {caravelEnv.monitor_gpio((37,32))} instead of {bin(0x3f)} ')
if caravelEnv.monitor_gpio((31,0)).integer != i :
cocotb.log.error(f'[TEST] Wrong gpio low bits output {caravelEnv.monitor_gpio((31,0))} instead of {bin(i)}')
await wait_reg2(cpu,caravelEnv,0)
if caravelEnv.monitor_gpio((37,0)).integer != 0:
cocotb.log.error(f'Wrong gpio output {caravelEnv.monitor_gpio((37,0))} instead of {bin(0x00000)}')
i = i >> 1
i |= 0x80000000
caravelEnv.release_gpio((37,0))
await ClockCycles(caravelEnv.clk, 10)
caravelEnv.drive_gpio_in((31,0),0)
await ClockCycles(caravelEnv.clk, 10)
await wait_reg1(cpu,caravelEnv,0xAA)
cocotb.log.info(f"[TEST] configuration finished")
data_in = 0xFFFFFFFF
cocotb.log.info(f"[TEST] drive {hex(data_in)} to gpio[31:0]")
caravelEnv.drive_gpio_in((31,0),data_in)
await wait_reg1(cpu,caravelEnv,0xBB)
if cpu.read_debug_reg2() == data_in:
cocotb.log.info(f"[TEST] data {hex(data_in)} sent successfully through gpio[31:0]")
else:
cocotb.log.error(f"[TEST] Error: reg_mprj_datal has recieved wrong data {cpu.read_debug_reg2()} instead of {data_in}")
data_in = 0xAAAAAAAA
cocotb.log.info(f"[TEST] drive {hex(data_in)} to gpio[31:0]")
caravelEnv.drive_gpio_in((31,0),data_in)
await wait_reg1(cpu,caravelEnv,0xCC)
if cpu.read_debug_reg2() == data_in:
cocotb.log.info(f"[TEST] data {hex(data_in)} sent successfully through gpio[31:0]")
else:
cocotb.log.error(f"[TEST] Error: reg_mprj_datal has recieved wrong data {cpu.read_debug_reg2()} instead of {data_in}")
data_in = 0x55555555
cocotb.log.info(f"[TEST] drive {hex(data_in)} to gpio[31:0]")
caravelEnv.drive_gpio_in((31,0),data_in)
await wait_reg1(cpu,caravelEnv,0xDD)
if cpu.read_debug_reg2() == data_in:
cocotb.log.info(f"[TEST] data {hex(data_in)} sent successfully through gpio[31:0]")
else:
cocotb.log.error(f"[TEST] Error: reg_mprj_datal has recieved wrong data {cpu.read_debug_reg2()} instead of {data_in}")
data_in = 0x0
cocotb.log.info(f"[TEST] drive {hex(data_in)} to gpio[31:0]")
caravelEnv.drive_gpio_in((31,0),data_in)
await wait_reg1(cpu,caravelEnv,0xD1)
if cpu.read_debug_reg2() == data_in:
cocotb.log.info(f"[TEST] data {hex(data_in)} sent successfully through gpio[31:0]")
else:
cocotb.log.error(f"[TEST] Error: reg_mprj_datal has recieved wrong data {cpu.read_debug_reg2()} instead of {data_in}")
data_in = 0x3F
cocotb.log.info(f"[TEST] drive {hex(data_in)} to gpio[37:32]")
caravelEnv.drive_gpio_in((37,32),data_in)
await wait_reg1(cpu,caravelEnv,0xD2)
if cpu.read_debug_reg2() == data_in:
cocotb.log.info(f"[TEST] data {hex(data_in)} sent successfully through gpio[37:32]")
else:
cocotb.log.error(f"[TEST] Error: reg_mprj_datah has recieved wrong data {cpu.read_debug_reg2()} instead of {data_in}")
data_in = 0x0
cocotb.log.info(f"[TEST] drive {hex(data_in)} to gpio[37:32]")
caravelEnv.drive_gpio_in((37,32),data_in)
await wait_reg1(cpu,caravelEnv,0xD3)
if cpu.read_debug_reg2() == data_in:
cocotb.log.info(f"[TEST] data {hex(data_in)} sent successfully through gpio[37:32]")
else:
cocotb.log.error(f"[TEST] Error: reg_mprj_datah has recieved wrong data {cpu.read_debug_reg2()} instead of {data_in}")
data_in = 0x15
cocotb.log.info(f"[TEST] drive {hex(data_in)} to gpio[37:32]")
caravelEnv.drive_gpio_in((37,32),data_in)
await wait_reg1(cpu,caravelEnv,0xD4)
if cpu.read_debug_reg2() == data_in:
cocotb.log.info(f"[TEST] data {hex(data_in)} sent successfully through gpio[37:32]")
else:
cocotb.log.error(f"[TEST] Error: reg_mprj_datah has recieved wrong data {cpu.read_debug_reg2()} instead of {data_in}")
data_in = 0x2A
cocotb.log.info(f"[TEST] drive {hex(data_in)} to gpio[37:32]")
caravelEnv.drive_gpio_in((37,32),data_in)
await wait_reg1(cpu,caravelEnv,0XD5)
await wait_reg2(cpu,caravelEnv,0XFF)
cocotb.log.info(f"[TEST] finish")
await ClockCycles(caravelEnv.clk, 10)

View File

@ -91,7 +91,7 @@ class RunTest:
macros = f'+define+FUNCTIONAL +define+USE_POWER_PINS +define+UNIT_DELAY=#1 +define+MAIN_PATH=\\\"{self.cocotb_path}\\\" +define+VCS '
if self.test_name == "la":
macros = f'{macros} +define+LA_TESTING'
if self.test_name in ["gpio_all_o_user","gpio_all_i_user","gpio_all_i_pu_user","gpio_all_i_pd_user"]:
if self.test_name in ["gpio_all_o_user","gpio_all_i_user","gpio_all_i_pu_user","gpio_all_i_pd_user","gpio_all_bidir_user"]:
macros = f'{macros} +define+GPIO_TESTING'
# shutil.copyfile(f'{self.test_full_dir}/{self.test_name}.hex',f'{self.sim_path}/{self.test_name}.hex')
# if os.path.exists(f'{self.test_full_dir}/test_data'):

View File

@ -45,26 +45,40 @@ module user_project_gpio_example (
);
reg [31:0] io_l;
reg [5:0] io_h;
reg [31:0] oeb_l;
reg [5:0] oeb_h;
always @(posedge wb_clk_i or posedge wb_rst_i) begin
if (wb_rst_i) begin
io_l <=0;
io_h <=0;
oeb_l <=0;
oeb_h <=0;
wbs_dat_o <=0;
wbs_ack_o <=0;
end else if (wbs_cyc_i && wbs_stb_i && wbs_we_i && !wbs_ack_o && (wbs_adr_i[3:0]==4'h4||wbs_adr_i[3:0]==4'h0))begin // write
end else if (wbs_cyc_i && wbs_stb_i && wbs_we_i && !wbs_ack_o && (wbs_adr_i[31:0]==32'h300FFFF4||wbs_adr_i[31:0]==32'h300FFFF0||wbs_adr_i[31:0]==32'h300FFFEC||wbs_adr_i[31:0]==32'h300FFFE8))begin // write
// write to io_l
io_l[7:0] <= ((wbs_adr_i[3:0]==4'h0) && wbs_sel_i[0])? wbs_dat_i[7:0] :io_l[7:0];
io_l[15:8] <= ((wbs_adr_i[3:0]==4'h0) && wbs_sel_i[1])? wbs_dat_i[15:8] :io_l[15:8];
io_l[23:16] <= ((wbs_adr_i[3:0]==4'h0) && wbs_sel_i[2])? wbs_dat_i[23:16] :io_l[23:16];
io_l[31:24] <= ((wbs_adr_i[3:0]==4'h0) && wbs_sel_i[3])? wbs_dat_i[31:24] :io_l[31:24];
io_l[7:0] <= ((wbs_adr_i[31:0]==32'h300FFFF0) && wbs_sel_i[0])? wbs_dat_i[7:0] :io_l[7:0];
io_l[15:8] <= ((wbs_adr_i[31:0]==32'h300FFFF0) && wbs_sel_i[1])? wbs_dat_i[15:8] :io_l[15:8];
io_l[23:16] <= ((wbs_adr_i[31:0]==32'h300FFFF0) && wbs_sel_i[2])? wbs_dat_i[23:16] :io_l[23:16];
io_l[31:24] <= ((wbs_adr_i[31:0]==32'h300FFFF0) && wbs_sel_i[3])? wbs_dat_i[31:24] :io_l[31:24];
// io_h
io_h[5:0] <= ((wbs_adr_i[3:0]==4'h4) && wbs_sel_i[0])? wbs_dat_i[5:0] :io_h[5:0];
io_h[5:0] <= ((wbs_adr_i[31:0]==32'h300FFFF4) && wbs_sel_i[0])? wbs_dat_i[5:0] :io_h[5:0];
// oeb_l
oeb_l[7:0] <= ((wbs_adr_i[31:0]==32'h300FFFEC) && wbs_sel_i[0])? wbs_dat_i[7:0] :oeb_l[7:0];
oeb_l[15:8] <= ((wbs_adr_i[31:0]==32'h300FFFEC) && wbs_sel_i[1])? wbs_dat_i[15:8] :oeb_l[15:8];
oeb_l[23:16] <= ((wbs_adr_i[31:0]==32'h300FFFEC) && wbs_sel_i[2])? wbs_dat_i[23:16] :oeb_l[23:16];
oeb_l[31:24] <= ((wbs_adr_i[31:0]==32'h300FFFEC) && wbs_sel_i[3])? wbs_dat_i[31:24] :oeb_l[31:24];
// oeb_h
oeb_h[7:0] <= ((wbs_adr_i[31:0]==32'h300FFFE8) && wbs_sel_i[0])? wbs_dat_i[7:0] :oeb_h[7:0];
oeb_h[15:8] <= ((wbs_adr_i[31:0]==32'h300FFFE8) && wbs_sel_i[1])? wbs_dat_i[15:8] :oeb_h[15:8];
oeb_h[23:16] <= ((wbs_adr_i[31:0]==32'h300FFFE8) && wbs_sel_i[2])? wbs_dat_i[23:16] :oeb_h[23:16];
oeb_h[31:24] <= ((wbs_adr_i[31:0]==32'h300FFFE8) && wbs_sel_i[3])? wbs_dat_i[31:24] :oeb_h[31:24];
wbs_ack_o <= 1;
end else if (wbs_cyc_i && wbs_stb_i && !wbs_we_i && !wbs_ack_o && (wbs_adr_i[3:0]==4'h4||wbs_adr_i[3:0]==4'h0)) begin // read
wbs_dat_o <= (wbs_adr_i[3:0]==4'h0)? io_in[31:0] : io_in[`MPRJ_IO_PADS-1:32];
end else if (wbs_cyc_i && wbs_stb_i && !wbs_we_i && !wbs_ack_o && (wbs_adr_i[31:0]==32'h300FFFF4||wbs_adr_i[31:0]==32'h300FFFF0||wbs_adr_i[31:0]==32'h300FFFEC||wbs_adr_i[31:0]==32'h300FFFE8)) begin // read
wbs_dat_o <= (wbs_adr_i[31:0]==32'h300FFFF0)? io_in[31:0] :(wbs_adr_i[31:0]==32'h300FFFF4)? io_in[`MPRJ_IO_PADS-1:32] : (wbs_adr_i[31:0]==32'h300FFFEC) ? io_oeb[31:0]: io_oeb[37:32];
wbs_ack_o <= 1;
end else begin
wbs_ack_o <= 0;
@ -73,7 +87,7 @@ module user_project_gpio_example (
end
assign io_out = {io_h,io_l};
assign io_oeb = 38'h0;
assign io_oeb = {oeb_h,oeb_l};
endmodule

View File

@ -108,42 +108,42 @@ wire [31:0] wbs_dat_o_gpio;
wire [31:0] wbs_dat_o_debug;
// reserve the last 2 regs for debugging registers
`ifndef GPIO_TESTING
// `ifndef GPIO_TESTING
assign wbs_cyc_i_user = (wbs_adr_i[31:3] != 29'h601FFFF) ? wbs_cyc_i : 0;
assign wbs_cyc_i_debug = (wbs_adr_i[31:3] == 29'h601FFFF) ? wbs_cyc_i : 0;
`endif
// `endif
`ifndef GPIO_TESTING
assign wbs_ack_o = (wbs_adr_i[31:3] == 28'h601FFFF) ? wbs_ack_o_debug : wbs_ack_o_debug;
// `ifndef GPIO_TESTING
assign wbs_ack_o = (wbs_adr_i[31:3] == 28'h601FFFF) ? wbs_ack_o_debug : wbs_ack_o_user;
assign wbs_dat_o = (wbs_adr_i[31:3] == 28'h601FFFF) ? wbs_dat_o_debug : wbs_dat_o_user;
`endif
// `endif
// reserve the last 4 regs for debugging registers in case of user gpio testing
`ifdef GPIO_TESTING
assign wbs_cyc_i_user = (wbs_adr_i[31:4] != 28'h300FFFF) ? wbs_cyc_i : 0;
assign wbs_cyc_i_debug = (wbs_adr_i[31:4] == 28'h300FFFF) ? wbs_cyc_i : 0;
`endif
// // reserve the last 4 regs for debugging registers in case of user gpio testing
// `ifdef GPIO_TESTING
// assign wbs_cyc_i_user = (wbs_adr_i[31:4] != 28'h300FFFF) ? wbs_cyc_i : 0;
// assign wbs_cyc_i_debug = (wbs_adr_i[31:4] == 28'h300FFFF) ? wbs_cyc_i : 0;
// `endif
`ifdef GPIO_TESTING
assign wbs_ack_o = (wbs_adr_i[31:4] == 28'h300FFFF) ? (wbs_adr_i[3:0]>=4'h8) ? wbs_ack_o_debug : wbs_ack_o_gpio : wbs_ack_o_debug;
assign wbs_dat_o = (wbs_adr_i[31:4] == 28'h300FFFF) ? (wbs_adr_i[3:0]>=4'h8) ? wbs_dat_o_debug : wbs_dat_o_gpio : wbs_dat_o_user;
`endif
// `ifdef GPIO_TESTING
// assign wbs_ack_o = (wbs_adr_i[31:4] == 28'h300FFFF) ? (wbs_adr_i[3:0]>=4'h8) ? wbs_ack_o_debug : wbs_ack_o_gpio : wbs_ack_o_debug;
// assign wbs_dat_o = (wbs_adr_i[31:4] == 28'h300FFFF) ? (wbs_adr_i[3:0]>=4'h8) ? wbs_dat_o_debug : wbs_dat_o_gpio : wbs_dat_o_user;
// `endif
`ifdef GPIO_TESTING
user_project_gpio_example gpio_testing(
.wb_clk_i(wb_clk_i),
.wb_rst_i(wb_rst_i),
.wbs_cyc_i(wbs_cyc_i_debug),
.wbs_cyc_i(wbs_cyc_i_user),
.wbs_stb_i(wbs_stb_i),
.wbs_we_i(wbs_we_i),
.wbs_sel_i(wbs_sel_i),
.wbs_adr_i(wbs_adr_i),
.wbs_dat_i(wbs_dat_i),
.wbs_ack_o(wbs_ack_o_gpio),
.wbs_dat_o(wbs_dat_o_gpio),
.wbs_ack_o(wbs_ack_o_user),
.wbs_dat_o(wbs_dat_o_user),
.io_in(io_in),
.io_out(io_out),
.io_oeb(io_oeb));