فهرست منبع

Add hardcoded LEDs and buttons.

Signed-off-by: Jakub Duchniewicz <j.duchniewicz@gmail.com>
Jakub Duchniewicz 3 هفته پیش
والد
کامیت
c86d575958
2فایلهای تغییر یافته به همراه37 افزوده شده و 3 حذف شده
  1. 17 1
      projects/riscv_doom/data/top-icebreaker.pcf
  2. 20 2
      projects/riscv_doom/rtl/top.v

+ 17 - 1
projects/riscv_doom/data/top-icebreaker.pcf

@@ -33,9 +33,25 @@ set_io -nowarn uart_tx 9
 set_io -nowarn clk_in 35
 
 # Button
-set_io -nowarn btn 10
+set_io -nowarn btn_n 10
 
 # Leds
 set_io -nowarn rgb[0] 39
 set_io -nowarn rgb[1] 40
 set_io -nowarn rgb[2] 41
+
+# LEDs and Buttons (PMOD 2)
+set_io -nowarn led1       26
+set_io -nowarn led2       27
+set_io -nowarn led3       25
+set_io -nowarn led4       23
+set_io -nowarn led5       21
+set_io -nowarn btn_1       20
+set_io -nowarn btn_2       19
+set_io -nowarn btn_3       18
+
+set_io -nowarn led[0]     26
+set_io -nowarn led[1]     27
+set_io -nowarn led[2]     25
+set_io -nowarn led[3]     23
+set_io -nowarn led[4]     21

+ 20 - 2
projects/riscv_doom/rtl/top.v

@@ -28,12 +28,18 @@ module top (
 	input  wire uart_rx,
 	output wire uart_tx,
 
-	// Button
-	input  wire btn,
+	// Buttons
+    input wire btn_1,
+    input wire btn_2,
+    input wire btn_3,
+    input wire btn_n,
 
 	// LED
 	output wire [2:0] rgb,
 
+    // PMOD LEDs
+    output wire[4:0] led,
+
 	// Clock
 	input  wire clk_in
 );
@@ -141,6 +147,10 @@ module top (
 	wire sync_4x;
 	wire rst;
 
+    // PMOD LEDs
+    reg [4:0] desired_led;
+
+    assign led = desired_led;
 
 	// SoC
 	// ---
@@ -430,6 +440,14 @@ module top (
 		.rst        (rst)
 	);
 
+    // PMOD LEDs
+    always @(posedge clk_1x) begin
+        desired_led[0] = btn_1 & btn_2 & btn_3;
+        desired_led[1] = btn_1;
+        desired_led[2] = btn_2;
+        desired_led[3] = btn_3;
+        desired_led[4] = !btn_n;
+    end
 
 	// Clock / Reset
 	// -------------