The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Jul 16th, 2024, 6:23pm
Pages: 1
Send Topic Print
counter-64 (Read 1081 times)
kamath
Junior Member
**
Offline



Posts: 16

counter-64
Jul 25th, 2007, 3:01am
 
module counter(in,out,clock);
input in,clock;
output [5:0]out;
reg [5:0]out;
initial out=0;

always begin
@(posedge clock)
if( (out<63) && in);
out= out+1;
if(~(out==0) && ~in);
out=out-1;
end
endmodule

i want to design 64 bit up-down counter,but this prog did not give any result,plz help me.
i am a newbie so forgive if any silly mistakes.






Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: counter-64
Reply #1 - Jul 26th, 2007, 4:59am
 
Hi kamath,
you need to put the if statements in a begin-end block.
In your code, the @-event only affects the first if statement.

BOE
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.