How to call function on case statement (Verilog)?

OP #4094950
Rate this post
• ▲ useful
▼ not useful
module Counter(
input up,
input down,
input open,
input openHold,
input close,
input clk_in25mhz,
input clk_in1hz,
output reg DoorOpen,
output reg UpStatus,
output reg DownStatus,
output reg propeOut
);
reg rst3s;
reg rst2s;
reg PropeResult3s,PropeResult2s;

always @ (up or down or open or openHold or close or clk_in25mhz
or clk_in1hz
or rst3s
or rst2s
or PropeResult3s or PropeResult2s)
begin
case ({down,up,open})
3 b000 : begin
propeOut <= clk_in25mhz; DoorOpen <= 1 b0; UpStatus <= 1 b0; DownStatus 
<= 1 b0;
rst2s <= 1 b1; rst3s <= 1 b1;
end
3 b001 : begin
rst3s <= 1 b1;
if (openHold) begin
DoorOpen = 1 b1;
propeOut <= 1 b0;
UpStatus <= 1 b0;
DownStatus <= 1 b0;
end
else if (close) begin
DoorOpen <= 1 b0;
propeOut <= 1 b1;
UpStatus <= 1 b0;
DownStatus <= 1 b0;
end
else
begin
rst2s <= 1 b1;
DoorOpen <= 1 b1; UpStatus <= 1 b0; DownStatus <= 1 b0; propeOut <= 
PropeResult2s;
end
end

3 b010 : begin
rst3s <= 1 b1;
DoorOpen <= 1 b0; UpStatus <= 1 b1; DownStatus <= 1 b0; propeOut <= 
PropeResult3s;
end
3 b100 : begin
rst3s <= 1 b0;
DoorOpen <= 1 b0; UpStatus <= 1 b0; DownStatus <= 1 b1; propeOut <= 
PropeResult3s;
end
endcase
end

counter3sec CupDown(clk_in1hz,rst3s,PropeResult3s);
counter2sec Copen(clk_in1hz,rst2s,PropeResult2s);

the result of PropeResult3s and PropeResult2s is always x as capture 
image
Attached files:

Reply

Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.