- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to figure out how to select a w-bit(w is some parameter, shorter than the bus) part of a bus based on an incoming variable x with the smallest resource footprint possible, in one clock tick. I have tried two methods so far. The first uses a shifter: ... parameter bw=96 parameter w=8 ... input wire [$clog2(bw):0] x, input wire [bw-1:0] inputWire, output reg [w-1:0] out ... always@(posedge clk) out=inputWire>>x; At the second I use a for loop and multiplexers: integer i; always@(posedge clk)begin for (i =0; i<bw-w;i=i+1) begin:myforloop if(x==i) out=inputWire[i+:w]; end end I was quite surprised that the second method used much less resources(about half) than the first. Is there any reason for this? The only one I can come up with is that the second one covers a smaller range, but it still does not explain why the difference is this large. Also a single instance of the shifter used around 110 ALMs which is much more than I anticipated. Simpler adders take up like 4; even if the input is large like 96 it shouldn't take up so much space, should it? Is there any better/more compact method to dynamically select part of a bus?Link Copied
0 Replies
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