Skip to content

Commit 2b3ea05

Browse files
committedOct 17, 2016
greenpak4: Fixed Greenpak4SystemReset to accurately reflect behavior described in latest (r085) datasheet.
1 parent 01213bf commit 2b3ea05

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed
 

‎doc/gp4-hdl.tex

+8-6
Original file line numberDiff line numberDiff line change
@@ -3015,9 +3015,8 @@ \subsubsection{Introduction}
30153015
device datasheet for exact functionality) and is independent of the power-on reset, which cannot be configured.
30163016

30173017
Note that this block has slightly different timing than the power-on reset, which may cause glitches in some designs.
3018-
To ensure consistent behavior between the runtime reset and boot, it may be necessary to instantiate the \tokenref{GP\_POR}{gp-por} block and gate glitching signals with \tokenstyle{RST\_DONE}.
3019-
3020-
TODO: Latest GP4 datasheet (r085 p 20) seems to indicate FALLING mode does not exist, need to redo this?
3018+
To ensure consistent behavior between the runtime reset and boot, it may be necessary to instantiate the
3019+
\tokenref{GP\_POR}{gp-por} block and gate glitching signals with \tokenstyle{RST\_DONE}.
30213020

30223021
\subsubsection{Port Descriptions}
30233022

@@ -3036,9 +3035,11 @@ \subsubsection{Parameter Descriptions}
30363035
\whenstyle{Parameter} & \whenstyle{Type} & \whenstyle{Width} & \whenstyle{Function} \\
30373036
\thickhline
30383037
\tokenstyle{RESET\_MODE} & String & 1 &
3039-
\strexamplestyle{RISING} One-shot reset on rising edge of RST. \newline
3040-
\strexamplestyle{FALLING} One-shot reset on falling edge of RST. \newline
3038+
\strexamplestyle{EDGE} One-shot reset on rising edge of RST. \newline
30413039
\strexamplestyle{LEVEL} System is held in reset while RST is high.\\
3040+
\tokenstyle{EDGE\_SPEED} & Integer & 9 &
3041+
Delay speed for the edge detector, in $\mu s$. Must be 4 or 500. \newline
3042+
Ignored if RESET\_MODE is LEVEL.\\
30423043
\thinhline
30433044
\end{tabularx}
30443045

@@ -3049,7 +3050,8 @@ \subsubsection{Verilog Usage Example}
30493050
\begin{figure}[h]
30503051
\begin{lstlisting}
30513052
GP_SYSRESET #(
3052-
.RESET_MODE("LEVEL")
3053+
.RESET_MODE("LEVEL"),
3054+
.EDGE_SPEED(4)
30533055
) reset_ctrl (
30543056
.RST(rst)
30553057
);

‎src/greenpak4/Greenpak4SystemReset.cpp

+20-20
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Greenpak4SystemReset::Greenpak4SystemReset(
3131
unsigned int cbase)
3232
: Greenpak4BitstreamEntity(device, matrix, ibase, oword, cbase)
3333
, m_resetMode(RISING_EDGE)
34+
, m_resetDelay(500)
3435
, m_reset(device->GetGround())
3536
{
3637

@@ -93,20 +94,32 @@ void Greenpak4SystemReset::CommitChanges()
9394
string p = ncell->m_parameters["RESET_MODE"];
9495
if(p == "RISING")
9596
mode = Greenpak4SystemReset::RISING_EDGE;
96-
else if(p == "FALLING")
97-
mode = Greenpak4SystemReset::FALLING_EDGE;
9897
else if(p == "LEVEL")
9998
mode = Greenpak4SystemReset::HIGH_LEVEL;
10099
else
101100
{
102101
LogError(
103-
"Reset \"%s\" has illegal reset mode \"%s\" (must be RISING, FALLING, or LEVEL)\n",
102+
"Reset \"%s\" has illegal reset mode \"%s\" (must be RISING or LEVEL)\n",
104103
ncell->m_name.c_str(),
105104
p.c_str());
106105
exit(-1);
107106
}
108107
SetResetMode(mode);
109108
}
109+
110+
if(ncell->HasParameter("EDGE_SPEED"))
111+
{
112+
m_resetDelay = atoi(ncell->m_parameters["EDGE_SPEED"].c_str());
113+
114+
if( (m_resetDelay != 4) && (m_resetDelay != 500) )
115+
{
116+
LogError(
117+
"Reset \"%s\" has illegal reset speed %d us (must be 4 or 500)\n",
118+
ncell->m_name.c_str(),
119+
m_resetDelay);
120+
exit(-1);
121+
}
122+
}
110123
}
111124

112125
bool Greenpak4SystemReset::Load(bool* /*bitstream*/)
@@ -128,23 +141,10 @@ bool Greenpak4SystemReset::Save(bool* bitstream)
128141
// Configuration
129142

130143
//Reset mode
131-
switch(m_resetMode)
132-
{
133-
case HIGH_LEVEL:
134-
bitstream[m_configBase + 0] = true;
135-
bitstream[m_configBase + 1] = false;
136-
break;
137-
138-
case RISING_EDGE:
139-
bitstream[m_configBase + 0] = false;
140-
bitstream[m_configBase + 1] = false;
141-
break;
142-
143-
case FALLING_EDGE:
144-
bitstream[m_configBase + 0] = false;
145-
bitstream[m_configBase + 1] = true;
146-
break;
147-
}
144+
bitstream[m_configBase + 0] = (m_resetMode == HIGH_LEVEL);
145+
146+
//Edge detector speed
147+
bitstream[m_configBase + 1] = (m_resetDelay == 500);
148148

149149
//Reset enable if m_reset is not a power rail (ground)
150150
if(!m_reset.IsPowerRail())

‎src/greenpak4/Greenpak4SystemReset.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class Greenpak4SystemReset : public Greenpak4BitstreamEntity
4444
enum ResetMode
4545
{
4646
RISING_EDGE,
47-
FALLING_EDGE,
4847
HIGH_LEVEL
4948
};
5049

@@ -64,6 +63,9 @@ class Greenpak4SystemReset : public Greenpak4BitstreamEntity
6463
///Configuration for the reset
6564
ResetMode m_resetMode;
6665

66+
///Delay value for the reset's edge detector
67+
int m_resetDelay;
68+
6769
///The reset signal itself
6870
Greenpak4EntityOutput m_reset;
6971
};

0 commit comments

Comments
 (0)