I am new to Verilog, but have some coding experience in VHDL. While reading someone else's code, I came across the following part:

genvar i;
  for (i = 0; i < 8; i = i + 1) begin : gen_for
    integer p = (66.0*i)/8.0;
    assign data[p + 1] = ...

My doubt here is what will be the value of p rounded to? Will it be rounded to the nearest integer or to the largest integer < (66.0*i)/8.0 (floor operation)?


1 Answer 1


Whenever there's a decimal in an integer variable, it typically floors the value. So if the answer is like 8.25 for i=1, the answer would actually just be 8. Then at i=2, the answer will be 16.5 but with the integer variable will make it 16. And so forth.

You could also execute the code and see what it does :)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.