1、计数,用于对精度不高的计数

  1. always @(posedge clk or negedge rst_n)
  2. begin
  3. if(!rst_n)
  4. div_cnt <= 'd0;
  5. else
  6. div_cnt <= div_cnt + 'b1;
  7. end
  8.  
  9. assign div_clk = div_cnt[]; //div_cnt < 100

2、检测边沿

  1. //--------------------------------
  2. //Funtion : detect start pos
  3.  
  4. always @(posedge clk or negedge rst_n)
  5. begin
  6. if(!rst_n)
  7. pos_arr <= 'd0;
  8. else
  9. pos_arr <= {pos_arr[:] ,estart };
  10. end
  11.  
  12. assign start = pos_arr[] & ~pos_arr[]

3、声明的不同最好在注释上面体现出来,而不是在变量名

  1. //localparam BAUD_END = 5207 ; //9600bps
  2. localparam BAUD_END = ; //115200bps

4、组合数据,少使用了寄存器资源

  1. always @(posedge clk_24m or negedge rst_n)
  2. begin
  3. if(!rst_n)
  4. ov7670_data_out <= 'd0;
  5. else if(cnt_byte == 'b1)
  6. ov7670_data_out <= {ov7670_data_out[:] , ov7670_data};
  7. else
  8. ov7670_data_out <= {ov7670_data , 'd0};
  9. end

。。。。待续

Verilog code的更多相关文章

  1. CIC 抽取滤波器 Verilog Code

    采用流水线结构的CIC 抽取滤波器结构如下: // 三级CIC抽取器实例:cic3_decimator.V module cic3_decimator(clk, x_in, y_out); param ...

  2. Verilog Tips and Interview Questions

    Verilog Interiew Quetions Collection :  What is the difference between $display and $monitor and $wr ...

  3. verilog流水线加法器

    四位加法器 两级加法实现 verilog code module pipeliningadder( output reg [3:0] s, output reg co, input [3:0] a, ...

  4. verilog 实现加法器

    半加器 如果不考虑来自低位的进位将两个1二进制数相加,称为半加. 实现半加运算的逻辑电路称为半加器. 真值表 逻辑表达式和 \begin{align}\notag s = a{b}' + {a}'b ...

  5. verilog FAQ(zz)

    1. What is the race condition in verilog? Ans :The situation when two expressions are allowed to exe ...

  6. 基于脚本的modelsim自动化仿真笔记

    这里记录一下基于脚本的modelsim自动化仿真的一些知识和模板,以后忘记了可以到这里查找.转载请标明出处:http://www.cnblogs.com/IClearner/ . 一.基本介绍 这里介 ...

  7. $clog2(转)

    (转http://www.xilinx.com/support/answers/44586.html) 13.2 Verilog $clog2 function implemented imprope ...

  8. dda的fpga实现(转载)

    The general approach using DDAs will be to simulate a system of first-order differential equations, ...

  9. 推荐 的FPGA设计经验(4) 时钟和寄存器控制架构特性使用

    Use Clock and Register-Control Architectural Features FPGAs provide device-wide clocks and register ...

随机推荐

  1. Android开发过程中使用弱引用解决内存泄露的习惯

    Java虽然有垃圾回收,但是仍然存在内存泄露,比如静态变量.缓存或其他长生命周期的对象引用了其他对象,这些被引用的对象就会长期不能被GC释放,导致内存泄露. 弱引用(WeakReference)是解决 ...

  2. 可靠的、可扩展的、可维护的数据系统 ------《Designing Data-Intensive Applications》读书笔记1

    坦白说也是机缘巧合,在硕士生阶段进入分布式系统领域学习.无论是大规模存储或计算,其核心也是运用分布式技术利用并行性来解决数据密集型应用的需求.最近开始在啃这本<Designing Data-In ...

  3. HITCON-Training-master 部分 Writeup(12月11更新)

    HITCON-Training-master Writeup 0x01.lab3 首先checksec一下,发现连NX保护都没开,结合题目提示ret2sc,确定可以使用shellcode得到权限. I ...

  4. Akka(42): Http:身份验证 - authentication, autorization and use of raw headers

    当我们把Akka-http作为数据库数据交换工具时,数据是以Source[ROW,_]形式存放在Entity里的.很多时候除数据之外我们可能需要进行一些附加的信息传递如对数据的具体处理方式等.我们可以 ...

  5. PHP运算符优先级 运算符分类

    运算符 运算符是可以通过给出的一或多个值(用编程行话来说,表达式)来产生另一个值(因而整个结构成为一个表达式)的东西. 运算符可按照其能接受几个值来分组.一元运算符只能接受一个值,例如 !(逻辑取反运 ...

  6. WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

    在 mkfs.ext4 /dev/sda2 格式化硬盘空间时,可能出现这种错误. had this situation at office where I was told to re-partiti ...

  7. EularProject 43: 带条件约束的排列组合挑选问题

    Sub-string divisibility Problem 43 The number, 1406357289, is a 0 to 9 pandigital number because it ...

  8. canvas图形函数

    function drawStar(cobj,x, y, radius1, radius2, num, drawType, color) {//参数:画笔,圆心X.圆心Y,半径1,半径2,形状边,实心 ...

  9. Druid数据库连接池源码分析

    上一篇文章重点介绍了一下Java的Future模式,最后意淫了一个数据库连接池的场景.本想通过Future模式来防止,当多个线程同时获取数据库连接时各自都生成一个,造成资源浪费.但是忽略了一个根本的功 ...

  10. Spring MVC如何测试Controller(使用springmvc mock测试)

    在springmvc中一般的测试用例都是测试service层,今天我来演示下如何使用springmvc mock直接测试controller层代码. 1.什么是mock测试? mock测试就是在测试过 ...