Skip to content

Commit 5e1da2e

Browse files
authored
Merge pull request #83 from oharboe/boards-openroad
Boards openroad added
2 parents 5527b35 + 8e62d40 commit 5e1da2e

12 files changed

+1016
-0
lines changed

.bazelversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.4.0

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ build
1414
iseconfig
1515
*.a
1616
*.bin
17+
bazel-bin
18+
bazel-darkriscv
19+
bazel-out
20+
bazel-testlogs

BUILD.bazel

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"""Top level Bazel module, allows access to files by other modules."""
2+
3+
exports_files(
4+
glob([
5+
"rtl/**/*.v",
6+
"rtl/**/*.vh",
7+
]),
8+
visibility = [":__subpackages__"],
9+
)
10+
11+
filegroup(
12+
name = "verilog",
13+
srcs = glob(
14+
["rtl/**/*.v"],
15+
# FIXME delete this on next upgrade of ORFS
16+
exclude = ["rtl/darksocv.v"],
17+
) + [
18+
":darksocv_cleaned",
19+
],
20+
visibility = [":__subpackages__"],
21+
)
22+
23+
# FIXME delete this on next upgrade of ORFS, it handles $display() statements
24+
genrule(
25+
name = "darksocv_cleaned",
26+
srcs = [
27+
":rtl/darksocv.v",
28+
":rtl/config.vh",
29+
],
30+
outs = [
31+
":cleaned/rtl/darksocv_cleaned.v",
32+
":cleaned/rtl/config.vh",
33+
],
34+
cmd = """
35+
sed -e "/\\$$display/d" $(location :rtl/darksocv.v) > $(location :cleaned/rtl/darksocv_cleaned.v)
36+
cp $(location :rtl/config.vh) $(location :cleaned/rtl/config.vh)
37+
""",
38+
)
39+
40+
filegroup(
41+
name = "verilog_include",
42+
srcs = glob(["rtl/**/*.vh"]),
43+
visibility = [":__subpackages__"],
44+
)
45+
46+
filegroup(
47+
name = "verilog_data",
48+
srcs = glob(["src/**/*.mem"]),
49+
visibility = [":__subpackages__"],
50+
)

