Skip to content

Commit

Permalink
update dockerfile to jammy, fix bazel, verilator, and verible install (
Browse files Browse the repository at this point in the history
…#152)

* update dockerfile to jammy, fix bazel, verilator, and verible install

* Update in_docker function in precommit

* fix verilator waiver

* change deprecated fork to start_soon

* Try removing poetry.lock

* Update pyproject.toml to use at least python 3.7

* trigger dockerfile rebuild

* Remove comment

* Fix dockerfile to use right version of verible

* format sr_latch

* Fix format

* Rebuild docker image

* undo docker image change

* Fix docs

* Format case statemetn
  • Loading branch information
bensampson5 authored May 26, 2024
1 parent 989a51a commit d516b37
Show file tree
Hide file tree
Showing 29 changed files with 3,138 additions and 4,110 deletions.
21 changes: 11 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM ubuntu:20.04
FROM ubuntu:jammy

WORKDIR /tmp

# Baseline apt-get installs
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
apt-transport-https \
autoconf \
bc \
bison \
Expand All @@ -16,6 +17,7 @@ RUN apt-get update \
g++ \
git \
gnupg \
help2man \
libfl2 \
libfl-dev \
libgoogle-perftools-dev \
Expand All @@ -26,33 +28,32 @@ RUN apt-get update \
python3-dev \
python3-pip \
wget \
zlibc \
zlib1g \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Add Bazel distribution URI as a package source
RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg \
&& mv bazel.gpg /etc/apt/trusted.gpg.d/ \
&& echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
RUN curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg \
&& mv bazel-archive-keyring.gpg /usr/share/keyrings \
&& echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list

# Install Bazel
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
bazel \
bazel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Install python packages using poetry
RUN pip3 install poetry
COPY poetry.lock pyproject.toml ./
COPY pyproject.toml ./
RUN poetry config virtualenvs.create false
RUN poetry install -n --no-ansi

# Build and install Verilator v4.106 from source
# Build and install Verilator v5.024 from source
ARG REPO=https://github.com/verilator/verilator
ARG TAG=v4.106
ARG TAG=v5.024
RUN git clone --depth 1 --branch "${TAG}" "${REPO}" verilator \
&& cd verilator \
&& autoconf \
Expand All @@ -63,7 +64,7 @@ RUN git clone --depth 1 --branch "${TAG}" "${REPO}" verilator \
&& rm -rf verilator

# Install Verible
ARG VERIBLE_URL=https://github.com/chipsalliance/verible/releases/download/v0.0-1854-g0834c7f8/verible-v0.0-1854-g0834c7f8-Ubuntu-20.04-focal-x86_64.tar.gz
ARG VERIBLE_URL=https://github.com/chipsalliance/verible/releases/download/v0.0-3648-g5ef1624a/verible-v0.0-3648-g5ef1624a-linux-static-x86_64.tar.gz
RUN wget ${VERIBLE_URL} -O verible.tar.gz \
&& mkdir verible \
&& tar -xf verible.tar.gz -C verible --strip-components=1 \
Expand Down
3 changes: 1 addition & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
sphinx
sphinx_rtd_theme
cloud_sptheme
sphinx_rtd_theme
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ["sphinx_rtd_theme", "cloud_sptheme.ext.table_styling"]
extensions = ["sphinx_rtd_theme"]

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
Expand Down
6 changes: 0 additions & 6 deletions docs/source/decoder_8b10b.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ with an indication if the received symbol is a control or data symbol.


.. table:: 5B/6B Coding Table
:header-alignment: cccccccc
:column-alignment: cccccccc

+--------------+---------+----------+----------------+---------+----------+
| Input | RD = −1 | RD = +1 | Input | RD = −1 | RD = +1 |
Expand Down Expand Up @@ -99,8 +97,6 @@ with an indication if the received symbol is a control or data symbol.


.. table:: 3B/4B Coding Table
:header-alignment: cccccccc
:column-alignment: cccccccc

+----------------+---------+----------+---------------+---------+----------+
| Input | RD = −1 | RD = +1 | Input | RD = −1 | RD = +1 |
Expand Down Expand Up @@ -149,8 +145,6 @@ symbols are used is defined by the protocol standard (i.e. Ethernet, Fibre Chann


.. table:: Control Symbols
:header-alignment: cccccc
:column-alignment: cccccc

+----------------------------------+-------------+-------------+
| Input | RD = −1 | RD = +1 |
Expand Down
6 changes: 0 additions & 6 deletions docs/source/encoder_8b10b.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ with the current running disparity and a control symbol select signal, can be en


.. table:: 5B/6B Coding Table
:header-alignment: cccccccc
:column-alignment: cccccccc

+--------------+---------+----------+----------------+---------+----------+
| Input | RD = −1 | RD = +1 | Input | RD = −1 | RD = +1 |
Expand Down Expand Up @@ -94,8 +92,6 @@ with the current running disparity and a control symbol select signal, can be en


.. table:: 3B/4B Coding Table
:header-alignment: cccccccc
:column-alignment: cccccccc

+----------------+---------+----------+---------------+---------+----------+
| Input | RD = −1 | RD = +1 | Input | RD = −1 | RD = +1 |
Expand Down Expand Up @@ -145,8 +141,6 @@ symbols are used is defined by the protocol standard (i.e. Ethernet, Fibre Chann


.. table:: Control Symbols
:header-alignment: cccccc
:column-alignment: cccccc

+----------------------------------+-------------+-------------+
| Input | RD = −1 | RD = +1 |
Expand Down
9 changes: 6 additions & 3 deletions libsv/coders/bcd_decoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ module bcd_decoder #(
logic [4*N-1:0] temp; // create temp vector as wide as i_bcd to hold intermediate values
always_comb begin
temp = i_bcd; // initialize with input vector
for (i = 0; i < 4 * (N - 1); i = i + 1) // iterate on structure depth
for (j = 0; j < N - i / 4 - 1; j = j + 1) // iterate on structure width
if (temp[4+i+4*j-:4] > 7) // if > 7
for (i = 0; i < 4 * (N - 1); i = i + 1) begin // iterate on structure depth
for (j = 0; j < N - i / 4 - 1; j = j + 1) begin // iterate on structure width
if (temp[4+i+4*j-:4] > 7) begin // if > 7
temp[4+i+4*j-:4] = temp[4+i+4*j-:4] - 4'd3; // subtract three
end
end
end
o_bin = temp[3*N+(N+2)/3-1:0]; // truncate final result in temp vector to get o_bin
end

Expand Down
9 changes: 6 additions & 3 deletions libsv/coders/bcd_encoder.sv
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ module bcd_encoder #(

always_comb begin
o_bcd = {{(N - 4) / 3 + 1{1'b0}}, i_bin}; // initialize with input vector in lower bits
for (i = 0; i <= N - 4; i = i + 1) // iterate on structure depth
for (j = 0; j <= i / 3; j = j + 1) // iterate on structure width
if (o_bcd[N-i+4*j-:4] > 4) // if > 4
for (i = 0; i <= N - 4; i = i + 1) begin // iterate on structure depth
for (j = 0; j <= i / 3; j = j + 1) begin // iterate on structure width
if (o_bcd[N-i+4*j-:4] > 4) begin // if > 4
o_bcd[N-i+4*j-:4] = o_bcd[N-i+4*j-:4] + 4'd3; // add 3
end
end
end
end

endmodule
Expand Down
Loading

0 comments on commit d516b37

Please sign in to comment.