skip debounce in simulation
This commit is contained in:
@@ -32,6 +32,7 @@ int main(int argc, char **argv) {
|
||||
tb->trace(tfp, 00);
|
||||
tfp->open("build/waveform.vcd");
|
||||
|
||||
// initial state
|
||||
tb->i_resetN = 1;
|
||||
tb->i_startN = 1;
|
||||
tb->i_stopN = 1;
|
||||
@@ -39,6 +40,7 @@ int main(int argc, char **argv) {
|
||||
for (int k = 0; k < 2; k++)
|
||||
tick(++tickcount, tb, tfp);
|
||||
|
||||
// reset pulse, then wait for a few clock cycles
|
||||
tb->i_resetN = 0;
|
||||
tick(++tickcount, tb, tfp);
|
||||
tb->i_resetN = 1;
|
||||
@@ -46,21 +48,26 @@ int main(int argc, char **argv) {
|
||||
for (int k = 0; k < 3; k++)
|
||||
tick(++tickcount, tb, tfp);
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
tb->i_startN = 0;
|
||||
tick(++tickcount, tb, tfp);
|
||||
tb->i_startN = 1;
|
||||
tick(++tickcount, tb, tfp);
|
||||
}
|
||||
// relevant const
|
||||
const unsigned int main_clk_Hz = 100 * 1000 * 1000; // 100 MHz
|
||||
const unsigned int db_clk_Hz = 10; // 10 ms -> 10 Hz
|
||||
const unsigned int db_ticks = main_clk_Hz / db_clk_Hz;
|
||||
|
||||
for (int k = 0; k < 15; k++)
|
||||
// start pulse
|
||||
|
||||
tb->i_startN = 0;
|
||||
tick(++tickcount, tb, tfp);
|
||||
tb->i_startN = 1;
|
||||
|
||||
for (int k = 0; k < 394; k++)
|
||||
tick(++tickcount, tb, tfp);
|
||||
|
||||
// stop pulse
|
||||
tb->i_stopN = 0;
|
||||
tick(++tickcount, tb, tfp);
|
||||
tb->i_stopN = 1;
|
||||
|
||||
for (int k = 0; k < 3; k++)
|
||||
for (int k = 0; k < 30; k++)
|
||||
tick(++tickcount, tb, tfp);
|
||||
|
||||
tb->i_resetN = 0;
|
||||
|
||||
Reference in New Issue
Block a user