MODULE.bazel

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""Bazel depedencies"""
2+
3+
module(
4+
name = "darkriscv",
5+
version = "0.0.1",
6+
compatibility_level = 1,
7+
)
8+
9+
bazel_dep(name = "bazel-orfs")
10+
git_override(
11+
module_name = "bazel-orfs",
12+
commit = "b16da67e50032682dc6f01252217bfb71cf89260",
13+
remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git",
14+
)
15+
16+
orfs = use_extension("@bazel-orfs//:extension.bzl", "orfs_repositories")
17+
orfs.default(
18+
# To update, find latest at https://hub.docker.com/r/openroad/orfs/tags
19+
image = "docker.io/openroad/orfs:v3.0-2591-g9bca87d7",
20+
sha256 = "673181c3b49235cf5b43e386e4cf478d676b797c8b7736a3ed79fc90f4c8acb7",
21+
)
22+
use_repo(orfs, "com_github_nixos_patchelf_download")
23+
use_repo(orfs, "docker_orfs")

MODULE.bazel.lock

+615
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

boards/openroad/BUILD.bazel

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
load("@bazel-orfs//:openroad.bzl", "orfs_flow")
2+
3+
FASTER = {
4+
# ignore timing repair for now
5+
"SETUP_SLACK_MARGIN": "-1000",
6+
"SKIP_REPORT_METRICS": "1",
7+
"SKIP_LAST_GASP": "1",
8+
# skip checks for now, faster
9+
"PWR_NETS_VOLTAGES": "",
10+
"GND_NETS_VOLTAGES": "",
11+
}
12+
13+
# SRAMs are specific to PDK, mock one here by
14+
# creating it from flip flops and use mock_area
15+
# to reduce the size of the SRAM to something that
16+
# is a bit more reasonable.
17+
orfs_flow(
18+
name = "darkram",
19+
abstract_stage = "cts",
20+
arguments = FASTER | {
21+
"CORE_UTILIZATION": "10",
22+
"SYNTH_MEMORY_MAX_BITS": "65536",
23+
"MACRO_BLOCKAGE_HALO": "0",
24+
"PDN_TCL": "$(PLATFORM_DIR)/openRoad/pdn/BLOCK_grid_strategy.tcl",
25+
},
26+
# The width/height of a real SRAM might be, say,
27+
# 25% of that of a flip flop based SRAM.
28+
mock_area = 0.25,
29+
sources = {
30+
"SDC_FILE": [":constraints_darkram.sdc"],
31+
},
32+
stage_data = {
33+
"synth": [
34+
"//:verilog_data",
35+
"//:verilog_include",
36+
],
37+
},
38+
# OpenROAD version of the darkram.v file
39+
verilog_files = [":darkram.v"],
40+
)
41+
42+
orfs_flow(
43+
name = "darksocv",
44+
arguments = FASTER | {
45+
"SYNTH_HIERARCHICAL": "1",
46+
#"SYNTH_MINIMUM_KEEP_SIZE": "1",
47+
"CORE_UTILIZATION": "40",
48+
"MIN_ROUTING_LAYER": "M2",
49+
"MAX_ROUTING_LAYER": "M7",
50+
"CORE_MARGIN": "2",
51+
"MACRO_PLACE_HALO": "2 2",
52+
"PDN_TCL": "$(PLATFORM_DIR)/openRoad/pdn/BLOCKS_grid_strategy.tcl",
53+
"GDS_ALLOW_EMPTY": "darkram",
54+
},
55+
macros = ["darkram_generate_abstract"],
56+
sources = {
57+
"SDC_FILE": [":constraints.sdc"],
58+
},
59+
stage_data = {
60+
"synth": [
61+
"//:verilog_data",
62+
"//:verilog_include",
63+
],
64+
},
65+
verilog_files = [
66+
"//:verilog",
67+
],
68+
)

boards/openroad/README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
OpenROAD ASAP7 PDK configuration
2+
================================
3+
4+
TL;DR Install Bazelisk and run command below to build and view darksocv in the GUI, Bazelisk handles all depedencies.
5+
6+
Demonstrates how to set up an [bazel-orfs](https://github.com/The-OpenROAD-Project/bazel-orfs) to build darksocv with [OpenROAD-flow-scripts](https://github.com/The-OpenROAD-Project/OpenROAD-flow-scripts)
7+
8+
To build and view [Install Bazelisk](https://bazel.build/install/bazelisk) and run:
9+
10+
bazelisk run //boards/openroad:darksocv_cts /tmp/cts gui_cts
11+
12+
Register to register histogram
13+
------------------------------
14+
15+
![alt text](reg2reg-histogram.png)
16+
17+
Estimated routing congestion
18+
----------------------------
19+
20+
![alt text](routing-congestion.png)
21+
22+
Ideas for future work
23+
=====================
24+
25+
- reduce clock period
26+
- darkram.v should consist of serveral SRAMs connected together to be
27+
a more accurate representation
28+
- create a mock SRAM representation with somewhat realistic timing
29+
- add IO constraints to place pins on one edge of the SRAMs and top level
30+
- reduce area
31+
32+
[MegaBoom](https://github.com/The-OpenROAD-Project/megaboom) demonstrates a number of techniques to study a design and set up mock SRAMs.

boards/openroad/constraints.sdc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set clk_name XCLK
2+
set clk_port_name XCLK
3+
set clk_period 2000
4+
5+
source $::env(PLATFORM_DIR)/constraints.sdc
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
set sdc_version 2.0
2+
3+
set clk_name CLK
4+
set clk_port_name CLK
5+
set clk_period 2000
6+
7+
set clk_port [get_ports $clk_port_name]
8+
create_clock -period $clk_period -waveform [list 0 [expr $clk_period / 2]] -name $clk_name $clk_port
9+
10+
set non_clk_inputs [lsearch -inline -all -not -exact [all_inputs] $clk_port]
11+
set all_register_outputs [get_pins -of_objects [all_registers] -filter {direction == output}]
12+
set_max_delay [expr {[info exists in2reg_max] ? $in2reg_max : 80}] -from $non_clk_inputs -to [all_registers]
13+
set_max_delay [expr {[info exists reg2out_max] ? $reg2out_max : 80}] -from $all_register_outputs -to [all_outputs]
14+
set_max_delay [expr {[info exists in2out_max] ? $in2out_max : 80}] -from $non_clk_inputs -to [all_outputs]
15+
# group_path -name in2reg -from $non_clk_inputs -to [all_registers]
16+
# group_path -name reg2out -from [all_registers] -to [all_outputs]
17+
# group_path -name in2out -from $non_clk_inputs -to [all_outputs]

0 commit comments

Comments
 (0)