时序分析基本概念介绍<Sequential logic>

640?wx_fmt=gif

今天我们要介绍的时序分析基本概念是Sequential logic。中文名,时序逻辑单元。时序逻辑单元是数字IC设计中另一类重要器件,它的特点是任意时刻的输出不仅取决于该时刻的输入,而且还和电路原来的状态有关。电路里面有存储元件(各类触发器,比如D 触发器)用于记忆信息,从电路行为上讲,不管输入如何变化,仅当时钟的沿(上升沿或下降沿)到达时,才有可能使输出发生变化。

相比组合逻辑,时序器件存在着更多的timing model。如下图所示,对于同步输入逻辑,存在着CK  pin到 D pin SI pin ,SE pin之间的 setup和hold check;同步输出逻辑,存在着CK pin到Q pin之间的 propagation delay, 对于异步逻辑,存在着pin CK到pin CDN之间的recovery, removal check。 

640?wx_fmt=jpeg


  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Here's the function template to solve the Joseph problem using a specified type of sequential container as the template parameter: ```cpp template<typename Container> int joseph(int n, int m) { Container knights; for (int i = 1; i <= n; ++i) { knights.push_back(i); } auto it = knights.begin(); while (knights.size() > 1) { for (int i = 1; i < m; ++i) { ++it; if (it == knights.end()) { it = knights.begin(); } } it = knights.erase(it); if (it == knights.end()) { it = knights.begin(); } } return knights.front(); } ``` The function takes two integer parameters `n` and `m`, which are the number of knights and the count to skip before removing a knight, respectively. The function returns the number of the last knight left standing. To call the function with different sequential container types, we can use the following code: ```cpp int main() { int n = 100000; int m = 5; // Using vector<int> auto start_time = chrono::steady_clock::now(); int result = joseph<vector<int>>(n, m); auto end_time = chrono::steady_clock::now(); cout << "vector<int>: " << result << ", time: " << chrono::duration_cast<chrono::milliseconds>(end_time - start_time).count() << "ms" << endl; // Using deque<int> start_time = chrono::steady_clock::now(); result = joseph<deque<int>>(n, m); end_time = chrono::steady_clock::now(); cout << "deque<int>: " << result << ", time: " << chrono::duration_cast<chrono::milliseconds>(end_time - start_time).count() << "ms" << endl; // Using list<int> start_time = chrono::steady_clock::now(); result = joseph<list<int>>(n, m); end_time = chrono::steady_clock::now(); cout << "list<int>: " << result << ", time: " << chrono::duration_cast<chrono::milliseconds>(end_time - start_time).count() << "ms" << endl; return 0; } ``` This code first sets `n` and `m` to the desired values. It then calls the `joseph` function with `vector<int>`, `deque<int>`, and `list<int>` as the sequential container types, and measures the time it takes to run each call using the `chrono` library. Finally, it prints the results and the execution times for each container type. Note that the time it takes to run the function depends on the size of `n` and the value of `m`. For large values of `n` and small values of `m`, the function may take a long time to run, especially for `list<int>` which has slower insertions and deletions than `vector<int>` and `deque<int>`.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值