Skip to content

Commit 49aa66e

Browse files
committedMay 22, 2017
Finished support for separating counters with 4- and 3-bit input muxes. This means that RC oscillator pre-divider value of 12 now works reliably without needing LOC constraints. Fixes #83.
1 parent a2eb1b6 commit 49aa66e

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed
 

‎doc/gp4-hdl.tex

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ \subsection{\namestyle{gp4par} Device Limitations}
219219

220220
\begin{itemize}
221221
\item Counters: Delay, edge detector, PWM, wake-sleep mode, counter cascading.
222-
All clock sources other than on-chip oscillators. Pre-divider value of 12.
222+
All clock sources other than on-chip oscillators.
223223
\item ADC
224224
\item DAC: Inputs from DCMP.
225225
\item Wake-Sleep

‎src/gp4par/make_graphs.cpp

+17-2
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,22 @@ bool MakeNetlistNodes(
383383
return false;
384384
}
385385

386+
//Special label remapping for counters!
387+
//If a GP_COUNT8 asks for a pre-divider of 12, change the label to GP_COUNT8_X4INPUT
388+
//TODO: see if any other pre-divider values are special?
389+
//Note that GP_COUNT8_ADV always has a 4-bit input mux, as does a GP_COUNT14_ADV
390+
//so no special casing needed for those
391+
if(cell->m_type == "GP_COUNT8")
392+
{
393+
//See if we have CLKIN_DIVIDE == 12
394+
if(cell->m_parameters["CLKIN_DIVIDE"] == "12")
395+
{
396+
LogDebug("Found CLKIN_DIVIDE = 12 on GP_COUNT8 instance %s, changing to GP_COUNT8_X4INPUT\n",
397+
cell->m_name.c_str());
398+
label = ilmap["GP_COUNT8_X4INPUT"];
399+
}
400+
}
401+
386402
//Create a node for the cell
387403
PARGraphNode* nnode = new PARGraphNode(label, cell);
388404
cell->m_parnode = nnode;
@@ -551,7 +567,6 @@ void MakeDeviceNodes(
551567
uint32_t count8_adv_label = AllocateLabel(ngraph, dgraph, lmap, "GP_COUNT8_ADV");
552568
uint32_t count14_label = AllocateLabel(ngraph, dgraph, lmap, "GP_COUNT14");
553569
uint32_t count14_adv_label = AllocateLabel(ngraph, dgraph, lmap, "GP_COUNT14_ADV");
554-
uint32_t count14_x4input_label = AllocateLabel(ngraph, dgraph, lmap, "GP_COUNT14_X4INPUT");
555570
uint32_t count8_x4input_label = AllocateLabel(ngraph, dgraph, lmap, "GP_COUNT8_X4INPUT");
556571
for(unsigned int i=0; i<device->GetCounterCount(); i++)
557572
{
@@ -570,7 +585,7 @@ void MakeDeviceNodes(
570585
node->AddAlternateLabel(count8_label);
571586
node->AddAlternateLabel(count14_label);
572587
node->AddAlternateLabel(count8_x4input_label);
573-
node->AddAlternateLabel(count14_x4input_label);
588+
//There's no GP_COUNT14_X4INPUT because all GP_COUNT14_ADV cells have 4-bit input muxes
574589
}
575590
else
576591
{

‎tests/greenpak4/slg46620v/Count12.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ module Count12(dout);
5656

5757
GP_COUNT8 #(
5858
.RESET_MODE("LEVEL"),
59-
.COUNT_TO(12),
59+
.COUNT_TO(32),
6060
.CLKIN_DIVIDE(12)
6161
) cnt (
6262
.CLK(clk_6khz_cnt),

0 commit comments

Comments
 (0)
Please sign in to comment.