- RISCBoy एक handheld game console है जिसे RISC-V compatible CPU से लेकर graphics pipeline, display controller, memory और peripheral infrastructure, और KiCad PCB तक खुद डिज़ाइन किया गया है
- यह Game Boy Advance जैसा बनने का लक्ष्य रखता है, जैसा शायद 2001 में RISC-V मौजूद होता तो बनता; इसे synthesizable Verilog 2005 में लिखा गया है और 7,680 logic elements वाले iCE40-HX8k FPGA पर 32-bit console लागू करता है
- processor RV32IMC instruction set के साथ M-mode CSR, exceptions और vectored external interrupts को सपोर्ट करता है, और RISC-V compliance tests तथा
riscv-formal verification पास करता है
- synthesis के लिए Yosys, nextpnr और Project Icestorm open source toolchain का उपयोग किया गया है, और ECP5 boards तथा छोटे iCE40 UP5k के लिए RV32I configuration भी सपोर्ट करता है
- simulation और official development environment मुख्य रूप से Linux पर आधारित हैं, और PCB Rev B, bootloader/gateware तथा software tree अभी development में हैं
शुरुआत से बनाया गया handheld console
- RISCBoy के public design scope में ये शामिल हैं
- RISC-V compatible CPU
- raster graphics pipeline और display controller
- chip infrastructure जैसे bus fabric, memory controller, UART, GPIO
- KiCad में बनाया गया PCB layout
- लक्ष्य एक parallel world का Game Boy Advance है, जहां RISC-V 2001 में मौजूद था, और यह बचपन के handheld consoles तथा उन्हें चलाने वाली technology के प्रति लगाव से बना project है
- अधिक विस्तृत design जानकारी repository के
doc/riscboy_doc.pdf document में देखी जा सकती है
FPGA implementation और processor
- design synthesizable Verilog 2005 में लिखा गया है, और LUT4-based FPGA iCE40-HX8k के लिए target किया गया है
- HX8k 7,680 logic elements देता है
- सीमित resources में 32-bit game console fit करने के लिए careful design की जरूरत होती है
- HX8k कभी open source Project Icestorm toolchain द्वारा supported सबसे बड़ा FPGA था, और बाद में related ecosystem Project Trellis और Project X-Ray तक फैला
- processor RV32IMC instruction set को सपोर्ट करता है
- इस instruction set के लिए RISC-V compliance tests पास करता है
- riscv-formal verification suite पास करता है
- instruction frontend consistency और basic bus compliance जांचने के लिए अपनी formal property verification भी लागू करता है
- M-mode CSR और exceptions को सपोर्ट करता है, और vectored external interrupts के लिए एक simple compliant extension भी देता है
repository clone और toolchain
- HDL और tests के लिए Git submodules इस्तेमाल होते हैं, इसलिए recursive clone इस तरह करना होगा
git clone --recursive https://github.com/Wren6991/RISCBoy.git riscboy
- सामान्य clone के बाद submodules को अलग से initialize किया जा सकता है
git clone https://github.com/Wren6991/RISCBoy.git riscboy
cd riscboy
git submodule update --init --recursive
- recursive submodule update processor के standalone tests के लिए जरूरी है, लेकिन RISCBoy gateware build के लिए जरूरी नहीं है
- software-based tests compile करने के लिए RISC-V GNU Toolchain को RV32IMC और ILP32 configuration के साथ build करना होगा
./configure --prefix=/opt/riscv \
--with-arch=rv32imc \
--with-abi=ilp32 \
--with-multilib-generator="rv32i-ilp32--;rv32ic-ilp32--;rv32im-ilp32--;rv32imc-ilp32--"
- iCE40 UP5k जैसे छोटे FPGA पर high-performance RV32IMC की जगह छोटा RV32I processor variant इस्तेमाल किया जा सकता है
- compiler RISCBoy के कई ISA variants सपोर्ट करे, फिर भी हर variant के लिए सही standard libraries generate हों, इसके लिए multilib configuration जरूरी है
- RV32I-only processor पर RV32IMC standard library से linked RV32I executable चलाने पर समस्या हो सकती है
simulation और testing
- simulation flow Xilinx ISIM 14.x और
scripts/ directory के Makefile का उपयोग करता है
- केवल Linux version ISIM पर test किया गया है
- अगर ISIM default path के अलावा कहीं install है, तो
sourceme का path adjust करना पड़ सकता है
- HDL-level tests चलाने की प्रक्रिया यह है
git submodule update --init --recursive
. sourceme
cd test
./runtests
- software tests के लिए RV32IC toolchain चाहिए
- किसी individual test को graphical environment में debug करने के लिए संबंधित Makefile सीधे चलाएं
cd system
make TEST=helloworld gui
PCB design
- Rev A PCB iTead की 4-layer 5×5cm prototyping service के साथ compatible है
- README लिखे जाने के समय cost 10 boards के लिए 65 dollars थी
- schematic repository के
board/fpgaboy.pdf में देखा जा सकता है
- Rev B का form Rev A से काफी अलग होने वाला है, और आगे बढ़ने से पहले gateware और bootloader के mature होने का इंतजार किया जा रहा है
- मौजूदा development hardware Snowflake FPGA board जैसा है
synthesis और supported boards
- iCE40 के लिए FPGA synthesis में यह open source toolchain इस्तेमाल होता है
- इन tools को Linux पर ही directly build करके verify किया गया है; Windows builds संभव बताए गए हैं, लेकिन test नहीं किए गए
- Raspberry Pi पर भी toolchain build किया जा सकता है
- Lattice HX8k evaluation board के लिए FPGA image इस command से generate होती है
. sourceme
cd synth
make -f HX8k-EVN.mk bit
- Lattice LEF5UM5G-85F-EVN evaluation board के लिए ECP5 support भी दिया गया है, लेकिन यह main development platform नहीं बल्कि highly experimental configuration है
make -f ECP5-EVN.mk BUILD=full bit
- ECP5 build, development hardware की external 512KiB 16-bit SRAM को internal 256KiB 32-bit synchronous memory से replace करता है
- इस memory को Trellis ECP5
sysmem blocks के रूप में configure करता है
repository structure
board: RISCBoy main PCB और development में इस्तेमाल की गई छोटी boards की KiCad files
doc: documentation के LaTeX source, diagrams और latest built PDF
hdl: RISCBoy gateware के Verilog sources
busfabric: AHB-lite crossbar और APB peripheral fabric
graphics: pixel processing unit source
hazard5: पूरी तरह independently structured RISC-V processor source
mem: memory controllers और memory inference/injection wrappers तथा models
peris: छोटे peripherals जैसे UART, SPI, PWM
riscboy_core: structural module जो RISCBoy components को instantiate और connect करता है
riscboy_fpga: top-level wrapper जो कई FPGAs और boards के I/O, clocks और resets को connect करता है
reference: RISCBoy में इस्तेमाल किए गए standards PDFs, जैसे RISC-V instruction set
scripts: scripts जो किसी अन्य directory से संबंधित नहीं हैं
software: system-level tests में इस्तेमाल होने वाली C files का collection; अभी practical software tree नहीं है
synth: पूरे system synthesis के लिए working directory, जिसमें top-level Makefile और pin constraint files शामिल हैं
test: regression tests का collection, जिसमें Verilog testbenches और processor या पूरे system simulation में चलने वाले software test cases शामिल हैं
1 टिप्पणियां
Hacker News की राय
GitHub पेज इसे एक समानांतर ब्रह्मांड का Game Boy Advance, जहां RISC-V 2001 में मौजूद था बताता है।
इसे बचपन के handheld console के लिए एक love letter और उस console को चलाने वाली technology को रात 3 बजे नशे में भेजे गए message जैसा project बताया गया है।
यह Luke Wren का काम है, जो Raspberry Pi में ASIC design engineer हैं। वाकई शानदार project है।
इसी developer ने RP2040 पर DVI/HDMI implement करने वाला PicoDVI भी design किया था।
https://github.com/Wren6991/PicoDVI
Hazard5core से निकला हुआ project है।GBA को cache-रहित architecture के रूप में design किया गया था। internal RAM, video RAM, I/O registers, BIOS, OAM, palette आदि को छोड़ दें तो हर access external bus से होकर जाता है, और cache के बिना external bus इस्तेमाल करने पर यह असल में 1980s के computers जितना धीमा हो जाता है। cartridge से instructions fetch करने की speed भी GBC की लगभग सिर्फ दोगुनी है।
इससे बचने के लिए cache इस्तेमाल करके कई words sequentially fetch करने होंगे। sequential access की speed बढ़ाने से throughput बढ़ता है, और अगर instructions व data पर्याप्त रूप से cache हो जाएं तो latency छिपाई जा सकती है। यह system हर fetch को memory bus पर भेजता है या cache इस्तेमाल करता है, यह जानने की जिज्ञासा है।
इस design का wafer.space के पहले production run में tape-out हुआ था (https://github.com/wafer-space/ws-run1 देखें), लेकिन यह सच में सही तरीके से चला या नहीं, यह सुनने को नहीं मिला।
PDF में बताया गया programmable scanline buffer-based rendering pipeline अगर ऐसी technology में रुचि है तो पढ़ने लायक है।
मुझे ऐसे projects बहुत पसंद हैं जो समानांतर ब्रह्मांड के hardware की कल्पना करके उसे बनाते हैं।
इस नए hardware architecture को अपनाते समय सबसे बड़ी बाधा खुद technology है या मौजूदा developer ecosystem और software toolchain की कमी, यह जानने की जिज्ञासा है।
software tools की कमी से निपटा जा सकता है, लेकिन game libraries की कमी बड़ी बाधा है। खासकर अगर मौजूदा titles को बहुत आसानी से port करने का तरीका न हो।
यह जानकर हैरानी हुई कि अंदर open source AHB/APB implementation का इस्तेमाल किया जा सकता है। मुझे लगा था यह ARM की proprietary technology है, इसलिए अब तक इसे गहराई से नहीं सीखा था।
मुझे लगता है इस project के developer हमारे समय के सबसे बेहतरीन engineers में से एक हैं। यह project अपने आप में कमाल है, लेकिन उन्होंने RP2350 का Hazard3 core और QSPI device भी design किया है।
खासकर वह QSPI device अब तक मिले memory-mapped QSPI devices में अकेला ऐसा है जिसे मैं crash या hang नहीं करा पाया।