Commit c2ca78ac authored by GuillemCabo's avatar GuillemCabo
Browse files

add pmu_ahb specification

parent 725f52d6
*.log
*.out
*.toc
*.aux
*.pyg
*.pdf
*.bbl
*.blg
*.cut
*.dvi
*.gz
\newpage
\section{General purpose of the module}
This module is the top level for the application specific PMU.
It implements an AHB slave interface that connects with any compliant master with a 32 wide amba bus.
Wider buses can be used with minimal modifications, for more detail on this matter check AMBA AHB specification \cite{TODO}, section 6.2.1.\\
%http://www.eecs.umich.edu/courses/eecs373/readings/ARM_IHI0033A_AMBA_AHB-Lite_SPEC.pdf
\\
The module has a set of registers that are synchronized between the interface agnostic PMU and the SoC. Writes to the registers are updated to internal registers of each PMU feature if needed.
\ No newline at end of file
\section{Design placement}
\label{chapter2}
This modules is meant to be used as a top level. It will instance PMU\_raw, and only one instance is required.
\section{Parameters}
\label{chapter3}
This unit uses several parameters. \textbf{REG\_WIDTH} defines the size of the data registers.\\
\\
\textbf{HDATA\_WIDTH} and \textbf{HADDR\_WIDTH} define the width of the data and address signals.\\
\\
\textbf{MCCU\_N\_CORES}, \textbf{N\_REGS}, \textbf{PMU\_CFG} and \textbf{PMU\_COUNTERS} define the parameters of the PMU that will be used.
\section{Interface}\label{interface}
\label{chapter 4}
\begin{table}[ht]
\scriptsize
\centering
\begin{tabular}{llllll}
\hline
Port Name & Direction & Width & Index & Comment & Comment Source
\\
\hline
rstn\_i & INPUT & 1 & Clock & Width of registers data bus & module port
\\
clk\_i & INPUT & 1 & - & - & -\\
hsel\_i & INPUT & 1 & - & Slave select & module port
\\
hreadyi\_i & INPUT & 1 & - & Previous transfer done & module port
\\
haddr\_i & INPUT & 32 & [31:0] & Address bus & module port
\\
hwrite\_i & INPUT & 1 & - & Read/write & module port
\\
htrans\_i & INPUT & 2 & [1:0] & Transfer type & module port
\\
hsize\_i & INPUT & 3 & [2:0] & Transfer size & module port
\\
hburst\_i & INPUT & 3 & [2:0] & Burst type & module port
\\
hwdata\_i & INPUT & 32 & [31:0] & Write data bus & module port
\\
hprot\_i & INPUT & 4 & [3:0] & Portection control & module port
\\
hmastlock\_i & INPUT & 1 & - & Locked access & module port
\\
hreadyo\_o & OUTPUT & 1 & - & Trasfer done & module port
\\
hresp\_o & OUTPUT & 2 & [1:0] & response type & module port
\\
hrdata\_o & OUTPUT & 32 & [31:0] & Read data bus & module port
\\
events\_i & INPUT & 24 & [23:0] & PMU input events6 & module port
\\
intr\_overflow\_o & OUTPUT & 1 & - & Overflow interruption & module port
\\
intr\_quota\_o & OUTPUT & 1 & - & Quota interruption & module port
\\
intr\_MCCU\_o & OUTPUT & 4 & [3:0] & MCCU interruptions & module port
\\
intr\_RDC\_o & OUTPUT & 1 & - & RDC interruption & module port
\\
\hline
\end{tabular}
\caption{Ports of module pmu\_ahb}
\label{port:pmu\_ahb}
\end{table}
Interface signals of the module are listed in table \ref{port:RDC}
%TODO
%\begin{table}[H]
% \centering
% \begin{tabular}{lllll}
% \hline
% Port\_Name & Direction & Width & Index & Description \\
% \hline
% CLK & INPUT & 1 & - & Main clock, up to 200MHz \\
% RST & INPUT & 1 & - & Hard reset. Active LOW \\
% SOFT\_RST & INPUT & 1 & - & Soft reset. Active LOW \\
% RESET\_ADDRESS & INPUT & 40 & - & Inital address of PC after soft or hard reset \\
% CSR\_RW\_RDATA & INPUT & 64 & - & - \\
% \end{tabular}
%\end{table}
\section{Reset behavior}
The module contains a single global reset, called \textbf{rstn\_i} it is asynchronous and active low.\\
At reset internal registers shall be set to 0.
\section{What could not happen}
The clock of this module (\textbf{clk\_i}) shall be the same than the clock of the modules that generate the events. If the clock does not come from the same source events are not guaranteed to be registered. If the clock is faster events will be duplicated. If the clock is slower the events will not register.\\
\\
No special restrictions have been considered other than specified in section \ref{behavior}
\ No newline at end of file
\section{Behavior}\label{behavior}
\subsection{ AHB registers}
The internal registers are generated parametrically based in \textbf{REG\_WIDTH} and \textbf{N\_REGS}. They are named \textbf{slv\_reg} and the input and output of such registers are named \textbf{slv\_reg\_D} and \textbf{slv\_reg\_Q}. At reset the values become 0.\\
\\
\subsection{AHB control logic}
The control logic is divided in several elements. Since AHB is a pipelined protocol we have two phases, named address and data. While in address phase the transaction gets started by the slave, on data phase the content of the writes or reads is transferred.\\
\\
In address phase, we check \textbf{htrans\_i} in combinational logic to determine if the state of the bus transfer (\textbf{IDLE, BUSY, NONSEQUENTIAL, SEQUENTIAL}) and if the slave is selected. The output of this logic is the signal named \textbf{next}.Then a small state machine that registers the required inputs to handle a transfer. The state of the machine is given by \textbf{next}. The signals from the bus are stored several registers defined as the packed structure \textbf{address\_phase}. It has a select, write and address\_phase fields.\\
\\
In the data phase of the transference we have combinational logic to determine the memory position from our register bank that needs to be accessed, and assign the data required to \textbf{dread\_slave} or \textbf{dwrite\_slave} depending on the transaction. Reads are taken from \textbf{slv\_reg\_Q}. Bussy and IDLE states put fix values in the dwrite\_slave and dread\_slave signals to ease detection of any bug, since such values shall never be used unless there is a bug in the module.\\
\\
\subsection{Slave registers update}
The slave registers need to be sync between the PMU\_raw submodule and the SoC. If there where no logic to manage conflicts between updates of the counters by the PMU features and the incoming writes the register values may become inconsistent. In order to prevent this issue, when there is an incoming write \textbf{slv\_reg\_Q} and \textbf{slv\_reg\_D} \textbf{slv\_reg\_D}, allowing to register the new value and passing to the submodules the most updated value for such register. If no write transaction is active the pmu updates the registers with the signal \textbf{pmu\_regs\_int}.
\subsection{Packages and structures}
No packages are used.\\
\\
A single structure is used. It is named pmu\_regs\_int and it contains one bit to record bus select, bus writes, and the address for the incoming request.\\
\\
Structures and typedef could be used more extensively to handle Types of bursts, Type of transfers, Type of Ready outputs, etc...
\section{Special cases, corner cases}
The interrupts shall be generated if the current pulse value is equal or larger than the event weigth. Otherwise if the event weight is set to the maximum value of the register, due to the overflow protection of the counters will prevent the interrupt to trigger, producing a non intuitive outcome. \\
\\
\ No newline at end of file
CC=pdflatex
all: spec
spec: main.tex 1-Section.tex 2-Section.tex 3-Section.tex 4-Section.tex 5-Section.tex 6-Section.tex 7-Section.tex 8-Section.tex
$(CC) main.tex
clean:
rm *.aux *.log *.blg *.bbl *.out
clear:
rm *.aux *.log *.blg *.bbl *.out *.pdf
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{fourier} % Use the Adobe Utopia font for the document - comment this line to return to the LaTeX default
\usepackage[english]{babel} % English language/hyphenation
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{float}
\usepackage{blindtext} %for enumarations
\usepackage[]{hyperref} %link collor
%talbe layout to the right
%\usepackage[labelfont=bf]{caption}
%\captionsetup[table]{labelsep=space,justification=raggedright,singlelinecheck=off}
%\captionsetup[figure]{labelsep=quad}
\usepackage{sectsty} % Allows customizing section commands
\allsectionsfont{\centering \normalfont\scshape} % Make all sections centered, the default font and small caps
\usepackage{fancyhdr} % Custom headers and footers
\pagestyle{fancyplain} % Makes all pages in the document conform to the custom headers and footers
\fancyhead{} % No page header - if you want one, create it in the same way as the footers below
\fancyfoot[L]{} % Empty left footer
\fancyfoot[C]{} % Empty center footer
\fancyfoot[R]{\thepage} % Page numbering for right footer
\renewcommand{\headrulewidth}{0pt} % Remove header underlines
\renewcommand{\footrulewidth}{0pt} % Remove footer underlines
\setlength{\headheight}{13.6pt} % Customize the height of the header
\numberwithin{equation}{section} % Number equations within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{figure}{section} % Number figures within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{table}{section} % Number tables within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
%\setlength\parindent{0pt} % Removes all indentation from paragraphs - comment this line for an assignment with lots of text
\setlength\parskip{4pt}
%----------------------------------------------------------------------------------------
% TITLE SECTION
%----------------------------------------------------------------------------------------
\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height
\title{
\normalfont \normalsize
\horrule{0.5pt} \\[0.4cm] % Thin top horizontal rule
\huge PMU\_ahb specification version v1 \\ % The assignment title
\horrule{2pt} \\[0.5cm] % Thick bottom horizontal rule
}
\author{ Guillem Cabo Pitarch} % Your name
\date{\today} % Today's date or a custom date
\begin{document}
%\nocite{*}
\maketitle % Print the title
\newpage
\tableofcontents
%----------------------------------------------------------------------------------------
% Section 1
%----------------------------------------------------------------------------------------
\input{1-Section.tex}
%----------------------------------------------------------------------------------------
% Section 2
%----------------------------------------------------------------------------------------
\input{2-Section.tex}
\input{3-Section.tex}
\input{4-Section.tex}
\input{5-Section.tex}
\input{6-Section.tex}
\input{7-Section.tex}
\input{8-Section.tex}
\end{document}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment