Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency from bc #491

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ else
MAX_HEX_ADDRESS := $(shell cat $(FLASHWRITE_FILE) | grep "@" | tail -1 | cut -c2-)
MAX_HEX_ADDRESS_DEC := $(shell printf "%d" 0x$(MAX_HEX_ADDRESS))
BYTES_AFTER_MAX_HEX_ADDRESS := $(shell tac $(FLASHWRITE_FILE) | awk 'BEGIN {count=0} /@/ {print count; exit} {count++}')
FLASHWRITE_BYTES := $(shell echo $(MAX_HEX_ADDRESS_DEC) + $(BYTES_AFTER_MAX_HEX_ADDRESS)*16 | bc)
FLASHWRITE_BYTES := $(shell echo $$(( $(MAX_HEX_ADDRESS_DEC) + $(BYTES_AFTER_MAX_HEX_ADDRESS)*16 )))
endif

# Export variables to sub-makefiles
Expand Down
27 changes: 21 additions & 6 deletions docs/source/GettingStarted/Setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ cd riscv-gnu-toolchain
make
```

Then, set the `RISCV` env variable as:
Then, you need to set the `RISCV` environment variable. Also consider adding it to your `~/.bashrc` or equivalent so that it's set automatically in the future, like this:

```
export RISCV=/home/$USER/tools/riscv
Expand All @@ -104,6 +104,8 @@ cmake --build . --target install

### 4. Install Verilator:

Note that Verilator 4.210 will not build with GCC 12.0 or later, so it will need to be built with an older toolchain.

```
export VERILATOR_VERSION=4.210

Expand All @@ -116,13 +118,15 @@ autoconf
make
make install
```
Then, set the `PATH` env variable to as:

After installation you need to add `/home/$USER/tools/verilator/$VERILATOR_VERSION/bin` to your `PATH` environment variable. Also consider adding it to your `~/.bashrc` or equivalent so that it's on the `PATH` in the future, like this:

```
export VERILATOR_VERSION=4.210
export PATH=/home/$USER/tools/verilator/$VERILATOR_VERSION/bin:$PATH
```

In general, have a look at the [Install Verilator](https://opentitan.org/guides/getting_started/setup_verilator.html) section of the OpenTitan documentation.
In general, have a look at the [Install Verilator](https://opentitan.org/book/doc/getting_started/setup_verilator.html) section of the OpenTitan documentation.

If you want to see the vcd waveforms generated by the Verilator simulation, install GTKWAVE:

Expand All @@ -135,10 +139,21 @@ sudo apt-get install -y gtkwave

Files are formatted with Verible. We use version v0.0-1824-ga3b5bedf

See: [Install Verible](https://opentitan.org/guides/getting_started/index.html#step-7a-install-verible-optional)
```
export VERIBLE_VERSION=v0.0-1824-ga3b5bedf
wget https:wget https://github.com/chipsalliance/verible/releases/download/${VERIBLE_VERSION}/verible-${VERIBLE_VERSION}-Ubuntu-20.04-focal-x86_64.tar.gz
tar -xf verible-${VERIBLE_VERSION}-Ubuntu-20.04-focal-x86_64.tar.gz
mkdir -p /home/$USER/tools/verible/${VERIBLE_VERSION}/
mv verible-${VERIBLE_VERSION}/ /home/$USER/tools/verible/${VERIBLE_VERSION}/
rm verible-${VERIBLE_VERSION}-Ubuntu-20.04-focal-x86_64.tar.gz
rm -r verible-${VERIBLE_VERSION}
```

To format your RTL code type:
After installation you need to add `/home/$USER/tools/verible/${VERIBLE_VERSION}/bin` to your `PATH` environment variable. Also consider adding it to your `~/.bashrc` or equivalent so that it's on the `PATH` in the future, like this:

```
make verible
export VERIBLE_VERSION=v0.0-1824-ga3b5bedf
export PATH=/home/$USER/tools/verible/${VERIBLE_VERSION}/bin:$PATH
```

In general, have a look at the [Install Verible](https://opentitan.org/book/doc/getting_started/index.html#step-7a-install-verible-optional) section of the OpenTitan documentation.
2 changes: 1 addition & 1 deletion hw/core-v-mini-mcu/debug_subsystem.sv
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module debug_subsystem
logic [NRHARTS-1:0] unavailable;
dm::hartinfo_t [NRHARTS-1:0] hartinfo;

always @(*) begin
always_comb begin
for (int i = 0; i < NRHARTS; i++) begin
hartinfo[i].zero1 = '0;
hartinfo[i].nscratch = 2; // Debug module needs at least two scratch regs
Expand Down
2 changes: 1 addition & 1 deletion hw/vendor/pulp_platform_register_interface.lock.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
upstream:
{
url: https://github.com/pulp-platform/register_interface.git
rev: e3a4955071fcf554febd4b29a7c7a52c7f1e7fc6
rev: 7cf6ae7d8bc14af2c83e3178e068d79271b20815
}
}
2 changes: 1 addition & 1 deletion hw/vendor/pulp_platform_register_interface.vendor.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

upstream: {
url: "https://github.com/pulp-platform/register_interface.git",
rev: "e3a4955071fcf554febd4b29a7c7a52c7f1e7fc6",
rev: "7cf6ae7d8bc14af2c83e3178e068d79271b20815",
},

exclude_from_upstream: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
max_regs_char = len("{}".format(len(regs_flat) - 1))
addr_width = rb.get_addr_width()

# Used for the dev_select_i signal on a tlul_socket_1n with N =
# num_wins + 1. This needs to be able to represent any value up to
# N-1.
steer_msb = ((num_wins).bit_length()) - 1

lblock = block.name.lower()
ublock = lblock.upper()

Expand Down Expand Up @@ -189,7 +194,7 @@ module ${mod_name} \
% endif
% endif
% else:
logic [${num_wins_width-1}:0] reg_steer;
logic [${steer_msb}:0] reg_steer;

% if use_reg_iface:
${reg_intf_req} [${num_dsp}-1:0] reg_intf_demux_req;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/reg_top.sv.tpl b/reg_top.sv.tpl
index 664e12801..3e14b553c 100644
--- a/reg_top.sv.tpl
+++ b/reg_top.sv.tpl
@@ -20,6 +20,11 @@
max_regs_char = len("{}".format(len(regs_flat) - 1))
addr_width = rb.get_addr_width()

+ # Used for the dev_select_i signal on a tlul_socket_1n with N =
+ # num_wins + 1. This needs to be able to represent any value up to
+ # N-1.
+ steer_msb = ((num_wins).bit_length()) - 1
+
lblock = block.name.lower()
ublock = lblock.upper()

@@ -189,7 +194,7 @@ module ${mod_name} \
% endif
% endif
% else:
- logic [${num_wins_width-1}:0] reg_steer;
+ logic [${steer_msb}:0] reg_steer;

% if use_reg_iface:
${reg_intf_req} [${num_dsp}-1:0] reg_intf_demux_req;