Selaa lähdekoodia

projects/riscv_usb: Add WARMBOOT support

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Sylvain Munaut 5 vuotta sitten
vanhempi
commit
4fe4a453e8
1 muutettua tiedostoa jossa 25 lisäystä ja 0 poistoa
  1. 25 0
      projects/riscv_usb/rtl/top.v

+ 25 - 0
projects/riscv_usb/rtl/top.v

@@ -144,6 +144,10 @@ module top (
 	reg  [4:0] led_ctrl;
 	wire [2:0] rgb_pwm;
 
+	// WarmBoot
+	reg boot_now;
+	reg [1:0] boot_sel;
+
 	// Clock / Reset logic
 	wire clk_24m;
 	wire clk_48m;
@@ -473,6 +477,27 @@ module top (
 	assign wb_rdata[5] = wb_cyc[5] ? ep_rx_data_1 : 32'h00000000;
 
 
+	// Warm Boot
+	// ---------
+
+	// Bus interface
+	always @(posedge clk_24m or posedge rst)
+		if (rst) begin
+			boot_now <= 1'b0;
+			boot_sel <= 2'b00;
+		end else if (wb_cyc[0] & (wb_addr[2:0] == 3'b000)) begin
+			boot_now <= wb_wdata[2];
+			boot_sel <= wb_wdata[1:0];
+		end
+
+	// IP core
+	SB_WARMBOOT warmboot (
+		.BOOT(boot_now),
+		.S0(boot_sel[0]),
+		.S1(boot_sel[1])
+	);
+
+
 	// Clock / Reset
 	// -------------