- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello!
I would like to convert a 1 hot 16 bit word to a binary value. I've done it below, but I've had to spell out each and every value. Is there a more efficient way of doing this?
if (int_ep)
begin
if (int_ep) isp_pointer <= 4'h0;
else if (int_ep) isp_pointer <= 4'h1;
else if (int_ep) isp_pointer <= 4'h2;
else if (int_ep) isp_pointer <= 4'h3;
else if (int_ep) isp_pointer <= 4'h4;
else if (int_ep) isp_pointer <= 4'h5;
else if (int_ep) isp_pointer <= 4'h6;
else if (int_ep) isp_pointer <= 4'h7;
else if (int_ep) isp_pointer <= 4'h8;
else if (int_ep) isp_pointer <= 4'h9;
else if (int_ep) isp_pointer <= 4'hA;
else if (int_ep) isp_pointer <= 4'hB;
else if (int_ep) isp_pointer <= 4'hC;
else if (int_ep) isp_pointer <= 4'hD;
else if (int_ep) isp_pointer <= 4'hE;
else (int_ep) isp_pointer <= 4'hF;
end
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is priority encoder, I see other example also code in this way:
http://quartushelp.altera.com/13.0/master.htm#mergedprojects/hdl/ahdl/ahdl_pro_if_then_state_logic.htm?gsa_pos=1&wt.oss_r=1&wt.oss=priority encoder
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page