Commit 22f5a7be authored by DreamSourceLab's avatar DreamSourceLab

fix issue #103: search ‘C’ (rising edge/falling edge)

parent 2e17f421
......@@ -882,6 +882,7 @@ bool LogicSnapshot::pattern_search(int64_t start, int64_t end, bool nxt, int64_t
while(nxt ? index <= end : index >= start) {
// get expacted and current pattern
exp_index.clear();
cur_edge.clear();
for(it_type iterator = pattern.begin();
iterator != pattern.end(); iterator++) {
uint16_t ch_index = iterator->first;
......@@ -934,6 +935,7 @@ bool LogicSnapshot::pattern_search(int64_t start, int64_t end, bool nxt, int64_t
(nxt ? sub_index <= end : sub_index >= start)) {
// get expacted and current pattern
exp_index.clear();
cur_edge.clear();
for(it_type iterator = pattern.begin();
iterator != pattern.end(); iterator++) {
uint16_t ch_index = iterator->first;
......@@ -1006,13 +1008,18 @@ bool LogicSnapshot::pattern_search(int64_t start, int64_t end, bool nxt, int64_t
cur_sample[ch_index] = get_sample(exp_index[seq], ch_index);
find_edge = get_pre_edge(exp_index[seq], cur_sample[ch_index], 1, ch_index);
}
if (find_edge)
if (find_edge) {
cur_sample[ch_index] = get_sample(exp_index[seq], ch_index);
else
if (iterator->second[cur_match_pos] == 'C')
exp_sample[ch_index] = cur_sample[ch_index];
} else
break;
}while(cur_sample[ch_index] != exp_sample[ch_index]);
}
seq++;
if (find_edge)
seq++;
else
break;
}
if (find_edge) {
if (nxt)
......
......@@ -234,22 +234,23 @@ void SearchDock::on_set()
{
dialogs::Search dlg(this, _session, _pattern);
if (dlg.exec()) {
_pattern = dlg.get_pattern();
std::map<uint16_t, QString> new_pattern = dlg.get_pattern();
QString search_label;
for (auto& iter:_pattern) {
for (auto& iter:new_pattern) {
iter.second.remove(QChar(' '), Qt::CaseInsensitive);
iter.second = iter.second.toUpper();
search_label.push_back(iter.second);
// if (iter.second != "XXXXXXXXXXXXXXXX") {
// search_label.push_back(QString::number(iter.first));
// search_label.push_back("/");
// }
}
_search_value->setText(search_label);
QFontMetrics fm = this->fontMetrics();
_search_value->setFixedWidth(fm.width(search_label)+_search_button->width()+20);
if (new_pattern != _pattern) {
_view.set_search_pos(_view.get_search_pos(), false);
_pattern = new_pattern;
}
}
}
......
Markdown is supported
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