当前位置:网站首页>VerilogA - counter
VerilogA - counter
2022-06-29 06:49:00 【Summer wind murmurs】
With low level active reset 8-bit Cycle counter VerilogA Code
// VerilogA for COUNTER_8B, veriloga
`include "constants.vams"
`include "disciplines.vams"
module COUNTER_8B (B7, B6, B5, B4, B3, B2, B1, B0, CLK, RSTN);
electrical B7, B6, B5, B4, B3, B2, B1, B0, CLK, RSTN;
parameter real trise = 1p;
parameter real tfall = 1p;
parameter real tdely = 0;
parameter real vlogic_high = 1;
parameter real vlogic_low = 0;
parameter real vtrans_clk = 0.5;
`define num_bits 8
real i;
real t;
real halfscal;
real fun[0:`num_bits-1];
integer m;
analog begin
@ (initial_step) begin
i=0;
halfscal = 128;
end
@ (cross(V(CLK) - vtrans_clk, +1) or cross(V(RSTN) - vtrans_clk, -1)) begin
if(V(RSTN) < vtrans_clk) begin
i = 0;
end
else if (i == 255) begin
i = 0;
end
else
begin
i=i+1;
end
t = i;
for (m=(`num_bits-1); m >=0; m=m-1) begin
fun[m] = 0;
if (t > halfscal-1) begin
fun[m]=vlogic_high;
t = t - halfscal;
end
else begin
fun[m]=vlogic_low;
end
t = t * 2;
end
end
V(B7) <+ transition( fun[7], tdely, trise, tfall );
V(B6) <+ transition( fun[6], tdely, trise, tfall );
V(B5) <+ transition( fun[5], tdely, trise, tfall );
V(B4) <+ transition( fun[4], tdely, trise, tfall );
V(B3) <+ transition( fun[3], tdely, trise, tfall );
V(B2) <+ transition( fun[2], tdely, trise, tfall );
V(B1) <+ transition( fun[1], tdely, trise, tfall );
V(B0) <+ transition( fun[0], tdely, trise, tfall );
`undef num_bits
end
endmodule
边栏推荐
- Vite快速上手
- After “Go to Definition”, is there a command to return to where you came from?
- Service grid ASM year end summary: how do end users use the service grid?
- How does MySQL implement distributed locks?
- I would like to ask what securities dealers recommend? Is it safe to open an account online?
- Li Kou today's question -324 Swing sort II
- Subtotal of C language -- basic data types and their representations
- What are the uses of wireless pressure collectors?
- VerilogA——动态比较器
- Chapter IV introduction to FPGA development platform
猜你喜欢

How to do the performance pressure test of "Health Code"

Chapter V online logic analyzer signaltap

Print Yanghui triangle

MySQL add / delete / modify query SQL statement exercise yyds dry goods inventory

What are the uses of wireless pressure collectors?

Service grid ASM year end summary: how do end users use the service grid?

Why are keys unordered in golang map

Design of leetcode simple problem goal parser

The echares map is implemented separately by provinces, and the tooltip user-defined prompt box, scattered annotation and scattered illumination are explained in detail

Part 63 - interpreter and compiler adaptation (II)
随机推荐
Teach you how to develop your own NPM package (publish to the NPM official website)
Two houses with different colors and the farthest distance
Fresnel diffraction with rectangular aperture based on MATLAB
How does schedulerx help users solve distributed task scheduling problems?
作为一名合格的网工,你必须掌握的 DHCP Snooping 知识!
Agile invincible event
力扣每日一题-第30天-594.最长和谐子序列
Subtotal of C language -- basic data types and their representations
Illustrate plug-in -- AI plug-in development -- creative plug-in -- astute graphics -- multi axis mirroring function
Fault: NetBt log for id4321
What are the uses of wireless pressure collectors?
Hyperledger Fabric 2. X custom smart contract
Sourcetree remote red exclamation point
解析学习幼儿机器人教育的浪潮
How to do the performance pressure test of "Health Code"
flutter配置国内镜像,连接真机
Hyperledger Fabric 2. X custom smart contract
JDBC | Chapter 5: closing and releasing JDBC connection resources
Introduction to Ceres Quartet
Object detection - VIDEO reasoning using yolov6