posedge and negedge in verilog always block

Status
Not open for further replies.

sunidrak

Full Member level 1
Joined
Apr 12, 2012
Messages
97
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
Bengaluru, India
Activity points
1,738
hi

can anybody explain


always @(posedge clk or negedge rst)
if(rst)
q<=0;
else
q<=d;
.
.
.
if reset is active high and and i want apply it as posedge . . is it possible to do



regards
Sunil
 

The correct syntax is
Code:
always @(posedge clk or posedge rst)
if(rst)
q<=0;
else
q<=d

for active low reset

Code:
always @(posedge clk or negedge rst)
if(!rst)
q<=0;
else
q<=d;

Please consider that the required Verilog syntax for asynchronous register control hasn't to do with edges, it's actually describing level triggering.
 
Reactions: tpetar

    tpetar

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…