1 \documentclass[a4paper,11pt]{article}
3 \usepackage[latin1]{inputenc}
4 \usepackage[T1]{fontenc}
5 \usepackage[normalem]{ulem}
6 \usepackage[english]{babel}
7 \usepackage{listings,babel}
8 \lstset{breaklines=true,basicstyle=\ttfamily}
15 \title{Configuration and Status Register (CSR) bus specifications}
16 \author{S\'ebastien Bourdeauducq}
19 \setlength{\parindent}{0pt}
20 \setlength{\parskip}{5pt}
22 \section{Introduction}
23 The CSR bus is designed to provide a lightweight interface to the configuration and status registers (CSRs) of peripherals.
25 It is built on the following principles:
27 \item Synchronism. The bus is meant to be used in FPGA-based devices, whose architectures are designed for synchronous (clock-driven) systems.
28 \item Low signal count. There is no need for signals that take care of variable latency and qualification of accesses; since CSRs are often actual registers (D flip-flops) that can always be read or written at anytime within one cycle. There is no need for a large address bus; a fairly complicated SoC only contains about a thousand CSRs.
29 \item Low performance. Performance and associated complications are not needed for CSRs.
30 \item High routability. The CSR bus must often span several devices in the chip that can be physically separated by a large distance, resulting in large routing and load delays. To avoid creating critical paths on the bus, the protocol must ease implementations with little combinatorial logic at endpoints.
33 \section{Specifications}
35 A CSR interface is made up of the following signals:
37 \begin{tabularx}{\textwidth}{|l|l|l|X|}
39 \bf{Signal} & \bf{Width} & \bf{Direction} & \bf{Description} \\
41 a & 14 & Master to slave & Address signals. The upper 4 bits are used to select a slave, and the lower 10 to select a register within that slave. \\
43 we & 1 & Master to slave & Write enable signal. \\
45 dw & 32 & Master to slave & Write data. \\
47 dr & 32 & Slave to master & Read data. \\
51 The operation is the same as that of a synchronous SRAM; except that it only responds when the upper 4 address bits are set to a particular value. The read and write cycles are detailed below.
53 \subsection{Read cycle}
54 The master initiates a read cycle by positioning the address lines in accordance with the device and register it wants to read. The write enable signal is set to 0.
56 The upper 4 address bits are used to select a slave. A single CSR bus can span up to 16 slaves. The lower 10 bits are used to select a register within a slave. Each slave can have up to 1024 registers.
58 The slave responds at the next clock cycle by positioning the contents of the requested register on the read data lines. The operation is pipelined, ie. while the slave responds, the master can position the address lines to read a register again at the next cycle.
60 If the slave is not selected (the upper 4 bits are not set to its address), it must assert 0 on all data read lines.
62 Here is an example timing diagram of read cycles to a slave responding to address 6:
64 \begin{tabular}{|l|c|c|c|c|c|c|c|}
66 a & 5.2 & 3.1 & 6.1 & 3.1 & 6.42 & 6.12 & 12.321 \\
68 we & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
70 dw & X & X & X & X & X & X & X \\
72 dr & 0 & 0 & 0 & Reg 1 & 0 & Reg 42 & Reg 12 \\
78 a.b = bit vector made by concatening the binary representations of a (4-bit) and b (10-bit)
80 \subsection{Write cycle}
81 The master initiates a write cycle by presenting valid data on \verb!dw!, asserting \verb!we!, and positioning the address lines in accordance with the slave and register it wants to write to.
83 As for read cycles, the upper 4 bits are used to select a slave, and the lower 10 bits are used to select a register within that slave.
85 If the slave is not selected, it ignores the write cycle. If it is selected, it writes its register at the next cycle.
87 After a write cycle (\verb!we=1!), the data read lines are invalid, no matter whether a slave was selected or not.
89 It is possible to issue two or more consecutive write cycles.
91 Here is an example timing diagram of write and read cycles to a slave responding to address 6:
93 \begin{tabular}{|l|c|c|c|c|c|c|c|}
95 a & 5.2 & 3.1 & 6.1 & 3.1 & 6.42 & 6.12 & 12.321 \\
97 we & 1 & 0 & 1 & 0 & 1 & 0 & 0 \\
99 dw & 32 & X & 12 & X & 143 & X & X \\
101 dr & 0 & X & 0 & X & 0 & X & Reg 12 \\
103 Writes & -- & -- & -- & $12\to1$ & -- & $143\to42$ & -- \\
107 \section{Bus topology}
111 \includegraphics[height=80mm]{csr_topology.eps}
112 \caption{Example CSR bus topology}
115 To combine several CSR buses so that many slaves can be accessed by a single master, the following connections should be made:
117 \item connect all \verb!a!, \verb!we! and \verb!dw! signals together (master to slave path).
118 \item perform a bitwise OR on all \verb!dr! outputs of the slaves, and connect the output of the OR to the \verb!dr! input of the master (slave to master path).
120 With these connections, the master can access multiple slaves as if it it was connected to only one.
121 This topology is similar to the ``distributed OR'' topology of the DCR bus in the IBM CoreConnect architecture, and has the same advantages.
123 \section*{Copyright notice}
124 Copyright \copyright 2007-2009 S\'ebastien Bourdeauducq. \\
125 Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the LICENSE.FDL file at the root of the Milkymist source distribution.