Forum Discussion
Altera_Forum
Honored Contributor
13 years agoHow to implement this condition in verilog??
If input>500------> output= 500 If input<-500-----> output=-500 else --------------> output=input This is my code for this: module check( clk,input,output);
input clk;
input [15:0] input;
output [15:0] output;
reg [15:0] output;
always@(posedge clk) //negedge
if (input >= 16'h01f4)
output <= 16'h01f4;
else if (input <=16'hfe0c)
output <= 16'hfe0c;
else
output <= input;
endmodule I don't known why i get wrong result!!! Need for helping!!