jameela
Junior Member level 2
is the following code correct as explained in comments???...its giving zero in both cases....what cud be the alternative?
input [3:0]r;
reg [3:0] e_xk;
reg e_xk1; //output declared as reg
e_xk={r/8}; // bits divided by 8
begin
if (e_xk<=4'd 2) // if e_xk is equal to or less than 0.5 , e_xk1 should be 0
e_xk1=0;
else
if (e_xk>4'd 2) //if e_xk is greater than 0.5 e_xk1 should be 1
e_xk1=1;
input [3:0]r;
reg [3:0] e_xk;
reg e_xk1; //output declared as reg
e_xk={r/8}; // bits divided by 8
begin
if (e_xk<=4'd 2) // if e_xk is equal to or less than 0.5 , e_xk1 should be 0
e_xk1=0;
else
if (e_xk>4'd 2) //if e_xk is greater than 0.5 e_xk1 should be 1
e_xk1=1;