
verilog
文章平均质量分 64
Lambor_Ma
[芯片设计]
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
verilog中简单的one-hot 状态机转换
简单的one-hot 状态机转换one-hot 编码verilog中写法one-hot 编码0001 0010 0100 1000如上例每次只有1个bit位置high其余low的状态叫one-hot,相反只有1个bit low 其余bit high 叫 one-cold。verilog中写法一般状态机转换中我们会先paremeter A = 0001, B = 0010, C = 0100, D = 1000;像这样预设值,这里介绍一种新的方法,如上图的变化,如果state想变到 A状态原创 2021-01-04 07:41:15 · 4063 阅读 · 0 评论 -
verilog中边沿检测器,双边沿检测器和双边沿触发寄存器的理解和写法
verilog中边沿检测器,双边沿检测器和双边沿触发寄存器的理解和写法单边沿检测电路图双边沿检测电路图下降沿检测保持器件电路图双边沿触发寄存器(DDR)单边沿检测电路图根据电路图很好理解, 为了让原来的信号保持一下也可以说是延迟一个时钟,就能做出上升沿的判断,后面加入一个寄存器的目的就是为了让检测延迟一个时钟显示,也保证检测只持续一个时钟。module top_module ( input clk, input [7:0] in, output [7:0] pedge);原创 2021-01-03 09:50:40 · 3859 阅读 · 0 评论 -
verilog中全加器行为级别(+ verilog中会自动添加进位)
module top_module ( input [3:0] x, input [3:0] y, output [4:0] sum); // This circuit is a 4-bit ripple-carry adder with carry-out. assign sum = x+y; // Verilog addition automatically produces the carry-out bit. // Verilog quirk: Even though the va原创 2020-12-26 04:43:33 · 652 阅读 · 1 评论 -
verilog中 在选择vector部分的时候无法使用variable变量的问题
经常碰到的问题就是使用一个vector的时候input [11:0] a;想每隔4个取一组 即a[3:0] a[7:4] a[11:8]for(genvar i =0; i<3 : i = i+1)a[(i*4+3):i*4]这种形式会报错 i is not constant file. 这种错误,表示verilog不知道这个a选取的时候是不是一个固定值。解决方法有两种一用连接符a={in[i*4+3],in[i*4+2],in[i*4+1],in[i*4+0]}每个相应位置选取原创 2020-12-25 00:06:52 · 1038 阅读 · 0 评论 -
verilog中 case写法避免写default的巧妙写法
always @(*) begin out = '1; // '1 is a special literal syntax for a number with all bits set to 1. // '0, 'x, and 'z are also valid. // I prefer to assign a default value to 'out' instead of using a // default case. case (sel) 4'h0: out原创 2020-12-24 23:19:59 · 3478 阅读 · 4 评论 -
casez优先编码
always @(*) begincasez (in[3:0])4’bzzz1: out = 0; // in[3:1] can be anything4’bzz1z: out = 1;4’bz1zz: out = 2;4’b1zzz: out = 3;default: out = 0;endcaseendz位置case不管是什么都可。原创 2020-12-24 23:18:15 · 269 阅读 · 0 评论 -
verilog中 blocking assignment 和non-blocking assignment的区别(阻塞赋值和非阻塞赋值的区别)
阻塞赋值与非阻塞赋值:1.阻塞赋值“=”(组合逻辑电路),非阻塞赋值“<=”(时序逻辑电路);2.Verilog模块编程的8个原则:(1) 时序电路建模时,用非阻塞赋值。(2) 锁存器电路建模时,用非阻塞赋值。(3) 用always块建立组合逻辑模型时,用阻塞赋值。(4) 在同一个always块中建立时序和组合逻辑电路时,用非阻塞赋值。(5) 在同一个always块中不要既用非阻塞赋值又用阻塞赋值。(6) 不要在一个以上的always块中为同一个变量赋值。(7) 用$s原创 2020-12-22 21:51:14 · 2404 阅读 · 0 评论 -
VHDL中 inout vs buffer out 的区别
inout - is used for ports that can both be an output and an input. They’re called tri state buffersif you define a port as inout, you also have to define it’s behaviour.Suppose "some_inout " is defined as an inout std_logic port in your entity.Code:som原创 2020-11-01 22:02:02 · 1368 阅读 · 0 评论 -
数字IC必修之Verilog知识点——Task和Function,System Task(系统函数), System Function, Verilog-2001
task和functiontask 和 function 的声明在module内部,且不需要先于调用之前。task:只能在procedural 内部调用,task的调用方式是statement本身,而不是表达式。function:可以在module的任何地方调用,是作为一种operands来使用。tasktask可以有0个或多个argument(即input output), 可以有延时,上升沿下降沿的使用。使用时的典型例子: read_reg(input [31:0] add, ..原创 2020-08-06 04:15:47 · 1712 阅读 · 0 评论 -
数字IC必修之Verilog知识点——时序逻辑(sequential logic),锁存器,异步&同步触发器flipflops,N位移位寄存器,计数器,FSM三段式状态机
Flip-Flopsasynchronous (异步中CDC)synchronous(同步时钟)时钟上升沿到来后,会产生的FSMs:有限状态机在同步时钟中一般用状态机来进行控制——structural view(FFs separate from combinational logic)——behavioral view(synthesis of sequencers)Latch with Reset第二个if没有else连接,所以当g=0时,Q锁存原来的值。异步复位F..原创 2020-08-05 22:56:53 · 1025 阅读 · 0 评论 -
数字IC必修之Verilog知识点——系统任务,综合器指令,parameter重要性,testbench规范(面试小白考试)
System Tasks$display("…",arg2,arg3,…); 打印数据$monitor("…",arg2,arg3,…); 数据变化时才打印$stop suspends sim when encountered$finish finishes sim when encountered$fopen(“filename”); 返回file descriptor(integer); then, use $fdisplay(fd,"…",arg2,arg3,…); or #fmoni.原创 2020-08-05 03:58:49 · 385 阅读 · 0 评论 -
数字IC必修之Verilog知识点——模块建立及常用语法总结过程块中的语法(面试小白考试)
Modulemodule my_module(out1,…,inN) ;output out1,…,outM;input in1,…,inN;…// declarations…// description of f (maybe sequential)endmoduleContinuous Assignmentsassign #de1 (net type) = expr;inside a moduleoutside procedures(always可综合 initial不..原创 2020-08-04 23:42:02 · 556 阅读 · 0 评论 -
数字IC必修之Verilog知识点入门——基础知识基本变量及操作符(面试小白考试)
命名开头不能使用数字和标识符分大小写行注释//块注释/*xxxxx*/value : 0,1,x(悬空态,unknown logic),z(高阻态)Verilog中数字表达形式 12‘0 3zx7 = 011zzzxxx111Bit extension: 0,x or z 可以extend 。 其他extend前面加0Net: 逻辑驱动的硬件导线,不连接时是‘z’态,有四种线分别是 wire, wand,wor,tri线与,线或逻辑一般不用因为会造成一条线被2种驱动wire Y = A&.原创 2020-08-04 18:42:56 · 1270 阅读 · 0 评论 -
华为芯片ic数字岗笔试题(回忆版)
40道单选5道多选1.综合可综合语句判断2.Pll 3分频 是不是异步3.判断:综合面积大则PR面积大?4.-3.25 补码形式5.上升沿下降沿检测电路6.异步fifo 空满信号产生判断7.测试点 覆盖率8.竞争冒险9.STA缺点10.影响静态功耗问题11.异步同步电路信号判断 什么是同步时钟12.常见主流测试平台13.STA相关问题 比如一般检测的时序分析路径是什么14.一大推关于测试的不好意思只记得个大概,自我感觉都是一些常规笔试题目。...原创 2020-07-15 20:47:00 · 6803 阅读 · 3 评论 -
verilog中一文搞懂有限状态机(FSM)Mealy和Moore状态机(及一段式,二段式,三段式)
testbenchverilog示例verilog示例module adder(clk,rst,q_out,k)input clk,rst,k;out q_out;localparam S1 = 0, S2=1, S3=2;reg[1:0] state, nextstate;always @(posedge clk or posedge rst) begin if原创 2020-05-27 12:30:42 · 12101 阅读 · 0 评论