{"id":13537323,"url":"https://github.com/antonblanchard/microwatt","last_synced_at":"2025-04-12T09:17:48.038Z","repository":{"id":35391180,"uuid":"203724916","full_name":"antonblanchard/microwatt","owner":"antonblanchard","description":"A tiny Open POWER ISA softcore written in VHDL 2008","archived":false,"fork":false,"pushed_at":"2025-04-11T04:56:17.000Z","size":67602,"stargazers_count":680,"open_issues_count":46,"forks_count":101,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-04-12T09:17:35.512Z","etag":null,"topics":["openpower","ppc64le","processor","vhdl"],"latest_commit_sha":null,"homepage":"","language":"Verilog","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/antonblanchard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-22T06:02:52.000Z","updated_at":"2025-04-11T04:56:25.000Z","dependencies_parsed_at":"2023-01-15T20:01:13.956Z","dependency_job_id":"81a41322-206c-403b-9001-fed1c616e3e1","html_url":"https://github.com/antonblanchard/microwatt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonblanchard%2Fmicrowatt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonblanchard%2Fmicrowatt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonblanchard%2Fmicrowatt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonblanchard%2Fmicrowatt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonblanchard","download_url":"https://codeload.github.com/antonblanchard/microwatt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248543837,"owners_count":21121838,"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":["openpower","ppc64le","processor","vhdl"],"created_at":"2024-08-01T09:00:57.632Z","updated_at":"2025-04-12T09:17:48.008Z","avatar_url":"https://github.com/antonblanchard.png","language":"Verilog","funding_links":[],"categories":["CPU cores","Verilog","CPUs"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003cimg src=\"media/microwatt-title.png\" alt=\"Microwatt\"\u003e\n\u003c/p\u003e\n\n# Microwatt\n\nA tiny Open POWER ISA softcore written in VHDL 2008. It aims to be simple and easy\nto understand.\n\n## Simulation using ghdl\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"http://neuling.org/microwatt-micropython.gif\" alt=\"MicroPython running on Microwatt\"/\u003e\n\u003c/p\u003e\n\nYou can try out Microwatt/Micropython without hardware by using the ghdl simulator. If you want to build directly for a hardware target board, see below.\n\n- Build micropython. If you aren't building on a ppc64le box you\n  will need a cross compiler. If it isn't available on your distro\n  grab the powerpc64le-power8 toolchain from https://toolchains.bootlin.com.\n  You may need to set the CROSS_COMPILE environment variable\n  to the prefix used for your cross compilers.  The default is\n  powerpc64le-linux-gnu-.\n\n```\ngit clone https://github.com/micropython/micropython.git\ncd micropython\ncd ports/powerpc\nmake -j$(nproc)\ncd ../../../\n```\n\n  A prebuilt micropython image is also available in the micropython/ directory.\n\n- Microwatt uses ghdl for simulation. Either install this from your\n  distro or build it. Microwatt requires ghdl to be built with the LLVM\n  or gcc backend, which not all distros do (Fedora does, Debian/Ubuntu\n  appears not to). ghdl with the LLVM backend is likely easier to build.\n\n  If building ghdl from scratch is too much for you, the microwatt Makefile\n  supports using Docker or Podman.\n\n- Next build microwatt:\n\n```\ngit clone https://github.com/antonblanchard/microwatt\ncd microwatt\nmake\n```\n\n   To build using Docker:\n```\nmake DOCKER=1\n```\n\n   and to build using Podman:\n\n```\nmake PODMAN=1\n```\n\n- Link in the micropython image:\n\n```\nln -s ../micropython/ports/powerpc/build/firmware.bin main_ram.bin\n```\n\n  Or if you were using the pre-built image:\n\n```\nln -s micropython/firmware.bin main_ram.bin\n```\n\n- Now run microwatt, sending debug output to /dev/null:\n\n```\n./core_tb \u003e /dev/null\n```\n\n## Synthesis on Xilinx FPGAs using Vivado\n\n- Install Vivado (I'm using the free 2019.1 webpack edition).\n\n- Setup Vivado paths:\n\n```\nsource /opt/Xilinx/Vivado/2019.1/settings64.sh\n```\n\n- Install FuseSoC:\n\n```\npip3 install --user -U fusesoc\n```\nFedora users can get FuseSoC package via\n```\nsudo dnf copr enable sharkcz/danny\nsudo dnf install fusesoc\n```\n\n- If this is your first time using fusesoc, initialize fusesoc. \n  This is needed to be able to pull down fussoc library components referenced \n  by microwatt. Run\n\n```\nfusesoc init\nfusesoc fetch uart16550\nfusesoc library add microwatt /path/to/microwatt\n```\n\n- Build using FuseSoC. For hello world (Replace nexys_video with your FPGA board such as --target=arty_a7-100):\n  You may wish to ensure you have [installed Digilent Board files](https://reference.digilentinc.com/vivado/installing-vivado/start#installing_digilent_board_files) \n  or appropriate files for your board first.\n\n```\nfusesoc run --target=nexys_video microwatt --memory_size=16384 --ram_init_file=/path/to/microwatt/fpga/hello_world.hex\n```\nYou should then be able to see output via the serial port of the board (/dev/ttyUSB1, 115200 for example assuming standard clock speeds). There is a know bug where initial output may not be sent - try the reset (not programming button) on your board if you don't see anything.\n\n- To build micropython (currently requires 1MB of BRAM eg an Artix-7 A200):\n\n```\nfusesoc run --target=nexys_video microwatt\n```\n\n## Linux on Microwatt\n\nMainline Linux supports Microwatt as of v5.14. The Arty A7 is the best tested\nplatform, but it's also been tested on the OrangeCrab and ButterStick.\n\n1. Use buildroot to create a userspace\n\n   A small change is required to glibc in order to support the VMX/AltiVec-less\n   Microwatt, as float128 support is mandiatory and for this in GCC requires\n   VSX/AltiVec. This change is included in Joel's buildroot fork, along with a\n   defconfig:\n   ```\n   git clone -b microwatt https://github.com/shenki/buildroot\n   cd buildroot\n   make ppc64le_microwatt_defconfig\n   make\n   ```\n\n   The output is `output/images/rootfs.cpio`.\n\n2. Build the Linux kernel\n   ```\n   git clone https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git\n   cd linux\n   make ARCH=powerpc microwatt_defconfig\n   make ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- \\\n     CONFIG_INITRAMFS_SOURCE=/buildroot/output/images/rootfs.cpio -j`nproc`\n   ```\n\n   The output is `arch/powerpc/boot/dtbImage.microwatt.elf`.\n\n3. Build gateware using FuseSoC\n\n   First configure FuseSoC as above.\n   ```\n   fusesoc run --build --target=arty_a7-100 microwatt --no_bram --memory_size=0\n   ```\n\n   The output is `build/microwatt_0/arty_a7-100-vivado/microwatt_0.bit`.\n\n4. Program the flash\n\n   This operation will overwrite the contents of your flash.\n\n   For the Arty A7 A100, set `FLASH_ADDRESS` to `0x400000` and pass `-f a100`.\n\n   For the Arty A7 A35, set `FLASH_ADDRESS` to `0x300000` and pass `-f a35`.\n   ```\n   microwatt/openocd/flash-arty -f a100 build/microwatt_0/arty_a7-100-vivado/microwatt_0.bit\n   microwatt/openocd/flash-arty -f a100 dtbImage.microwatt.elf -t bin -a $FLASH_ADDRESS\n   ```\n\n5. Connect to the second USB TTY device exposed by the FPGA\n\n   ```\n   minicom -D /dev/ttyUSB1\n   ```\n\n   The gateware has firmware that will look at `FLASH_ADDRESS` and attempt to\n   parse an ELF there, loading it to the address specified in the ELF header\n   and jumping to it.\n\n## Testing\n\n- A simple test suite containing random execution test cases and a couple of\n  micropython test cases can be run with:\n\n```\nmake -j$(nproc) check\n```\n\n## Issues\n\n- There are a few instructions still to be implemented:\n  - Vector/VMX/VSX\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonblanchard%2Fmicrowatt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonblanchard%2Fmicrowatt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonblanchard%2Fmicrowatt/lists"}