Previous journal: | Next journal: |
---|---|
0132-2023-08-25.md | 0134-2023-08-27.md |
NOTE: This is a complement to 0123 where I set up my new laptop's Windows 11 host environment. The below deals with then getting the MPW8 Linux environment working with VirtualBox.
- I installed VirtualBox 7.0.10 on a Windows 11 Home host with 32GB RAM and Core i9 CPU.
- I downloaded the MPW8 VM again (
Zero to ASIC Course MPW8.ova
) per the Zero to ASIC course instructions. - The file is about 10GB (10,467,980,288 bytes), and its md5sum is
717755d5d9ed8990a26fe7ab51b9b971
- In VirtualBox: File => Import Applicance, select 'Expert' mode, select the OVA file.
- Assign 8 CPUs and 23,000MB RAM. Change base folder to
C:\VMs
. - Below the scrollable config options set 'Machine Base Folder' also to
C:\VMs
. Keep all other settings (esp. NAT Network) as-is. - Click 'Finish'. It will take a few minutes to build.
- Increase Video Memory to 128MB.
- Create a 'Shared Folder' for Windows 'Documents'. Name it
HOST_Documents
and turn on 'Auto-mount' - Boot the VM for the first time.
- Maximise, then when ready click
zerotoasic
user and password is12345
- Suppress VirtualBox notifications that appear on RHS.
- Display may not auto-scale straight away (despite View => Auto-resize Guest Display being ticked on), so un-maximise and maximise again.
- Go to Settings (either via arrow in top-right corner, or go to applications widget in bottom-left corner and search for and select 'Settings'). Set the following:
- Privacy => Screen Lock: Set screen blanking to Never, turn off automatic screen lock, turn off 'Lock Screen on Suspend'.
- Keyboard Shortcuts: Search for 'calc' and set 'Launch calculator' to Shift+Win+C (Shift+Super+C)
- Universal Access: Set cursor size as you like
- Users: 'Unlock' and turn on 'Automatic Login'
- Date & Time: 'Unlock' and set Time Zone to 'ACST (Adelaide, Australia)'.
- Shut down the VM: RightCtrl+H (VirtualBox ACPI shutdown signal), or menu in top-right corner => Power Off.
NOTE: It's best to do this early on, especially because use of snapshots can make this harder to do later.
- Back in VirtualBox, go to File => Tools => Virtual Media Manager
- Select the VDI and click 'Properties', then type in a size of 200GB and click Apply.
- Go back to the VM and boot it.
- In booted VM, go to applications menu (bottom-left corner) and search for 'Disks'
- Select the main drive and then select 'Extended Partition: Partition 2'
- Click the settings cog and from the menu select 'Resize...'
- Drag the slider all the way to the right, making the partition (hopefully) on the order of 200~214GB.
- Click the 'Resize' button
- Now 'Filesystem: Partition 5, 42 GB Ext4', and repeat the resize steps.
- At the end it should look something like this:
- Open a Terminal and run
df -h /
and it will hopefully show ~162GB free.
- Power off the VM
- Take a snapshot, 'MPW8 basic tweaks', optionally linking to what was done above.
- VM settings:
- General => Advanced => Drag'n'Drop, to set 'Host To Guest' because allowing the reverse can sometimes lead to problems if you drag a selection outside of the VM window.
- Display => Screen => Extended Features: Turn on 'Enable 3D Acceleration'.
- Fix mousewheel scrolling (don't worry about disabling drag-drop).
- Generate an SSH key (from this):
# Generate: ssh-keygen -t ed25519 -C "anton@foogle.com" # Show pub key, so you can copy it: cat /home/zerotoasic/.ssh/id_ed25519.pub
- Register SSH key with GitHub. I called it 'MPW8 VM on Legion 7'.
- Test SSH key:
ssh -T git@github.com # Answer 'yes' when prompted. # Expect final output to be: # => Hi algofoogle! You've successfully authenticated, but GitHub does not provide shell access.
- Add the following to
~/.vimrc
to configure vim for indenting using 4 spaces (even though I'm a tabs guy):set expandtab set tabstop=4 set shiftwidth=4
- Add the following to the end of
~/.bashrc
:Then load this with:# Improve prompt to include time and git branch: parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } export PS1="[\t] \u@\h \[\e[32m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ " # Function to set Gnome terminal title. For more info, see: # https://unix.stackexchange.com/a/186167 function set-title() { if [[ -z "$ORIG" ]]; then ORIG=$PS1 fi TITLE="\[\e]2;$*\a\]" PS1=${ORIG}${TITLE} }
source ~/.bashrc
-- it adds theset-title
function which can be called likeset-title whatever you want
(no string quoting required) to set the title of the current Gnome Terminal tab. The bit above also updates the prompt with time, colours, and git branch (if any). - If using a high-resolution display (e.g. 4K) create Matt Venn's recommended
~/.gtkwaverc
file for bigger traces/text and filled signals:fontname_signals Monospace 18 fontname_waves Monospace 18 splash_disable 1 fill_waveform 1
sudo apt update
- Install packages for doing GDS-to-PNG conversion:
sudo apt install librsvg2-bin pngquant
This is written as a variation on Hardening Tiny Tapeout Projects Locally...
cd ~; mkdir anton; cd anton
- Create the file
~/tt04-config-openlane.sh
:NOTE: If you want to load these environment variables in your terminal, you can do:#!/usr/bin/bash export OLENV=tt04 # Prompt helper export OPENLANE_ROOT=~/tt/openlane export PDK_ROOT=~/tt/pdk export PDK=sky130A export OPENLANE_TAG=2023.06.26 export OPENLANE_IMAGE_NAME=efabless/openlane:3bc9d02d0b34ad032921553e512fbe4bebf1d833
source ~/tt04-config-openlane.sh
- Likewise, create the file
~/mpw8-config-openlane.sh
:#!/usr/bin/bash export OLENV=mpw8 # Prompt helper export OPENLANE_ROOT=~/asic_tools/openlane export PDK_ROOT=~/asic_tools/pdk export PDK=sky130A export OPENLANE_TAG=2022.11.19 export OPENLANE_IMAGE_NAME=efabless/openlane:cb59d1f84deb5cedbb5b0a3e3f3b4129a967c988-amd64
- Add the following to
~/.bashrc
:...then do# Helper to load various OpenLane environments and then execute the given command with it: #SMELL: This feels clunky. It's based on: https://stackoverflow.com/a/39463371/5633460 alias sourcett04='source ~/tt/venv/bin/activate' function mpw8env() { BASH_ENV=~/mpw8-config-openlane.sh bash -c "$(printf "%q " "$@")"; } function tt04env() { BASH_ENV=~/tt04-config-openlane.sh bash -c "$(printf "%q " "$@")"; } function tt04env-bash() { tt04env bash --rcfile <(echo '. ~/.bashrc; . ~/tt04-config-openlane.sh; . ~/tt/venv/bin/activate'); }
source ~/.bashrc
-- after this, you can prefix commands withtt04env
and it will temporarily load the above environment for the following command. Example:tt04env ./tt/tt_tool.py --harden
-- Test:NOTE: Thett04env env | fgrep OPENLANE mpw8env env | fgrep OPENLANE
sourcett04
alias will be used a little later, as willtt04env-bash
. - Update the stuff around
export PS1
(i.e. prompt-setting stuff) in~/.bashrc
to:This will show the detected OpenLane environment in the prompt (i.e.# Improve prompt to include time and git branch: parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' } # Show OLENV if set (for selected OpenLane environment config, if any): olenv_helper() { echo $OLENV | sed -re 's/^(.+)$/\(OL=\1\) /' } export PS1="[\t] \[\e[91m\]\$(olenv_helper)\[\e[00m\]\u:\[\e[32m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ "
OLENV
variable, as optionally defined above). - Clone the tt-support-tools@tt04 repo:
cd ~/anton git clone -b tt04 https://github.com/TinyTapeout/tt-support-tools cd tt-support-tools
- Create the Python venv for TT:
python3 -m venv ~/tt/venv
- Activate that venv with:
sourcett04
- Install Python dependencies with:
pip install -r requirements.txt
- Now we should able to (say) open a new tab or terminal, and do:
env | fgrep OPENLANE
-- Should see OPENLANE_ROOT=/home/zerotoasic/asic_tools
/openlanempw8env env | fgrep OPENLANE
-- As above, with otherstt04env env | fgrep OPENLANE
-- As above but changed inc. OPENLANE_ROOT=/home/zerotoasic/tt
/openlane
- Start a specific TT04 bash shell, with:
tt04env-bash
-- and the rest of these instructions occur inside that shell:- Make sure the prompt is prefixed with
(venv)
to indicate that the Python venv is active. - Prove the TT04 OPENLANE env vars are intact with:
env | fgrep OPENLANE # Expect to see: # OPENLANE_ROOT=/home/zerotoasic/tt/openlane # OPENLANE_TAG=2023.06.26 # OPENLANE_IMAGE_NAME=efabless/openlane:3bc9d02d0b34ad032921553e512fbe4bebf1d833
- Install OpenLane (in the TT-specific
$OPENLANE_ROOT
path of~/tt/openlane
):git clone --depth=1 --branch $OPENLANE_TAG https://github.com/The-OpenROAD-Project/OpenLane.git $OPENLANE_ROOT cd $OPENLANE_ROOT make
- Do a test harden (with this environment already loaded):
cd ~/anton git clone https://github.com/TinyTapeout/tt04-factory-test cd tt04-factory-test git clone -b tt04 https://github.com/TinyTapeout/tt-support-tools tt ./tt/tt_tool.py --create-user-config time ./tt/tt_tool.py --harden
- Exit the tt04env-bash shell:
exit
- Make sure the prompt is prefixed with
- Power off the VM
- Take a snapshot, 'Environment Helpers', optionally linking to what was done above.
- Power the VM back on. Note that sometimes after updates like these, the VM may go thru extra startup routines and take longer to boot than usual. Hit ESC to see the boot log.
Based on Visual Studio Code on Linux:
- Install with Snap:
sudo snap install --classic code
- Launch with:
code ~/anton/tt04-factory-test
- Install extensions:
- GitHub Markdown Preview (search ID:
bierner.github-markdown-preview
) -- For previewing files as GFM. - C/C++:
ms-vscode.cpptools
-- Worry about doing the 'Get Started with C++ Development' walkthru later. - C/C++ Extension Pack:
ms-vscode.cpptools-extension-pack
- Tcl:
bitwisecook.tcl
- Python:
ms-python.python
-- Go thru 'Get Started with Python Development' later. - Verilog-HDL/SystemVerilog/Bluespec Systemverilog:
mshr-h.veriloghdl
- Hex Editor:
ms-vscode.hexeditor
- NOTE: These will include some extras, such as Pylance and CMake stuff.
- NOTE: Optional extra: Makefile Tools:
ms-vscode.makefile-tools
- GitHub Markdown Preview (search ID:
cd ~/anton
- CTRL+SHIFT+T in Gnome Terminal to create 3 tabs. Name each of them (using
set-title
):journal
,raybox-zero
,tt04-rbz
- In
journal
:git clone git@github.com:algofoogle/journal && cd journal
- In
raybox-zero
:git clone git@github.com:algofoogle/raybox-zero && cd raybox-zero
- In
tt04-rbz
:-
git clone git@github.com:algofoogle/tt04-raybox-zero --recurse-submodules cd tt04-raybox-zero tt04env-bash
-
It'll probably fail with the usual yosys-abc bug.
git clone -b tt04 https://github.com/TinyTapeout/tt-support-tools tt ./tt/tt_tool.py --create-user-config time ./tt/tt_tool.py --debug --harden
- I ran
time ./harden_test.sh
and it completed in about 48 minutes.
-
- Shut down the VM and in VM settings assign it 16 cores.
- When booting back up, I ran the laptop in 'performance' mode and added this to tt04-raybox-zero's
src/config.tcl
:set ::env(ROUTING_CORES) 15
- Then, when running
time ./harden_test.sh
in completed in under 28 minutes.
- Power off the VM
- Take a snapshot, 'VSCode ready', optionally linking to what was done above.
- There are 2 keyboard configs on this VM: US and UK. Maybe get rid of the UK one.
Otherwise, if you need, change to the correct one by clicking on
en2
in the top-right corner. - VM already has localhost:2522 forwarding for SSH to guest.
git config --global --edit
- Simulation stuff, esp. Verilator and SDL. Look at READMEs for my various HDL projects.
- Fix Docker ability to run OpenLane GUI: https://github.com/algofoogle/journal/blob/master/0083-2023-05-23.md#:~:text=Meanwhile%2C%20I%27m%20going%20to%20try%20inspecting%20my%20above%20failed%20run%20with%20the%20OpenROAD%20GUI%20as%20follows
- Helpers for launching OpenLane docker containers, e.g. per: https://github.com/algofoogle/journal/blob/master/0127-2023-08-20.md#going-into-the-updated-openlane-3bc9d02-docker-container
- RP2040 toolchain? https://github.com/algofoogle/journal/blob/master/0092-2023-06-08.md#raspberry-pi-pico-getting-started-with-arduino-libs-support, subsequent pages, minicom,
sudo adduser zerotoasic dialout
- Software Update?
- Check: VirtualBox => System => Processor => Extended Features => 'Enable Nested VT-x/AMD-V' option is not available. Need to enable in laptop BIOS? Will not having this slow down docker?
- NOTE: 8 vCPUs are assigned to the VM, but the host's Core i9 has 24. Consider more? How to enable OpenLane multi-core anyway??
- Any benefit to turning on VirtualBox 'Enable 3D Acceleration'?
- Consider setting USB mode to 2.0 or 3.0 if we need actual USB passthrough.
- PER PROJECT: Configure extra OpenLane cores: https://github.com/algofoogle/journal/blob/master/0086-2023-05-26.md#notes