第五讲verilog设计进阶_时序详解.ppt
文本预览下载声明
Verilog HDL设计进阶电子信息工程 武 斌;触发器设计;触发器的描述;Verilog 基本语法--两种不同的赋值语句;深入理解阻塞非阻塞赋值;非阻塞赋值;阻塞赋值语句;时序逻辑的基本组成;时序逻辑构成;1 按位描述
左移
reg [7:0] shift;
always@(posedge clk)
begin
shift[7:1]=shift[6:0];
shift[0]=din;
end
;移位运算符
n:和 n: 无符号数左右移n位,空位补0
n和 n :有符号数左移右移,
左移补0,右移补符号位;移位寄存器案例;时序逻辑设计----计数器;Moore型模计数器设计…..(案例);reg out;
always @(posedge clk)
if(!rst) count=0;
else count=count+1;
always @(posedge clk)
if(!rst) out=0;
else if(count== 2n-1)
out=1;
else out=0;;计数器组合逻辑与寄存器输出区别;同步复位法
always @(posedge clk)
if (!rst)
begin
count=0;out=0;
end
else if (count==m-1)
begin
count=0;
out=1;
end
else begin
count= count+1;
out=0;
end ;同步复位与异步复位(5进为例);reg[3:0] count;
always @( posedge clk or negedge rst)
if(!rst) begin
count=0;
out=0;
end
else if(count==m) // 书上P169图
begin
count=0; out=1;
end
else begin
count=count+1; out=0;
end
assign rst=(count==m)?0:1; // 毛刺改进???;Mealy型计数器;例:模可控计数器---7进计数器;Moore型设计实例;分频器设计(案例);计数器分频:
always@(.............)
count=count+1;
assign f_2_1=count[0];
assign f_4_1=count[1];
assign f_8_1=count[2];
………;分频器设计(案例);有限状态机—state machine;状态机设计要点;状态机设计要点(Moore型);状态机设计要点;状态机设计要点(Mealy型);设计示例-- 三个1序列监测器 ; 设计示例; 设计示例(续);always @(posedge Clock)
if (!reset)
state = Idle;
else
case (state)
Idle: if (A) state = Start;
else state=0;
Start: if (A) state = Stop;
else state=0;
Stop: if (A) state = Idle;
else state=0;
d
显示全部