logo piotro.eu Blog About me Projects Research Achievements Contact GitHub
me
Contact me at image with email address
PGP fingerprint

1376 F776 D2F3 19E1 797A 7A0D A7ED 7053 27A9 E923

Download key
════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════

My name is Piotr Węgrzyn. I'm mainly interested in low-level stuff (especially lower than assembly :)), and everything at the boundary of programming and electronics.

My biggest project so far is the PCPU - processor that I created completely from scratch, from the instruction set, through architecture, compilers, custom dev board, FPGAs, own operating system, and multiple re-designs, finally achieving manufactured silicon integrated circuit. I was doing this project throughout my high school, with no previous background, learning everything on my errors.

I'm currently a student at the University of Wrocław, where I'm participating in the Coreblocks project, creating Out-of-Order processor generator. I'm also a president of "Continuum" Students Association, promoting electronics and mechanics in our Institute of Computer Science.

I'm keeping electronics and radio as a hobby, doing some interesting projects from time to time. I enjoy sailing, climbing, old technology, sometimes photography and drawing too.

I love open source software and unix based systems. I'm also interested in networking aspects and servers - this website is (of course) proudly self-hosted.

You could have heard about me from the mentioned PCPU project, my research work, competitions, or maybe my talks.

~ Go your own route and never give up!

══════ --- VISUAL --- ═══ #about ═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
════ Bot ════╣
3rd Place Grand Award in Embedded Systems
Biggest international competition for young scientists, with over 1600 projects (2000 students) selected from 70 countries! I participated with my project - "Extending PCPU: a new, practical, and production-ready processor core" Read more about PCPU here
ISEF logo
1st Place (team)
1st Place on FPGA Hackathon with Kuźnia Rdzeni team. ~150 participants from 15 countires, solving FPGA tasks in 24h long competition
ISEF logo
1st place Grand Award and ISEF accreditation
National high-school student competition for STEM projects.
Explory logo
Olympiad in Informatics, Warsaw, 2023
OI logo
Winter Informatics Students Camp A (ZOSIA) 2024
Best rated student talk
═══ #achievements ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════

Student at the University of Wrocław
Graduated: XIV High School Wrocław

My research work:

[2022, +inf)
Coreblocks

I'm one of the main developers of the Coreblocks project. It is an open source Out-of-Order RISC-V processor generator. We are working on it with Kużnia Rdzeni (Coreforge) academic research group at the University of Wrocław.

Coreblocks is created in a very modular way using our Transcatron library for Amaranth HDL. It supports many configuration options and with its modular design is a great option for performing research. Long term goal is to approach the state of the art of current processors. It currently supports RV32IMCB architecture. It is fully functional and can be easily used on FPGAs with LiteX SoC generator.

The only similar projects are BOOM core from the University of California and XiangShan from the Chinese Academy of Sciences, our being the most customizable one (work is still in progress, while it is perfectly usable for simpler targets for now). We are currently focusing on implementing previously simplified, performance improving elements and extending functionality to more extensions, and integrating with more tools and systems.

Some parts that I implemented in the project are: exception and miss-speculation internal core flushing; interrupt controller; control and status registers (CSR); immediate support; wishbone bus; porting LiteX; and parts of CI testing

My (loosely defined) goal in the project is to make it capable of running Linux. Currently, I'm working/planning to work on: checkpointing; non-blocking coherent data cache; multi-core configurations; chipyard support; porting Zephyr RTOS; and RISC-V user and supervisor mode

Make sure to check it out! Coreblocks @ GitHub

Coreblocks logo
[2019, 2024]
PCPU - processor and complete computing system created completely from scratch

PCPU is a project that I created while studying in high school. It was entirely driven by my curiosity - I started working on it with no prior knowledge in this field. I had to learn everything myself, on my own errors, and it was really hard... While designing every detail of the project, I tried to learn and take the best from already existing solutions, mix that with some of my ideas, and create something interesting and unique.

During my work on the PCPU I also got interested in other interconnected fields of study and created other related projects. My work included:

  • custom 16-bit RISC type Instruction Set Architecture
  • 3 independent revisions of the processor, the last one being a -
  • 4-stage pipeline based architecture running at 53MHz on FPGA
  • processor core including MMU and caches
  • SoC connecting multiple cores with hardware interface drivers
  • custom development PCB with FPGA and peripherals
  • piOS operating system, featuring address space isolation, IPC, VFS
  • port of llvm compiler to my ISA
  • libraries for userspace applications
  • port of llvm compiler to my ISA
  • and finally... real silicon IC tape-out of my processor
Everything (except for the ported LLVM part) was created completely from scratch, with no external dependencies.

Finally, it was an awesome adventure, where I started with the simplest processor design on paper, and ended up hand-crafting my very own complete computer

