Skip to content

Commit e2c9aae

Browse files
committedAug 15, 2017
Implemented load support for Greenpak4PatternGenerator
1 parent bfe44cb commit e2c9aae

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed
 

Diff for: ‎src/greenpak4/Greenpak4PatternGenerator.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,31 @@ Greenpak4EntityOutput Greenpak4PatternGenerator::GetInput(string port) const
164164
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
165165
// Serialization
166166

167-
bool Greenpak4PatternGenerator::Load(bool* /*bitstream*/)
167+
bool Greenpak4PatternGenerator::Load(bool* bitstream)
168168
{
169-
LogError("unimplemented\n");
170-
return false;
169+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
170+
// INPUT BUS
171+
172+
ReadMatrixSelector(bitstream, 2, m_matrix, m_clk);
173+
ReadMatrixSelector(bitstream, 3, m_matrix, m_reset);
174+
175+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
176+
// CONFIGURATION
177+
178+
//The pattern we generate
179+
for(unsigned int i=0; i<16; i++)
180+
m_truthtable[i] = bitstream[m_configBase + i];
181+
182+
//4-bit counter data
183+
m_patternLen =
184+
(
185+
bitstream[m_configBase + 16] |
186+
(bitstream[m_configBase + 17] << 1) |
187+
(bitstream[m_configBase + 18] << 2) |
188+
(bitstream[m_configBase + 19] << 3)
189+
) + 1;
190+
191+
return true;
171192
}
172193

173194
bool Greenpak4PatternGenerator::Save(bool* bitstream)

0 commit comments

Comments
 (0)