Jump to content

Problem about return value of function in SV


Recommended Posts

Hi all,

If i want to implement such a reverse function, does anybody have other ways?

function bit[WIDTH-1:0] reverse(int WIDTH, bit[WIDTH-1:0] data);

bit[WIDTH-1:0] data_rvs;

for(int i=0; i<WIDTH; i++;)

data_rvs = data[WIDTH-1-i];

return data_rvs;

endfunction : reverse

The code above has vcs compile error because of the return value which cann't have variable expression.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...