More details on the entire project are available in the projects section or my talks

PCPU logo
My talks at conferences [pl]:
How to write your own computer? - Talks about the development of the PCPU project
  • [pl] Winter Informatics Students Camp A (ZOSIA) 2024
    "Jak napisać sobie komputer? O PCPU słów więcej niż kilka" (1h 20min) slides + audio recording

    About interesting aspects of 4 year history creating the full PCPU project [best rated talk]

  • [pl] Linux session 2024
    "Jak napisałem sobie komputer? (40 min) video recording

    Shortened version of the talk above (without a section about silicon), video recording available

═══ #research ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
 ________  ________  ________        ___  _______   ________ _________  ________
|\   __  \|\   __  \|\   __  \      |\  \|\  ___ \ |\   ____\\___   ___\\   ____\
\ \  \|\  \ \  \|\  \ \  \|\  \     \ \  \ \   __/|\ \  \___\|___ \  \_\ \  \___|_
 \ \   ____\ \   _  _\ \  \\\  \  __ \ \  \ \  \_|/_\ \  \       \ \  \ \ \_____  \
  \ \  \___|\ \  \\  \\ \  \\\  \|\  \\_\  \ \  \_|\ \ \  \____   \ \  \ \|____|\  \
   \ \__\    \ \__\\ _\\ \_______\ \________\ \_______\ \_______\  \ \__\  ____\_\  \
    \|__|     \|__|\|__|\|_______|\|________|\|_______|\|_______|   \|__| |\_________\
╞╡ PCPU
╘════╡PPCPU - Pipelined PCPU
This is the third revision of a 16-bit PCPU processor with custom, designed from scratch RISC-type architecture.
It is a direct upgrade to the previous pcpu core - it uses almost the same instruction set, but internally is a cleaner, more modern, faster, and advanced pipelined processor. Additionally, it features caches and multi-core operation. It runs at 52MHz @ Cyclone IV FPGA. Processor core features:
  • 16-bit custom RISC-type architecture
  • 4-stage pipelined microarchitecture
  • Multi-core operation
  • Memory paging, virtualization and protection
  • 24-bit address space of Compressed Wishbone Bus
  • Internal and external interrupts
  • Bootloader
  • Instruction and data caches
The cores are packaged into System on Chip with:
  • SDRAM controller (most of the address space)
  • VGA graphics card with text mode
  • ROM with bootloader, that listens for commands on serial port
  • UART interface
  • I2C interface
  • SPI interface
  • Interrupt controller
  • Programmable timers
  • PS/2 interface
SoC is the top-level project flashed into FPGA on my development board. It communicates with outer-level processor via decompressing the custom CW bus back to the Wishbone. Check it out on GitHub
PCPU custom development board, with FPGA, SDRAM, SD card, VGA, UART, PS/2...
Schematic of PPCPU core
Schematic of PPCPU outer processor
╘════╡PPCPU on the silicon!

PPCPU was manufactured on Silicon on both 180nm and 130nm processes, using open source OpenLane flow. I got it from the OpenMPW shuttle program (Thanks!).

The manufactured part is the outer-level processor (including two PPCPU cores, MMUs, I/D caches, and interconnects). It can execute code from small internal memory, which is programmable externally via SPI bridge or connected via full CW (Compressed Wishone, to fit with limited I/O pins) systems bus to an external FPGA providing hardware drivers for larger memory and peripherals.

I got the first IC manufactured and tested, and not everything is working. To be precise all the LOAD and STORE instructions... Sadly, a processor with side effects is not a very useful one, but wait a moment - is it really without side effects??? NO!
I was able to confirm that all other instructions work correctly after monitoring the system bus activity, after injecting conditional jumps and watching for change in addresses fetched by the instruction cache. You could even emulate load and stores with that setup (if you would be really desperate...). And the second IC design should be on the way soon.

Enjoy some nice pictures while I'm working on the blog post for this very interesting, but difficult and not popular topic of designing ASICs from beginner level. and 2nd IC testing results

PPCPU silicon tape-out routing congestion diagram. (From top to bottom, then side to center: Data Cache, Instruction Cache (x2), Inner Interconnect, PPCPU core (small one x2), On-Chip SRAM, Outer Interconnect)
PPCPU bare silicon die. (This is the 1st design, different from the diagram)
╘════╡piOS - Operating System for PCPU

Started as some interesting demo for my processor...
and ended up as a fully featured operating system:

  • Runs on 16 bit custom procesoor ppcpu!
  • Fully isolated userspace processes support
  • IPC mechanisms
  • Virtual filesystem with UNIX-like devices and mounting other FSes
  • Basic libc implementation
  • UNIX-like syscalls
  • Async I/O
  • Synchronization primitives
  • TAR filesystem support from SD card
  • Multiple peripheral drivers
