From 98e20b1e8923ab68015fef7ea3544fc006d5e5cb Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Thu, 6 May 2021 13:30:32 -0500 Subject: [PATCH 01/11] Builds a Ubuntu image with all the tools --- Dockerfile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..f2be44f0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +# +# Usage: docker build . -t act +# To run: docker run -it -v`pwd`:/work act +# + +FROM ubuntu:20.04 + +# Install tools needed for development +RUN apt update && \ + apt upgrade --yes && \ + apt install --yes build-essential m4 libedit-dev zlib1g-dev + +ENV VLSI_TOOLS_SRC=/work +ENV ACT_HOME=/usr/local/cad +ENV PATH=$PATH:$ACT_HOME/bin + +WORKDIR $VLSI_TOOLS_SRC +COPY . $VLSI_TOOLS_SRC +RUN mkdir -p $ACT_HOME && \ + ./configure $ACT_HOME && \ + ./build && \ + make install + +# Cleanup all we can to keep container as lean as possible +RUN apt remove --yes build-essential libedit-dev m4 zlib1g-dev && \ + apt autoremove --yes && \ + rm -rf /work /tmp/* /var/lib/apt/lists/* + +CMD ["/bin/bash"] From 2e0dd8a2d79e2009651da81ed13e099b95de0532 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Thu, 6 May 2021 19:52:26 -0500 Subject: [PATCH 02/11] Added subtools --- Dockerfile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f2be44f0..9eefde0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ FROM ubuntu:20.04 # Install tools needed for development RUN apt update && \ apt upgrade --yes && \ - apt install --yes build-essential m4 libedit-dev zlib1g-dev + apt install --yes build-essential m4 libedit-dev zlib1g-dev libboost-dev git ENV VLSI_TOOLS_SRC=/work ENV ACT_HOME=/usr/local/cad @@ -20,9 +20,16 @@ RUN mkdir -p $ACT_HOME && \ ./configure $ACT_HOME && \ ./build && \ make install - + +RUN git clone https://github.com/asyncvlsi/interact.git && \ + git clone --branch sdtcore https://github.com/asyncvlsi/chp2prs.git && \ + git clone https://github.com/asyncvlsi/dflowmap.git && \ + for p in interact chp2prs dflowmap; do \ + cd $p && (./configure || true) && make depend && make && make install && cd .. \ + ; done + # Cleanup all we can to keep container as lean as possible -RUN apt remove --yes build-essential libedit-dev m4 zlib1g-dev && \ +RUN apt remove --yes build-essential git && \ apt autoremove --yes && \ rm -rf /work /tmp/* /var/lib/apt/lists/* From 7cfe0ffb08ff1d8746e07a18505db0d2b7338f87 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Thu, 6 May 2021 20:03:37 -0500 Subject: [PATCH 03/11] Fix library path --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9eefde0f..070e30c1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,12 +21,14 @@ RUN mkdir -p $ACT_HOME && \ ./build && \ make install +# TODO: Can add Dali: https://docs.nvidia.com/deeplearning/dali/user-guide/docs/compilation.html + RUN git clone https://github.com/asyncvlsi/interact.git && \ git clone --branch sdtcore https://github.com/asyncvlsi/chp2prs.git && \ git clone https://github.com/asyncvlsi/dflowmap.git && \ for p in interact chp2prs dflowmap; do \ cd $p && (./configure || true) && make depend && make && make install && cd .. \ - ; done + ; done && echo "$ACT_HOME/lib" > /etc/ld.so.conf.d/act.conf # Cleanup all we can to keep container as lean as possible RUN apt remove --yes build-essential git && \ From 29dcbeaa6a37996072c1403f304fa05a498fdaab Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Thu, 6 May 2021 21:24:35 -0500 Subject: [PATCH 04/11] Add irsim --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 070e30c1..5a780a9f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ FROM ubuntu:20.04 # Install tools needed for development RUN apt update && \ apt upgrade --yes && \ - apt install --yes build-essential m4 libedit-dev zlib1g-dev libboost-dev git + apt install --yes build-essential m4 libedit-dev zlib1g-dev libboost-dev tcl-dev tk-dev git ENV VLSI_TOOLS_SRC=/work ENV ACT_HOME=/usr/local/cad @@ -26,7 +26,8 @@ RUN mkdir -p $ACT_HOME && \ RUN git clone https://github.com/asyncvlsi/interact.git && \ git clone --branch sdtcore https://github.com/asyncvlsi/chp2prs.git && \ git clone https://github.com/asyncvlsi/dflowmap.git && \ - for p in interact chp2prs dflowmap; do \ + git clone https://github.com/asyncvlsi/irsim.git && \ + for p in interact chp2prs dflowmap irsim; do \ cd $p && (./configure || true) && make depend && make && make install && cd .. \ ; done && echo "$ACT_HOME/lib" > /etc/ld.so.conf.d/act.conf From faaa210ea4c4351287cd1cd3d78b6368734962a2 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Fri, 7 May 2021 17:03:06 -0500 Subject: [PATCH 05/11] Add note on 'snap', fix X11 support --- Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5a780a9f..b8d82f19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,8 @@ # # Usage: docker build . -t act -# To run: docker run -it -v`pwd`:/work act +# To run (X11 support): docker run -it -v`pwd`:/work -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix act +# +# Note: X11 support broken on Ubuntu when docker installed using 'snap' # FROM ubuntu:20.04 @@ -8,6 +10,7 @@ FROM ubuntu:20.04 # Install tools needed for development RUN apt update && \ apt upgrade --yes && \ + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata && \ apt install --yes build-essential m4 libedit-dev zlib1g-dev libboost-dev tcl-dev tk-dev git ENV VLSI_TOOLS_SRC=/work From aaebcf81aa72352b54bf033e22e4d2fcaed8643a Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Sat, 8 May 2021 15:10:25 -0500 Subject: [PATCH 06/11] Build Tclkit --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index b8d82f19..702aa5dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,6 +33,10 @@ RUN git clone https://github.com/asyncvlsi/interact.git && \ for p in interact chp2prs dflowmap irsim; do \ cd $p && (./configure || true) && make depend && make && make install && cd .. \ ; done && echo "$ACT_HOME/lib" > /etc/ld.so.conf.d/act.conf + +# Build Tclkit +RUN wget http://kitcreator.rkeene.org/fossil/tarball/kitcreator-trunk-tip.tar.gz?uuid=trunk -O- | tar xvz && \ + cd kitcreator-trunk-tip && ./kitcreator --enable-64bit --enable-threads # Cleanup all we can to keep container as lean as possible RUN apt remove --yes build-essential git && \ From 647b4ec59c2fbe9fe1a9fea2288a11fbe8d43ea6 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Sat, 8 May 2021 15:34:36 -0500 Subject: [PATCH 07/11] Remove dflowmap for now, broken --- Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 702aa5dd..5fdbc3d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,13 +24,12 @@ RUN mkdir -p $ACT_HOME && \ ./build && \ make install -# TODO: Can add Dali: https://docs.nvidia.com/deeplearning/dali/user-guide/docs/compilation.html +# git clone https://github.com/asyncvlsi/dflowmap.git && \ -> add dflowmap RUN git clone https://github.com/asyncvlsi/interact.git && \ git clone --branch sdtcore https://github.com/asyncvlsi/chp2prs.git && \ - git clone https://github.com/asyncvlsi/dflowmap.git && \ git clone https://github.com/asyncvlsi/irsim.git && \ - for p in interact chp2prs dflowmap irsim; do \ + for p in interact chp2prs irsim; do \ cd $p && (./configure || true) && make depend && make && make install && cd .. \ ; done && echo "$ACT_HOME/lib" > /etc/ld.so.conf.d/act.conf From e23acd1539fda2947b83832dab95e1d71f8efd86 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Sat, 8 May 2021 16:01:03 -0500 Subject: [PATCH 08/11] Fix Tclkit --- Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5fdbc3d3..0812c7e5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,7 +11,7 @@ FROM ubuntu:20.04 RUN apt update && \ apt upgrade --yes && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata && \ - apt install --yes build-essential m4 libedit-dev zlib1g-dev libboost-dev tcl-dev tk-dev git + apt install --yes build-essential m4 libedit-dev zlib1g-dev libboost-dev tcl-dev tk-dev git curl ENV VLSI_TOOLS_SRC=/work ENV ACT_HOME=/usr/local/cad @@ -34,8 +34,8 @@ RUN git clone https://github.com/asyncvlsi/interact.git && \ ; done && echo "$ACT_HOME/lib" > /etc/ld.so.conf.d/act.conf # Build Tclkit -RUN wget http://kitcreator.rkeene.org/fossil/tarball/kitcreator-trunk-tip.tar.gz?uuid=trunk -O- | tar xvz && \ - cd kitcreator-trunk-tip && ./kitcreator --enable-64bit --enable-threads +RUN curl http://kitcreator.rkeene.org/fossil/tarball/kitcreator-trunk-tip.tar.gz?uuid=trunk | tar xvz && \ + cd kitcreator-trunk-tip && build/pre.sh && ./kitcreator --enable-64bit --enable-threads # Cleanup all we can to keep container as lean as possible RUN apt remove --yes build-essential git && \ From 439b34b7046dbd10546987d724776c6048d3e129 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Sat, 8 May 2021 20:28:38 -0500 Subject: [PATCH 09/11] Fix TCL UI --- Dockerfile | 36 ++++++++++++++++++++++++------------ microstage.act | 45 +++++++++++++++++++++++++++++++++++++++++++++ muller_c2.act | 9 +++++++++ web_irsim.sh | 19 +++++++++++++++++++ 4 files changed, 97 insertions(+), 12 deletions(-) create mode 100644 microstage.act create mode 100644 muller_c2.act create mode 100755 web_irsim.sh diff --git a/Dockerfile b/Dockerfile index 0812c7e5..63896f0f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,23 @@ # # Usage: docker build . -t act -# To run (X11 support): docker run -it -v`pwd`:/work -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix act +# To run (X11 support using tclkit on port 8015): +# docker run -it -v`pwd`:/work -p8015:8015/tcp -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix act # # Note: X11 support broken on Ubuntu when docker installed using 'snap' # - -FROM ubuntu:20.04 - -# Install tools needed for development -RUN apt update && \ - apt upgrade --yes && \ - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata && \ - apt install --yes build-essential m4 libedit-dev zlib1g-dev libboost-dev tcl-dev tk-dev git curl +FROM ubuntu:20.04 AS build ENV VLSI_TOOLS_SRC=/work ENV ACT_HOME=/usr/local/cad ENV PATH=$PATH:$ACT_HOME/bin +ENV DEBIAN_FRONTEND=noninteractive + +# Install tools needed for development +RUN apt-get update && \ + apt-get upgrade --yes && \ + apt-get install -y --no-install-recommends tzdata && \ + apt-get install -y build-essential m4 libedit-dev zlib1g-dev libboost-dev tcl-dev tk-dev git curl autoconf \ + tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer matchbox-window-manager libxss1 WORKDIR $VLSI_TOOLS_SRC COPY . $VLSI_TOOLS_SRC @@ -34,12 +36,22 @@ RUN git clone https://github.com/asyncvlsi/interact.git && \ ; done && echo "$ACT_HOME/lib" > /etc/ld.so.conf.d/act.conf # Build Tclkit +COPY web_irsim.sh $ACT_HOME/bin/ RUN curl http://kitcreator.rkeene.org/fossil/tarball/kitcreator-trunk-tip.tar.gz?uuid=trunk | tar xvz && \ - cd kitcreator-trunk-tip && build/pre.sh && ./kitcreator --enable-64bit --enable-threads + cd kitcreator-trunk-tip && build/pre.sh && \ + KITCREATOR_PKGS=" itcl mk4tcl tcllib tk " KC_TCL_STATICPKGS="1" ./kitcreator --enable-64bit --enable-threads && \ + cp `find . -name tclkit-*` $ACT_HOME/bin/tclkit && \ + curl http://cloudtk.tcl-lang.org/Downloads/CloudTk.kit -o $ACT_HOME/bin/CloudTk.kit # Cleanup all we can to keep container as lean as possible -RUN apt remove --yes build-essential git && \ +RUN apt remove --yes build-essential git autoconf && \ apt autoremove --yes && \ - rm -rf /work /tmp/* /var/lib/apt/lists/* + rm -rf /tmp/* /var/lib/apt/lists/* $VLSI_TOOLS_SRC + +# This results in a single layer image +# FROM scratch +# COPY --from=build_with_env $ACT_HOME $ACT_HOME +# Expose Tclkit port +EXPOSE 8015/tcp CMD ["/bin/bash"] diff --git a/microstage.act b/microstage.act new file mode 100644 index 00000000..bf83d524 --- /dev/null +++ b/microstage.act @@ -0,0 +1,45 @@ +defproc inverter (bool? i; bool! o) +{ + prs { + i => o- + } +} +defproc delay (bool? i; bool! o) +{ + inverter d[2]; + d[0].i = i; + d[0].o = d[1].i; + d[1].o = o; +} + +defproc c2 (bool? a, b; bool! c) +{ + prs { + a & b #> c- + } +} + +defproc stage (bool? a,r; bool! a2,r2) +{ + delay d; + inverter i; + c2 c; + + i.i = c.b; i.o = a2; + r = c.a; + d.i = a; d.i = c.c; d.o = r2; +} + +defproc micropipeline (bool? a,r; bool! a2,r2) +{ + stage s[4]; + + s[0].a = a; + s[0].r = r; + s[3].a2 = a2; + s[3].r2 = r2; + + (i : 3 : s[i+1].a=s[i].a2; s[i+1].r=s[i].r2; ) +} + +micropipeline test; diff --git a/muller_c2.act b/muller_c2.act new file mode 100644 index 00000000..3101c92a --- /dev/null +++ b/muller_c2.act @@ -0,0 +1,9 @@ +defproc c2 (bool? a, b; bool! c) +{ + prs { + a & b -> c- + ~a & ~b -> c+ + } +} + +c2 test; diff --git a/web_irsim.sh b/web_irsim.sh new file mode 100755 index 00000000..1c96009f --- /dev/null +++ b/web_irsim.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +mkdir -p /usr/local/cad/bin/Tk/Irsim/ +cat > /usr/local/cad/bin/Tk/Irsim/TkStartup.tcl << EOF +set ix [lsearch \$argv -display] +if {\$ix >= 0} { + incr ix + set env(DISPLAY) [lindex \$argv \$ix] + set argc 0 + set argv {} +# source /usr/local/cad/bin/Tk/TkPool/TkPool.tcl +exec /usr/local/lib/irsim/tcl/tkcon.tcl \ + -eval "source /usr/local/lib/irsim/tcl/console.tcl" \ + -slave "package require Tk; set argc $#; set argv { "$@" }; \ + source /usr/local/lib/irsim/tcl/irsim.tcl" +EOF +cd /usr/local/cad/bin +./tclkit CloudTk.kit +exit $? From 60e2829be0f0abb8e60238c6182fabcece59f0bd Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Sat, 8 May 2021 20:33:03 -0500 Subject: [PATCH 10/11] Fix quotes --- web_irsim.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web_irsim.sh b/web_irsim.sh index 1c96009f..d241f0b5 100755 --- a/web_irsim.sh +++ b/web_irsim.sh @@ -9,9 +9,9 @@ if {\$ix >= 0} { set argc 0 set argv {} # source /usr/local/cad/bin/Tk/TkPool/TkPool.tcl -exec /usr/local/lib/irsim/tcl/tkcon.tcl \ - -eval "source /usr/local/lib/irsim/tcl/console.tcl" \ - -slave "package require Tk; set argc $#; set argv { "$@" }; \ +exec /usr/local/lib/irsim/tcl/tkcon.tcl \\ + -eval "source /usr/local/lib/irsim/tcl/console.tcl" \\ + -slave "package require Tk; set argc $#; set argv { $@ }; \\ source /usr/local/lib/irsim/tcl/irsim.tcl" EOF cd /usr/local/cad/bin From ccf1eb4681c8e4dd418c0b364e4e311b8ed3b4f1 Mon Sep 17 00:00:00 2001 From: Jeroen van Bemmel Date: Sun, 9 May 2021 16:29:58 -0500 Subject: [PATCH 11/11] Switch back to port 8015 --- Dockerfile | 8 +++++--- web_irsim.sh | 14 ++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 63896f0f..6d7026c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,11 @@ # # Usage: docker build . -t act -# To run (X11 support using tclkit on port 8015): -# docker run -it -v`pwd`:/work -p8015:8015/tcp -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix act +# To run (X11 support using tclkit on port 8015->now 443): +# docker run -it -v`pwd`:/work -p443:443/tcp -e DISPLAY="$DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix act # # Note: X11 support broken on Ubuntu when docker installed using 'snap' # +# Use minimal Ubuntu 18.04? Not much better FROM ubuntu:20.04 AS build ENV VLSI_TOOLS_SRC=/work @@ -16,7 +17,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get upgrade --yes && \ apt-get install -y --no-install-recommends tzdata && \ - apt-get install -y build-essential m4 libedit-dev zlib1g-dev libboost-dev tcl-dev tk-dev git curl autoconf \ + apt-get install -y build-essential m4 libedit-dev zlib1g-dev libboost-dev tcl-dev tk-dev git curl autoconf vim \ tigervnc-standalone-server tigervnc-xorg-extension tigervnc-viewer matchbox-window-manager libxss1 WORKDIR $VLSI_TOOLS_SRC @@ -54,4 +55,5 @@ RUN apt remove --yes build-essential git autoconf && \ # Expose Tclkit port EXPOSE 8015/tcp +# EXPOSE 443/tcp CMD ["/bin/bash"] diff --git a/web_irsim.sh b/web_irsim.sh index d241f0b5..b56c6963 100755 --- a/web_irsim.sh +++ b/web_irsim.sh @@ -1,7 +1,7 @@ #!/bin/sh -mkdir -p /usr/local/cad/bin/Tk/Irsim/ -cat > /usr/local/cad/bin/Tk/Irsim/TkStartup.tcl << EOF +mkdir -p $PWD/Tk/Irsim/ +cat > $PWD/Tk/Irsim/TkStartup.tcl << EOF set ix [lsearch \$argv -display] if {\$ix >= 0} { incr ix @@ -13,7 +13,13 @@ exec /usr/local/lib/irsim/tcl/tkcon.tcl \\ -eval "source /usr/local/lib/irsim/tcl/console.tcl" \\ -slave "package require Tk; set argc $#; set argv { $@ }; \\ source /usr/local/lib/irsim/tcl/irsim.tcl" +} EOF -cd /usr/local/cad/bin -./tclkit CloudTk.kit + +# Just make local copies +cp -n /usr/local/cad/bin/tclkit . +cp -n /usr/local/cad/bin/CloudTk.kit . + +# Default port 8015 tcp +./tclkit ./CloudTk.kit exit $?