Formula ---------------------------------- /* This is just the idea how to build the module, likely it contains some errors and some details that have not been worked through */ /* basic idea partition the switches in each level to odd and even ''fleets'' where: all fleets are of size 2**i even fleets X-like inputs comes from odd fleets of the previous level. odd fleets X-like inputs comes from even fleets of the previous level. */ module butterfly(IL,IR,OL,OR) { n=2**k input IL[n-1:0]; input IR[n-1:0]; output OL[n-1:0]; output OR[n-1:0]; wire WL[k:-1][n-1:0] wire WR[k:-1][n-1:0] assign WL[-1]=IL; assign WR[-1]=IR; assign OL=WL[k]; assign OR=WR[k]; /* levels */ genfor(i=0;i