当前位置: 首页 > news >正文

[HDLBits] Cs450/timer

Implement a timer that counts down for a given number of clock cycles, then asserts a signal to indicate that the given duration has elapsed. A good way to implement this is with a down-counter that asserts an output signal when the count becomes 0.
实现一个 timer,该 timer 对给定的 clock cycles 数进行倒计时,然后断言一个信号以指示给定的持续时间已过。实现这一点的一个好方法是使用一个 down-counter,当 count 变为 0 时,它断言一个 output signal。

At each clock cycle:
在每个 clock cycle:

  • If load = 1, load the internal counter with the 10-bit data, the number of clock cycles the timer should count before timing out. The counter can be loaded at any time, including when it is still counting and has not yet reached 0.
    如果 load = 1,则使用 10-bit 数据加载内部计数器,这是 timer 在 timeout 之前应该计算的 clock cycles 数。计数器可以随时加载,包括当计数器仍在计数且尚未达到 0 时。
  • If load = 0, the internal counter should decrement by 1.
    如果 load = 0,则内部计数器应递减 1。

The output signal tc ("terminal count") indicates whether the internal counter has reached 0. Once the internal counter has reached 0, it should stay 0 (stop counting) until the counter is loaded again.
输出信号 tc (“terminal count”) 指示内部计数器是否已达到 0。一旦内部计数器达到 0,它应该保持 0 (停止计数),直到再次加载计数器。

Below is an example of what happens when asking the timer to count for 3 cycles:
以下是要求 timer 计数 3 个周期时发生的情况示例:

module top_module(input clk, input load, input [9:0] data, output tc
);reg [9:0] cnt;wire ena;assign ena = cnt == 0;assign tc = ena;//先做load的逻辑always@(posedge clk) beginif(load) begincnt <= data;endelse if (cnt > 0)begincnt <= cnt - 1; endelse begincnt <= cnt;endendendmodule

http://www.dtcms.com/a/264559.html

相关文章:

  • 工业网络安全新范式——从风险可见性到量化防御的进化
  • 优雅草蜻蜓R实时音视频会议系统技术规划与全球RTC开源技术全景分析·优雅草卓伊凡|麻子|贝贝|clam
  • CentOS系统如何安装和使用docker
  • SpringSSM
  • NV113NV116美光固态闪存NV120NV130
  • 7月2日星期三今日早报简报微语报早读
  • 【一起来学AI大模型】通义千问API入门教程
  • NVIDIA智能汽车技术公开课笔记
  • 【Maven】Maven核心机制的 万字 深度解析
  • Oracle 证书等级介绍
  • Spring AI 源码
  • 全面的 Spring Boot 整合 RabbitMQ 的 `application.yml` 配置示例
  • 将文件使用base64存入数据库并在微信小程序中实现文件下载
  • springboot 显示打印加载bean耗时工具类
  • iOS App无源码安全加固实战:如何对成品IPA实现结构混淆与资源保护
  • python中两种策略模式的实现
  • 2-RuoYi-UI管理平台的启动
  • 大语言模型随意猜测网址引发网络安全危机
  • 零信任安全:重塑网络安全架构的革命性理念
  • 【Unity3D实现加载在线地图——WebGL】
  • 【ABAP】 从无到有 新建一个Webdynpro程序
  • 同一水平的 RISC-V 架构的 MCU,和 ARM 架构的 MCU 相比,运行速度如何?
  • Tomcat log日志解析
  • 【Linux】文件权限以及特殊权限(SUID、SGID)
  • Highcharts 安装使用教程
  • Flutter Widget Preview 功能已合并到 master,提前在体验毛坯的预览支持
  • flutter flutter_vlc_player播放视频设置循环播放失效、初始化后获取不到视频宽高
  • 机器学习:集成学习方法之随机森林(Random Forest)
  • AWS RDS Aurora全局数据库转区域数据库实战指南:无缝迁移零停机
  • Windows VMWare Centos Docker部署Springboot 应用实现文件上传返回文件http链接