Skip to content

Commit 2e88e07

Browse files
authored
docs nit fixes (#2362)
* favicon * fix image bg on dark mode * keep pdf generation * remove dead links in ToC
1 parent 1b0ace7 commit 2e88e07

18 files changed

Lines changed: 186 additions & 16 deletions

docs/Customization/Dsptools-Blocks.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Chipyard has example designs that integrate a ``DspBlock`` to a rocketchip-based
2121
.. figure:: ../_static/images/fir-block-diagram.svg
2222
:align: center
2323
:alt: Block diagram showing how FIR is integrated with rocket.
24+
:class: diagram-white-background
2425
:width: 400px
2526
2627
For this example, we will show you how to connect a simple FIR filter created using Dsptools as an MMIO peripheral as shown in the figure above. The full code can be found in `generators/chipyard/src/main/scala/example/dsptools/GenericFIR.scala <https://ucb.bar/chipyard/generators/chipyard/src/main/scala/example/dsptools/GenericFIR.scala>`_. That being said, one could substitute any module with a ready valid interface in the place of the FIR and achieve the same results. As long as the read and valid signals of the module are attached to those of a corresponding ``DSPBlock`` wrapper, and that wrapper is placed in a chain with a ``ReadQueue`` and a ``WriteQueue``, following the general outline establised by these steps will allow you to interact with that block as a memory mapped IO.

docs/Generators/BOOM.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Berkeley Out-of-Order Machine (BOOM)
22
==============================================
33

44
.. image:: ../_static/images/boom-pipeline-detailed.png
5+
:class: diagram-white-background
56

67
The `Berkeley Out-of-Order Machine (BOOM) <https://boom-core.org/>`__ is a synthesizable and parameterizable open source RV64GC RISC-V core written in the Chisel hardware construction language.
78
It serves as a drop-in replacement to the Rocket core given by Rocket Chip (replaces the RocketTile with a BoomTile).
@@ -10,4 +11,4 @@ Like the R10k and the 21264, BOOM is a unified physical register file design (al
1011
Conceptually, BOOM is broken up into 10 stages: Fetch, Decode, Register Rename, Dispatch, Issue, Register Read, Execute, Memory, Writeback and Commit.
1112
However, many of those stages are combined in the current implementation, yielding seven stages: Fetch, Decode/Rename, Rename/Dispatch, Issue/RegisterRead, Execute, Memory and Writeback (Commit occurs asynchronously, so it is not counted as part of the “pipeline”).
1213

13-
Additional information about the BOOM micro-architecture can be found in the `BOOM documentation pages <https://docs.boom-core.org/>`__. A set of example BOOM Core configurations can be found at `generators/chipyard/src/main/scala/config/BoomConfigs.scala <https://github.com/ucb-bar/chipyard/blob/main/generators/chipyard/src/main/scala/config/BoomConfigs.scala>`__.
14+
Additional information about the BOOM micro-architecture can be found in the `BOOM documentation pages <https://docs.boom-core.org/>`__. A set of example BOOM Core configurations can be found at `generators/chipyard/src/main/scala/config/BoomConfigs.scala <https://github.com/ucb-bar/chipyard/blob/main/generators/chipyard/src/main/scala/config/BoomConfigs.scala>`__.

docs/Generators/IceNet.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ in `FireSim <https://fires.im/>`_ for multi-node networked simulation.
77
A diagram of IceNet's microarchitecture is shown below.
88

99
.. image:: ../_static/images/nic-design.png
10+
:class: diagram-white-background
1011

1112
There are four basic parts of the NIC: the :ref:`Generators/IceNet:Controller`, which takes requests
1213
from and sends responses to the CPU; the :ref:`Generators/IceNet:Send Path`, which reads data from

docs/Generators/Rocket-Chip.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ out-of-order core generator or some other custom CPU generator instead.
1111

1212
A detailed diagram of a typical Rocket Chip system is shown below.
1313

14-
.. image:: ../_static/images/rocketchip-diagram.png
14+
.. raw:: html
15+
16+
<img alt="Diagram of a typical Rocket Chip system"
17+
class="diagram-white-background"
18+
src="../_static/images/rocketchip-diagram.png">
1519

1620
Tiles
1721
-----

docs/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ cd docs
3535
npm run build
3636
```
3737

38+
Read the Docs also builds downloadable PDF and EPUB versions directly from
39+
the RST sources using Sphinx. To build the same formats locally:
40+
41+
```sh
42+
cd docs
43+
python -m sphinx -M latexpdf . _build
44+
python -m sphinx -M epub . _build
45+
```
46+
47+
The PDF build requires a local LaTeX installation.
48+
3849
## Debugging RST with Sphinx
3950

4051
The original Sphinx live-reload preview is still available for debugging RST

docs/_static/css/custom.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@
44
.important p{
55
font-size: 100%;
66
}
7+
8+
.chipyard-logo-dark {
9+
display: none;
10+
}
11+
12+
img.diagram-white-background {
13+
background-color: white;
14+
border: 1px solid white;
15+
}

docs/astro.config.mjs

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,64 @@
11
import starlight from '@astrojs/starlight';
22
import { defineConfig } from 'astro/config';
3-
import { readFileSync } from 'node:fs';
3+
import { createReadStream, readFileSync, statSync } from 'node:fs';
4+
import { extname, resolve, sep } from 'node:path';
5+
import { fileURLToPath } from 'node:url';
46

57
import { sidebar } from './src/sidebar.mjs';
68

9+
const sphinxPublicRoot = resolve(fileURLToPath(new URL('./public/sphinx/', import.meta.url)));
10+
const sphinxContentTypes = {
11+
'.css': 'text/css; charset=utf-8',
12+
'.gif': 'image/gif',
13+
'.html': 'text/html; charset=utf-8',
14+
'.jpeg': 'image/jpeg',
15+
'.jpg': 'image/jpeg',
16+
'.js': 'text/javascript; charset=utf-8',
17+
'.json': 'application/json; charset=utf-8',
18+
'.png': 'image/png',
19+
'.svg': 'image/svg+xml',
20+
'.woff': 'font/woff',
21+
'.woff2': 'font/woff2',
22+
};
23+
24+
function serveSphinxAssets() {
25+
return {
26+
name: 'serve-sphinx-assets',
27+
configureServer(server) {
28+
server.middlewares.use((request, response, next) => {
29+
const pathname = new URL(request.url || '/', 'http://localhost').pathname;
30+
if (!pathname.startsWith('/sphinx/')) return next();
31+
32+
let relativePath;
33+
try {
34+
relativePath = decodeURIComponent(pathname.slice('/sphinx/'.length));
35+
} catch {
36+
return next();
37+
}
38+
39+
const filePath = resolve(sphinxPublicRoot, relativePath);
40+
if (!filePath.startsWith(sphinxPublicRoot + sep)) return next();
41+
42+
let file;
43+
try {
44+
file = statSync(filePath);
45+
} catch {
46+
return next();
47+
}
48+
if (!file.isFile()) return next();
49+
50+
response.statusCode = 200;
51+
response.setHeader('Content-Length', file.size);
52+
response.setHeader(
53+
'Content-Type',
54+
sphinxContentTypes[extname(filePath).toLowerCase()] || 'application/octet-stream',
55+
);
56+
createReadStream(filePath).on('error', next).pipe(response);
57+
});
58+
},
59+
};
60+
}
61+
762
function getBasePath() {
863
if (process.env.DOCS_BASE) return process.env.DOCS_BASE;
964
if (process.env.READTHEDOCS !== 'True') return undefined;
@@ -25,11 +80,15 @@ const legacyRedirects = Object.fromEntries(
2580
export default defineConfig({
2681
site: process.env.DOCS_SITE_URL || 'https://chipyard.readthedocs.io',
2782
base,
83+
vite: {
84+
plugins: [serveSphinxAssets()],
85+
},
2886
redirects: legacyRedirects,
2987
integrations: [
3088
starlight({
3189
title: 'Chipyard',
3290
description: 'Chipyard documentation',
91+
favicon: '/favicon/favicon.svg',
3392
logo: {
3493
dark: './_static/images/chipyard-logo-dark.svg',
3594
light: './_static/images/chipyard-logo.svg',
@@ -61,6 +120,44 @@ export default defineConfig({
61120
maxHeadingLevel: 4,
62121
},
63122
head: [
123+
{
124+
tag: 'link',
125+
attrs: {
126+
rel: 'icon',
127+
type: 'image/png',
128+
sizes: '96x96',
129+
href: `${basePrefix}/favicon/favicon-96x96.png`,
130+
},
131+
},
132+
{
133+
tag: 'link',
134+
attrs: {
135+
rel: 'shortcut icon',
136+
href: `${basePrefix}/favicon/favicon.ico`,
137+
},
138+
},
139+
{
140+
tag: 'link',
141+
attrs: {
142+
rel: 'apple-touch-icon',
143+
sizes: '180x180',
144+
href: `${basePrefix}/favicon/apple-touch-icon.png`,
145+
},
146+
},
147+
{
148+
tag: 'meta',
149+
attrs: {
150+
name: 'apple-mobile-web-app-title',
151+
content: 'Chipyard',
152+
},
153+
},
154+
{
155+
tag: 'link',
156+
attrs: {
157+
rel: 'manifest',
158+
href: `${basePrefix}/favicon/site.webmanifest`,
159+
},
160+
},
64161
{
65162
tag: 'meta',
66163
attrs: {

docs/index.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
Welcome to Chipyard's documentation (version "|version|")!
22
==========================================================
33

4-
.. image:: ./_static/images/chipyard-logo.svg
4+
.. raw:: html
5+
6+
<img alt="Chipyard" class="chipyard-logo-light"
7+
src="_static/images/chipyard-logo.svg">
8+
<img alt="Chipyard" class="chipyard-logo-dark"
9+
src="_static/images/chipyard-logo-dark.svg">
510

611
Chipyard is a framework for designing and evaluating full-system hardware using agile teams.
712
It is composed of a collection of tools and libraries designed to provide an integration between open-source and commercial tools for the development of systems-on-chip.
@@ -42,11 +47,3 @@ Table of Contents
4247
TileLink-Diplomacy-Reference/index
4348

4449
Prototyping/index
45-
46-
47-
Indices and tables
48-
==================
49-
50-
* :ref:`genindex`
51-
* :ref:`modindex`
52-
* :ref:`search`
7.39 KB
Loading
5.03 KB
Loading

0 commit comments

Comments
 (0)