Skip to content

Commit 1d6c3f2

Browse files
committed
Updating Basline GHRD files
1 parent 23a58fc commit 1d6c3f2

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

niosv_m/niosv_m_baseline_ghrd/sources/hw/top.sv

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,23 @@ module top (
5353

5454
assign n_pll_lock = !pll_lock;
5555

56-
reg [3:0] pio_1_pb;
56+
wire [3:0] pio_1_pb;
5757

5858
// Switch debounce logic
5959
pb_debounce pb_debounce_inst(
6060
.clk(pll_outclk_0),
6161
.pb_in(pio_1_external_connection_export),
6262
.pb_out(pio_1_pb)
63-
);
64-
63+
);
6564

65+
wire [3:0] qsys_led_output;
66+
assign pio_0_external_connection_export = qsys_led_output & pio_1_pb;
67+
68+
6669
qsys_top u0 (
6770
.clk_clk(pll_outclk_0), // input, width = 1, clk.clk
68-
.pio_0_external_connection_export (pio_0_external_connection_export), // Connect to LEDs
69-
.pio_1_external_connection_export (pio_1_pb), // Connect to Push Button
71+
.pio_0_external_connection_export (qsys_led_output), // Connect to LED
72+
.pio_1_external_connection_export (pio_1_pb), // Comment it if lED assigned
7073
.reset_controller_0_reset_in0_reset(n_pll_lock)
7174
);
7275

niosv_m/niosv_m_baseline_ghrd/sources/sw/app/main.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,27 @@ int pio_test()
6565
{
6666
int count = 0;
6767
int i;
68+
int iter = 0;
6869
int pio_err = 0;
6970
printf("Application to toggle the PIOs- [4:0] \n");
7071

71-
while (count < 64)
72+
// increase the below value while testing the leds on board
73+
while (iter < 10000)
7274
{
75+
if (count == 64)
76+
{
77+
count = 0;
78+
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, 0xf);
79+
}
7380
// Generate a test pattern to write to PIO
7481
i = count & 0xf;
7582
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, count & 0xf);
83+
// IORD_ALTERA_AVALON_PIO_DATA(PIO_1_BASE);
7684
usleep(100);
7785

7886
// Read back value from PIO
7987
printf("DATA READBACK FROM PIO_0_BASE is 0x%x \n", IORD_ALTERA_AVALON_PIO_DATA(PIO_0_BASE));
88+
printf("DATA READBACK FROM PIO_1_BASE is 0x%x \n", IORD_ALTERA_AVALON_PIO_DATA(PIO_1_BASE));
8089

8190
// Verify the read-back value matches expected pattern
8291
if (i != IORD_ALTERA_AVALON_PIO_DATA(PIO_0_BASE))
@@ -89,6 +98,7 @@ int pio_test()
8998
printf("DATA MATCHED - TEST PASSED \n");
9099
}
91100
count++;
101+
iter++;
92102
}
93103
return pio_err;
94104
}

0 commit comments

Comments
 (0)