Skip to content

Commit

Permalink
organization and practices
Browse files Browse the repository at this point in the history
  • Loading branch information
sifferman committed Sep 19, 2021
1 parent c3d978c commit c24540c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"verilog.linting.iverilog.runAtFileLocation": true,
"verilog.linting.iverilog.runAtFileLocation": false,
"verilog.linting.iverilog.arguments": "-Wall -g2012 -DLINTER=1",
"verilog.linting.linter": "iverilog"
}
27 changes: 15 additions & 12 deletions rtl/ffs.v
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ module ffs_m #(
if ( USE_X ) assign right_out = right_valid ? 1'b0 : 1'bx;
else assign right_out = 1'b0;
end
// right recursive call
if ( RIGHT_INPUT_WIDTH > 1 ) begin : right_recursion
wire [RIGHT_INPUT_WIDTH-1:0] right_in = in[ 0 +: RIGHT_INPUT_WIDTH ];
ffs_m #(RIGHT_INPUT_WIDTH,SIDE,USE_X) ffs (
Expand All @@ -80,18 +81,20 @@ module ffs_m #(
end

// combine left and right back together
case ({ ((2'b01&USE_X)<<1) | (2'b01&SIDE) })
2'b00: assign out = left_valid ? ( left_out + RIGHT_INPUT_WIDTH ) :
( right_out );
2'b01: assign out = right_valid ? ( right_out ) :
( left_out + RIGHT_INPUT_WIDTH );
2'b10: assign out = left_valid ? ( left_out + RIGHT_INPUT_WIDTH ) :
right_valid ? ( right_out ) :
{OUTPUT_WIDTH{1'bx}};
2'b11: assign out = right_valid ? ( right_out ) :
left_valid ? ( left_out + RIGHT_INPUT_WIDTH ) :
{OUTPUT_WIDTH{1'bx}};
endcase
if ( !USE_X && !SIDE ) assign out =
left_valid ? ( left_out + RIGHT_INPUT_WIDTH ) :
( right_out );
else if ( !USE_X && SIDE ) assign out =
right_valid ? ( right_out ) :
( left_out + RIGHT_INPUT_WIDTH );
else if ( USE_X && !SIDE ) assign out =
left_valid ? ( left_out + RIGHT_INPUT_WIDTH ) :
right_valid ? ( right_out ) :
{OUTPUT_WIDTH{1'bx}};
else if ( USE_X && SIDE ) assign out =
right_valid ? ( right_out ) :
left_valid ? ( left_out + RIGHT_INPUT_WIDTH ) :
{OUTPUT_WIDTH{1'bx}};

endgenerate

Expand Down
2 changes: 1 addition & 1 deletion sim/tb.v
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


`ifdef LINTER
`include "../rtl/ffs.v"
`include "rtl/ffs.v"
`endif


Expand Down

0 comments on commit c24540c

Please sign in to comment.