Fix bug in picosoc spimemio and some cleanups in hx8kdemo

This commit is contained in:
Clifford Wolf 2017-08-08 12:07:17 +02:00
parent 8821696748
commit 89ad9fc85a
3 changed files with 29 additions and 18 deletions

View File

@ -13,12 +13,12 @@ set_io flash_io3 P8 # center on J3
set_io ser_tx B12
set_io ser_rx B10
set_io leds[0] B5 # LED0
set_io leds[1] B4 # LED1
set_io leds[2] A2 # LED2
set_io leds[3] A1 # LED3
set_io leds[4] C5 # LED4
set_io leds[5] C4 # LED5
set_io leds[6] B3 # LED6
set_io leds[7] C3 # LED7
set_io leds[7] B5 # D9
set_io leds[6] B4 # D8
set_io leds[5] A2 # D7
set_io leds[4] A1 # D6
set_io leds[3] C5 # D5
set_io leds[2] C4 # D4
set_io leds[1] B3 # D3
set_io leds[0] C3 # D2

View File

@ -62,22 +62,31 @@ module hx8kdemo (
reg [31:0] iomem_rdata;
reg [31:0] gpio;
reg [4:0] gpio_shr;
assign leds = gpio >> 12;
assign leds = gpio >> gpio_shr;
always @(posedge clk) begin
iomem_ready <= 0;
if (iomem_valid && !iomem_ready && iomem_addr[31:24] == 8'h 02) begin
iomem_ready <= 1;
iomem_rdata <= gpio;
if (iomem_wstrb[0]) gpio[ 7: 0] <= iomem_wdata[ 7: 0];
if (iomem_wstrb[1]) gpio[15: 8] <= iomem_wdata[15: 8];
if (iomem_wstrb[2]) gpio[23:16] <= iomem_wdata[23:16];
if (iomem_wstrb[3]) gpio[31:24] <= iomem_wdata[31:24];
if (!resetn) begin
gpio <= 0;
gpio_shr <= 0;
end else begin
iomem_ready <= 0;
if (iomem_valid && !iomem_ready && iomem_addr[31:24] == 8'h 02) begin
iomem_ready <= 1;
iomem_rdata <= gpio;
if (iomem_wstrb[0]) gpio[ 7: 0] <= iomem_wdata[ 7: 0];
if (iomem_wstrb[1]) gpio[15: 8] <= iomem_wdata[15: 8];
if (iomem_wstrb[2]) gpio[23:16] <= iomem_wdata[23:16];
if (iomem_wstrb[3]) gpio[31:24] <= iomem_wdata[31:24];
end
if (&leds && gpio_shr < 10) begin
gpio_shr <= gpio_shr + 1;
end
end
end
picosoc uut (
picosoc soc (
.clk (clk ),
.resetn (resetn ),

View File

@ -105,6 +105,7 @@ module spimemio (
state <= 0;
xfer_resetn <= 0;
rd_valid <= 0;
buffer_wen <= 0;
din_cont <= 0;
din_qspi <= 0;
din_ddr <= 0;
@ -220,6 +221,7 @@ module spimemio (
rd_inc <= 0;
rd_valid <= 0;
xfer_resetn <= 0;
buffer_wen <= 0;
state <= 4;
end
end