Basys 3 RISC-V computer
The Basys 3 Z-80 computer with the Z-80 replaced by an RV32IM processor written from scratch (rtl/rv32_cpu.v): multi-cycle, 90 MHz, CSRs and traps, interrupts, two hardware triggers and a resumable NMI for the monitor. Passes riscv-tests rv32ui/um/mi. rv32_system.v keeps all the Z-80 machine's peripherals, with I/O port N at FFFFFF00h + N, 80 KB of RAM with BASIC preloaded, and a 32 KB monitor ROM. BASIC, the five games and the monitor (with an RV32 disassembler, assembler, breakpoints and single step) are ported to RISC-V GCC. Python emulator and tests in tools/; full-system simulation in sim/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
5930b958b4
103 files changed
+55677
No files matched your search
@@ -0,0 +1,29 @@
|
||||
`timescale 1ns / 1ps
|
||||
|
||||
// Four-digit hex display, digit 3 (left) = value[15:12]. Segments active low.
|
||||
module sevenseg (
|
||||
input clk,
|
||||
input [15:0] value,
|
||||
output reg [6:0] seg,
|
||||
output reg [3:0] an
|
||||
);
|
||||
reg [17:0] cnt;
|
||||
always @(posedge clk) cnt <= cnt + 1'b1;
|
||||
|
||||
wire [1:0] d = cnt[17:16];
|
||||
wire [3:0] x = value[d*4 +: 4];
|
||||
|
||||
always @(posedge clk) begin
|
||||
an <= ~(4'b0001 << d);
|
||||
case (x) // gfedcba
|
||||
4'h0: seg <= 7'b1000000; 4'h1: seg <= 7'b1111001;
|
||||
4'h2: seg <= 7'b0100100; 4'h3: seg <= 7'b0110000;
|
||||
4'h4: seg <= 7'b0011001; 4'h5: seg <= 7'b0010010;
|
||||
4'h6: seg <= 7'b0000010; 4'h7: seg <= 7'b1111000;
|
||||
4'h8: seg <= 7'b0000000; 4'h9: seg <= 7'b0010000;
|
||||
4'hA: seg <= 7'b0001000; 4'hB: seg <= 7'b0000011;
|
||||
4'hC: seg <= 7'b1000110; 4'hD: seg <= 7'b0100001;
|
||||
4'hE: seg <= 7'b0000110; 4'hF: seg <= 7'b0001110;
|
||||
endcase
|
||||
end
|
||||
endmodule
|
||||
Reference in new issue
Block a user