Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me write Verilog code (posedge)

Status
Not open for further replies.

liu_uestc

Junior Member level 1
Joined
Aug 24, 2005
Messages
16
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,367
input signals a,b,c.d,is unrelative;output signal enosc is a register variable;
if a or b 's posedge come ,we set enosc one;if c's negedge come we set enosc
zero.else we keep enosc unchange;
who can give me the code of verilog?
here is my initial code,but it can't meet my requirement

always@(posedge a or posedge b or negedge c or negedge d)
begin
if(a==1) enosc<=1;
elseif (b==1) enosc<=1;
elseif(c==0) enosc<=1;
elseif(d==0)enosc<=0;
else enosc<=enosc;
end//because event negedge d can't change enosc sometimes;but it must change
enosc to 0,everytime ;how to change?????
 

Re: help me!

First off,
Code:
always@(posedge a or posedge b or negedge c or negedge d)
That right there is a bad idea.
Post your complete .v file and a better description of what you want in the ASIC deisgn (digital) section.
 

help me!

hi
in such case I put bits (for every switchs state)in
a byte and then i use switch-case command.

switch(keys){
case 0:break;
case 1:.....

}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top