-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename example folders and add verilator docker scripts
- Loading branch information
Showing
22 changed files
with
82 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
examples/hierarchy/Hierarchy.sv → examples/Hierarchy/Hierarchy.sv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
# DESCRIPTION: Wrap a verilator call to run a docker container | ||
# | ||
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you | ||
# can redistribute it and/or modify it under the terms of either the GNU | ||
# Lesser General Public License Version 3 or the Perl Artistic License | ||
# Version 2.0. | ||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 | ||
|
||
# Pull newest image | ||
docker pull verilator/verilator:4.038 > /dev/null | ||
|
||
# Get id of container | ||
id=$(docker ps -aqf "name=verilator") | ||
|
||
# When no user is specified, the default user is root. This makes it so files | ||
# created by docker are owned by root, which we do not want. The solution is to | ||
# add a user identical to ourselves in the docker environment. The three following | ||
# lines do this. | ||
# | ||
# Solution found here: | ||
# https://stackoverflow.com/questions/67995208/docker-username-interactive-result-in-i-have-no-name-error | ||
|
||
docker cp $id:/etc/passwd /tmp > /dev/null | ||
echo "orbit:x:""$(id -u)"":""$(id -g)""orbit:/tmp:/bin/bash" >> /tmp/passwd | ||
docker cp /tmp/passwd $id:/etc/passwd > /dev/null | ||
|
||
# Get the directory this script is located | ||
root_dir=$(realpath $3) | ||
|
||
# Run the docker image with the user we "made" above | ||
docker run -e CCACHE_DIR=/work/.ccache -ti -v ${root_dir}:/work -w /work/$2 --user $(id -u):$(id -g) verilator/verilator:$1 "${@:4}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# DESCRIPTION: Wrap a Verilator call and copy vlt includes | ||
# (inside docker container) | ||
# | ||
# Copyright 2020 by Stefan Wallentowitz. This program is free software; you | ||
# can redistribute it and/or modify it under the terms of either the GNU | ||
# Lesser General Public License Version 3 or the Perl Artistic License | ||
# Version 2.0. | ||
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 | ||
|
||
perl /usr/local/bin/verilator "$@" | ||
status=$? | ||
if [ $status -ne 0 ]; then | ||
exit $status | ||
fi | ||
|
||
# Check if user set an obj_dir | ||
obj_dir=$(echo " $@" | grep -oP '\s--Mdir\s*\K\S+') | ||
if [ "$obj_dir" == "" ]; then | ||
obj_dir="obj_dir" | ||
fi | ||
|
||
# If the run was successful: Copy required files to allow build without this container | ||
if [ -e ${obj_dir} ]; then | ||
# Copy files required for the build | ||
mkdir -p ${obj_dir}/vlt | ||
cp -r /usr/local/share/verilator/bin ${obj_dir}/vlt | ||
cp -r /usr/local/share/verilator/include ${obj_dir}/vlt | ||
# Point Makefile to that folder | ||
sed -i 's/VERILATOR_ROOT = \/usr\/local\/share\/verilator/VERILATOR_ROOT = vlt/g' ${obj_dir}/*.mk | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters