Skip to content

Commit

Permalink
Fix problems with docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
dlesbre committed Feb 4, 2022
1 parent d65a095 commit fddaa7b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ if ! shopt -oq posix; then
fi

export USER=user
export DISPLAY=:0
export XAUTHORITY=~/.Xauthority
export PATH="/home/user/VossII/bin:/home/user/src/bifrost:$PATH"
12 changes: 8 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ ARG DEBIAN_FRONTEND=noninteractive

# Create a user named "user" and give him sudo privileges
# His password is "password"
RUN useradd -m -s /bin/bash -p "$1$c8u/HkYq$4P1SY4xvYAto8yWonByEJ0" user; \
usermod -a -G sudo user
RUN useradd --create-home -s /bin/bash user \
&& echo user:password | chpasswd \
&& adduser user sudo

# Using a single run command for a smaller image,
# as we can delete a bunch of things when done
Expand All @@ -20,12 +21,13 @@ RUN apt-get update \
make ghc bnfc sudo procps \
&& cd /home/user \
&& git clone https://github.com/TeamVoss/VossII.git \
&& make -C VossII/src install \
&& make -C VossII/src install_all_but_yosys \
&& rm -rf VossII/.git VossII/ckt_examples VossII/src/external VossII/tutorials \
&& apt-get -y remove git g++ doxygen flex bison gawk \
clang python python3 pandoc \
llvm-7-dev libgl1-mesa-dri libllvm7 clang-7 \
&& apt-get -y autoremove
&& apt-get -y autoremove \
&& apt-get -y install xauth graphviz

# Build bifrost and copy cephalopode files
COPY . /home/user/src/
Expand All @@ -37,5 +39,7 @@ RUN make -C /home/user/src bifrost
# Switch to user before running
RUN chown -R user /home/user/
USER user
ENV USER=user
ENV XAUTHORITY=/home/user/.Xauthority
WORKDIR /home/user/src/
CMD bash
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ docker-build: bifrost-clean-exe ## Build the docker image

docker-run: ## Run the docker image (requires building first)
echo "$(color_yellow)Running docker image$(color_reset)"
$(DOCKER) run --rm -it -e DISPLAY=${DISPLAY} -v /tmp/.X11-unix:/tmp/.X11-unix $(DOCKER_IMG_NAME) /bin/bash
$(DOCKER) run --rm -it -e DISPLAY -v "$(HOME)/.Xauthority:/home/user/.Xauthority" -v /tmp/.X11-unix:/tmp/.X11-unix $(DOCKER_IMG_NAME) /bin/bash

docker-zip: ## Zip the docker image for export
echo "$(color_yellow)Zipping docker image to $(DOCKER_ZIP_NAME)$(color_reset)"
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,20 @@ The docker image is called "processor". It is meant to be executed in interactiv
2. To run the image with acces to the X server on a linux system:

```
sudo docker run --rm -it -e DISPLAY=:0 -v /tmp/.X11-unix:/tmp/.X11-unix processor /bin/bash
sudo docker run --rm -it -e DISPLAY=:0 \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v "$(HOME)/.Xauthority:/home/user/.Xauthority" \
processor /bin/bash
```
It can be run without the X-server with (but fl will not work then):
```
sudo docker run --rm -it processor /bin/bash
```
This opens a bash shell on a small debian system. For other systems, the best I can do is point you to [this tutorial](https://cuneyt.aliustaoglu.biz/en/running-gui-applications-in-docker-on-windows-linux-mac-hosts/) which helped me set it up in linux.

3. The X server may require authentification. To allow docker to authenticate, run `xauth list` on your system, copy the first line and then run `xauth add <first line here>` in the docker shell.
If running on a remote system, [this other tutorial](https://blog.yadutaf.fr/2017/09/10/running-a-graphical-app-in-a-docker-container-on-a-remote-server/) may help set it up

4. You are now logged in as user "user" who has sudo priviledges with password "password". User's home folder contains our souce code under `src`. The makefile in `~/src` can be used to quickly launch all our programs. See `make help` for a full list of targets, or below for specific targets.
3. You are now logged in as user "user" who has sudo priviledges with password "password". User's home folder contains our souce code under `src`. The makefile in `~/src` can be used to quickly launch all our programs. See `make help` for a full list of targets, or below for specific targets.

For convenience, we added the fl interpretor and bifrost compiler to the path. They can be accessed with `fl` and `bifrost`. Note that `fl` requires a connection to the X-server.

Expand Down Expand Up @@ -130,11 +133,9 @@ Building and running IoTProc requires [Voss II](https://github.com/TeamVoss/Voss

```
cd Voss II
make -C src install
make -C src install_all_but_yosys
```

The makefile may fail when building yosys. This doesn't really matter as we don't use yosys in cephalopode.

4. You can check your install by running the fl interpretor (`.../VossII/bin/fl`). It should open a new window with the fl interpretor.

Type `load "ste.fl";` in the interpretor to verify that you have the HFL library.
Expand Down
5 changes: 2 additions & 3 deletions RTL/benchmark.fl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
(update_vossrc "PRINT-TIME-MOD" "100") fseq ();

length ARGS == 2 => () |
error "Usage: fl -noX -f benchmark.fl <rom_file> <maxcycles>"
error "Usage: fl -f benchmark.fl <rom_file> <maxcycles>"
;

load (DIR^"core_cephalopode.fl");
Expand All @@ -12,6 +12,7 @@ let ckt = pexlif2fsm p;
wtime (ckt fseq 2);

let BENCHMARK = el 1 ARGS;
printf "Running : %s\n" BENCHMARK;
let CYCLES = sscanf "%d" (el 2 ARGS);

let ant =
Expand Down Expand Up @@ -43,5 +44,3 @@ val (end_phase,He,Le) = hd (lastn 2 (get_trace ste "evaluation_done"));
|
error "Did not complete"
;

quit;
24 changes: 12 additions & 12 deletions RTL/cephalopode.fl
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ wtime vis;

let N = 10000;

let ant =
let ant =
(make_CR_ant ckt [("i_ram_latency", RAM_LATENCY),
("ram_latency", RAM_LATENCY),
("i_rom_latency", ROM_LATENCY)] (N cycles))
and
"cr[2:0]" is 0 for N cycles
and
mk_ROM_ant ckt "flash" "../compile/_benchmark1.rom"
// mk_ROM_ant ckt "flash" "../compile/_benchmark4.rom"
// mk_ROM_ant ckt "flash" "../compile/_e2.rom"
// mk_ROM_ant ckt "flash" "../compile/_benchmark.rom"
// mk_ROM_ant ckt "flash" "../compile/_sel_ex.rom"
// mk_ROM_ant ckt "flash" "../compile/_big_fac.rom"
// mk_ROM_ant ckt "flash" "../compile/_fac_example.rom"
// mk_ROM_ant ckt "flash" "../compile/_paper_expr2.rom"
mk_ROM_ant ckt "flash" (DIR^"../compile/_benchmark1.rom")
// mk_ROM_ant ckt "flash" (DIR^"../compile/_benchmark4.rom")
// mk_ROM_ant ckt "flash" (DIR^"../compile/_e2.rom")
// mk_ROM_ant ckt "flash" (DIR^"../compile/_benchmark.rom")
// mk_ROM_ant ckt "flash" (DIR^"../compile/_sel_ex.rom")
// mk_ROM_ant ckt "flash" (DIR^"../compile/_big_fac.rom")
// mk_ROM_ant ckt "flash" (DIR^"../compile/_fac_example.rom")
// mk_ROM_ant ckt "flash" (DIR^"../compile/_paper_expr2.rom")
and
"clk" is_clock N
and
"reset" is 1 for 1 cycle otherwise 0 until N cycles
;
;

let trl =
let trl =
// RAM content
let lines = 2**ADDR_SZ in
let width = hw_size {'0::node} in
Expand Down Expand Up @@ -253,7 +253,7 @@ let start_RAM_observer vis root_addr =
//load "zzzz.fl";

// ========================================================================
// A debugging session
// A debugging session
// ========================================================================
//add_waveform vis ["clk"];
add_waveform vis ["i1/i2/i1/i1/state[5:0]"];
Expand Down

0 comments on commit fddaa7b

Please sign in to comment.