{"id":13439392,"url":"https://github.com/pervognsen/bitwise","last_synced_at":"2025-03-20T08:30:47.687Z","repository":{"id":37484175,"uuid":"124623080","full_name":"pervognsen/bitwise","owner":"pervognsen","description":"Bitwise is an educational project where we create the software/hardware stack for a computer from scratch.","archived":true,"fork":false,"pushed_at":"2019-03-07T09:45:23.000Z","size":1005,"stargazers_count":5109,"open_issues_count":17,"forks_count":212,"subscribers_count":420,"default_branch":"master","last_synced_at":"2024-08-01T03:29:14.354Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pervognsen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-10T04:49:11.000Z","updated_at":"2024-07-30T10:31:55.000Z","dependencies_parsed_at":"2022-07-12T16:19:02.291Z","dependency_job_id":null,"html_url":"https://github.com/pervognsen/bitwise","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pervognsen%2Fbitwise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pervognsen%2Fbitwise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pervognsen%2Fbitwise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pervognsen%2Fbitwise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pervognsen","download_url":"https://codeload.github.com/pervognsen/bitwise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221739701,"owners_count":16872775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:13.512Z","updated_at":"2024-10-27T22:30:49.434Z","avatar_url":"https://github.com/pervognsen.png","language":"C","readme":"# Announcing Bitwise\n\nFeynman's blackboard quote \"What I cannot create, I do not understand\" never fails to give me goosebumps.\n\nI've always been obsessed with how things work under the hood--physical contraptions as well as abstract concepts.\nMost engineers and programmers I've met are motivated by building things, and their knowledge and skills are first\nand foremost a tool for achieving that. But I'm motivated by learning how things work, and the process of solving\nproblems and designing and implementing systems has been a tool for increasing my understanding. And of course there's\nthe unrivaled thrill of seeing what you've built actually work and come alive!\n\nAfter working as a game developer and systems programmer for over 15 years at places like Epic Games, NVIDIA, RAD Game\nTools and most recently Oculus, I decided it was time to take a break from professional programming and spend a few years\npursuing a long-time dream of mine, a project I've dubbed Bitwise, where I want to share my passion and try to demonstrate\nby example how to build systems from scratch, with a low-level computing focus.\n\nHere are some examples of what you will learn to build:\n- Hardware description language compilers and simulators\n- FPGA-based hardware, including CPU, GPU, HDMI controller, Ethernet MAC, DDR3 PHY, etc\n- Kernels, including drivers, hardware abstraction layer, scheduler, virtual memory manager, file systems, TCP/IP stack, etc\n- Systems libraries, including GUIs, memory allocators, etc.\n- Systems applications, including compilers, assemblers, disassemblers, profilers, debuggers, etc\n- Test infrastructure, including property-based testing, directed randomized testing, fuzz testing, etc.\n\nMy goal with Bitwise is to show that these things can be done much more simply and quickly than people realize if we strongly favor\nsimplicity over marginal gains in feature completeness or performance. The goal is not to outdo or compete with any existing product;\nthe goal is to show how things work with real hardware and software.\n\nBitwise will consist of educational videos, articles, and software/hardware source code. The code will be released into\nthe public domain for everyone to study and extend as they see fit. Everything produced as part of the project is free of\ncharge. I'm doing this project as a service to the community and neither ask nor accept financial donations.\n\nDespite the hardware focus, I want to make it clear almost nothing we do will require any special hardware or FPGA development boards\nfor you to participate. All our development will be done with free tools that run on normal Windows, Linux or Mac computers. I will\nperiodically demonstrate code running on real FPGA boards, but it will mostly be for debugging purposes. In fact, we want to minimize\nthe time we spend dealing with real hardware since it's usually painful and time intensive compared to running in simulation.\n\n# Structure\n\n_NOTE:_ This is highly subject to change based on feedback from the community.\n\nMy plan is to treat Bitwise as a full-time commitment for several years. Avoiding burnout is a major priority.\n\nI will be streaming daily or semidaily on Twitch, one or two hours per session. Videos will be posted later on YouTube.\n\nWhen I'm not streaming, I will be working full-time on the project: programming, writing and other related activities.\n\nI will be writing weekly or semiweekly blog posts summarizing the progress since the last update.\n\nCode streams will begin with a code review and walk-through of the diffs that were committed since last stream. Thus,\neven though a lot of the code will necessarily be written off stream, you won't miss out on a single line of code. After\neach review, I will push the latest changes to the GitHub repository, where everyone can download them.\n\nTo keep things fun for myself and viewers, the streams will frequently alternate between different development tracks. In a\ngiven week, streams might alternate between the primary software and hardware development tasks, but you can expect streams on\nrandom side topics to be commonplace. If you're not interested in some topics, there will likely be others to your liking.\n\nMost streams will be focused on live coding, while others will be in a more conventional presentation format.\n\nAside from the progress summary blog posts, I will try to distill what I cover on stream into standalone articles. Writing\narticles is a lot of work, but my hope is that by using my overviews from the stream as a template, I will be able to\nwrite them more quickly than if I had to start with a blank page. The audience for articles is much larger, so this will\nextend the project's reach, and it helps prospective or lapsed viewers to catch up to the streams; it's not practical for\nmost people to catch up by watching archived streams. \n\n# Prerequisites\n\nThe intended audience are fluent C programmers. Python is used as a secondary language, but knowing Python in advance is not\na prerequisite. The pace will be quick; while I will give overviews of many different topics, not everything can be covered\nin depth, so pointers to additional reading material will be provided whenever possible.\n\n# Schedule\n\nThe expected stream schedule is Monday through Friday, 6 PM PDT/9 PM EDT/2 AM CET.\n\nThe kick-off stream is planned for March 12. I expect it will mainly be an overview and Q\u0026A.\n\nThe first major project will be the C-like systems language compiler. I expect the initial work on this to be a few weeks,\nafter which we will start working on the hardware track as well.\n\nI'm located in Thailand, so the schedule is my attempt at juggling time zone differences. I may balance it out by moving some\nstreams to Saturdays or Sundays during morning or noon hours for Europeans. I will be spending a month in Europe each year\nin August, which will force a rotation of the schedule.\n\n# Roadmap\n\n_NOTE:_ This is subject to change, but it gives you an idea of what I have planned. The outline corresponds to an estimated six\nmonths of work, depending on my productivity and how much we decide to focus on the critical path versus side topics.\n\nWe will be building not only software but hardware.\n\nOn the hardware side of things, we will be designing a computer from scratch that can be synthesized and deployed on a real\n[FPGA](https://en.wikipedia.org/wiki/Field-programmable_gate_array). This will include a\n[RISC-V](https://en.wikipedia.org/wiki/RISC-V) CPU, [GPU](https://en.wikipedia.org/wiki/Graphics_processing_unit),\nIO interface controllers for [DDR3](https://en.wikipedia.org/wiki/DDR3_SDRAM) memory, HDMI video/audio, Ethernet networking, and more.\n\nBut before getting there, we will need to learn about digital logic and how to design hardware with an\n[HDL](https://en.wikipedia.org/wiki/Hardware_description_language). In fact, we will designing our own HDL and the associated\ntoolchain, including software-based simulators and debugging tools. Along the way we'll be doing lots of fun mini-projects,\nlike designing a version of [Pong](https://en.wikipedia.org/wiki/Pong) entirely using logic gates, and implementing a variant of the\ntoy parallel computer used in the Zachtronics game [TIS-100](https://en.wikipedia.org/wiki/TIS-100).\n\nIn tandem, we will also be building the software stack. This includes both the host-side tooling as well as the software that\nruns on the Bitwise computer. Eventually most of the host tooling will be portable to the Bitwise computer itself! This toolchain\nwill start with a simple but powerful C-like systems programming language that will initially be bootstrapped to run on the host\nand which we will use to construct all the other software. As we first bring up the CPU, we will be writing the emulator, assembler,\ndisassembler and debugger in this language.\n\nFrom there we'll be writing test programs in the assembly language to validate the CPU. Once the CPU is in a usable state, we will\ncode a backend for our systems language compiler that targets our CPU and so start running simple compiled programs on it. At that point\nwe will build a simple microcontroller-class task-switching operating system and some simple applications on top of it.\n\nAt first, the CPU will be a simple RV32I microcontroller-class core with limited features and performance, and the only IO peripheral\nwill be a [UART](https://en.wikipedia.org/wiki/Universal_asynchronous_receiver-transmitter) for communicating with the host. Over time\nwe will make this more capable. We will extend the CPU to eventually support RISC-V's RV32G profile, which includes support for integer\nmultiply/divide and floating point instructions. To improve performance we will add instruction pipelining and branch prediction,\nand caches once we have DRAM support. We will also be building out our peripherals to support audio/video output and\nnetworking, and the software to support this will be constructed in parallel as the hardware comes online.\n\nEventually we will end up with a simple desktop-class operating system with a graphical user interface that can run games and other\napplications we've written. We might eventually try to bring up Linux on the computer once we've implemented MMU support, but that\nis not a primary goal.\n\nAnd this is only the beginning!\n\n# Links\n\nPlease follow on Twitch, YouTube and Twitter to see when streams go live and when new videos are uploaded.\n\nThere is a Discord chat server if you have questions or just want to hang out and chat.\n\n- GitHub: https://github.com/pervognsen/bitwise\n- Forums: https://bitwise.handmade.network/forums\n- Discord chat server: https://discord.gg/7TSA6ZF\n- Twitch channel: https://twitch.tv/pervognsen\n- YouTube channel: https://youtube.com/pervognsen\n- Twitter: https://twitter.com/pervognsen\n","funding_links":[],"categories":["C","C++","Operating Systems","Michael Henderson (robedcoder / leadcoder)"],"sub_categories":["Per Vognsen"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpervognsen%2Fbitwise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpervognsen%2Fbitwise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpervognsen%2Fbitwise/lists"}