It can run preemptively multiple isolated processes in userspace, loaded from ELF file, from the SD card, that is mounted in the VFS!

See piOS on GitHub

piOS booting
piOS running mockup of IPC industrial control system
╘════╡llvm-pcpu

To continue work on the project, after a long journey with porting gcc and working with it (on piOS) wrapped in multiple glue logic scripts, I felt like it should be done properly this time.

In 3 months, I managed to create a complete LLVM backend for my ISA. Ported projects also include clang frontend (currently only C is supported), lld linker, and binary utilities. → This is a complete toolchain!

Check it out with build instructions on GitHub
╞╡ Coreblocks

Awesome RISC-V Out-of-Order processor generator, created with Kuźnia Rdzeni (Coreforge) research group!

Read more about it and my work on this project in the research section or check it out on GitHub
╞╡ Other programming projects
C
Python
Amaranth
C++
Verilog
Java
Rust
OCaml
╘════╡sondechaser

Have you ever dreamed of free dev boards falling from the sky? Look no further - meteorological departments send single-use ones up in the sky every day. Those are commonly known as radiosondes.

There are dedicated radio receiver networks, maintained by volunteers, to track and predict landing locations of sondes. That makes it a great terrain game!

I made an app to help track them in low-internet and mobile terrain conditions, combing data from two online sources, and your local radio receiver, all on one screen

I also wrote custom STM firmware, to re-use the sondes as radio beacons (on licensed amateur band) and C++ FSK transmission decoder from raw audio frames.

Source and .apk releases are available at GitHub. You can also support me by purchasing the app on Google Play

My radiosondes collection
╘════╡hydraulik

(Not finished). Hardware "framework" for creating network applications. Works by providing a common protocol parsing pipeline for incoming packets, that user modules can register to with specified filters. If decoded protocol fields are matched to the filter of the attached user sink moudules, then packet is delegated for processing to the highest priority sink. Sink modules can quickly modify the packet and resend it, or drop the packet and generate and send a new one in response.

Interesting examples shipped with the project:

  • GPS disciplined precise NTP server (everything is handled in hardware, network response achieved in the minimal possible number of cycles)
  • simple UDP router based on PPCPU processor communicating with the framework interface

hydraulik @ GitHub.

class ZlewBezDziury(Protocol):
╘════╡jail

(Ab)using linux apis to create a sandbox with instrumentation for automatic judging of competitive programming solutions

GitHub
╘════╡Archive - older projects
  • rest2api - minimalistic Java REST API framework - GitHub
  • oic - script suite for verifying (generate, run test packs, measure) Olympiad in Informatics solutions. Could be still useful for someone - GitHub
  • piotro.eu - this page! no need for an explanation here
╞╡ Electronics gallery
/dev/pkbd Planck keyboard

DIY 40% ortho planck keyboard, I use it as my main keyboard, and it is great!

Designed PCB for it, layouts, and the 3D printed enclosure. Colemak gang btw.

Analog to the last step 125 kHz RFID transponder

Who needs RFID modules anyway?

With a fully analog frontend, producing an output signal sampled by a single digital pin on an ESP32 microcontroller. RFID decoding is handled in ESP32, with a bluetooth serial-console interface.

(too simple) HF SDR

[Software defined radio] Experiment to try creating SDR radio on the most basic level.

On the picture: discrete diode ring mixer, single-transistor amplifier, output opamp and some filtering. It is connected to STM32, feeding ADC samples directly to the computer, pushing the built-in USB CDC transfer to the limit. The data is converted by a python script to network format that is readable with GQRX software (~200kHz bandwidth)

When measuring the frontend on the bench I almost decided to trash it, but finally I gave it a shot. Believe it or not, it worked (first try)! It received Radio Romania Internationale and even Polish language transmission from China Radio International.

//TODO: blog post pending
Nixe clock (GPS synchronized)
This was my first PCB design :) ! And those beautiful nixe tubes... with time accurate to microseconds.
Pure hackery trackball

Trackball made from an off-the-shelf mouse, some 3D printing, a bilard ball, keyboard switches, and a lot of hacky wires

It has a unique, accidentally invented button layout, that I find very comfortable

The goal of the project was to not modify any software (at mouse level) this time - everything is remapped with libinput settings

Turned out way better than I expected!

[Massive hand-held] Dual 2m/70cm 5+4 element Yagi-Uda Antenna
My attempt building [I can't find the original source now] antenna. Of course, all tuned dimensions turned out to be entirely different and non-sensical, but SWR is great. // TODO: post with dimensions and tricks if you want to build one!
Tesla Coil
with 3rd revision of my driver design. Interesting aspects of driving with feedback and high-frequency mid-power switching. It even plays music :0 (classical music sounds the best on arcs)
═══ #projects ═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════