Studentenversion des ESY6/A Praktikums "signal_processing".
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Butterfly.v 1.1KB

1234567891011121314151617181920212223242526272829303132
  1. //----------------------------------------------------------------------
  2. // Butterfly: Add/Sub and Scaling
  3. //----------------------------------------------------------------------
  4. module Butterfly #(
  5. parameter WIDTH = 16,
  6. parameter RH = 0 // Round Half Up
  7. )(
  8. input signed [WIDTH-1:0] x0_re, // Input Data #0 (Real)
  9. input signed [WIDTH-1:0] x0_im, // Input Data #0 (Imag)
  10. input signed [WIDTH-1:0] x1_re, // Input Data #1 (Real)
  11. input signed [WIDTH-1:0] x1_im, // Input Data #1 (Imag)
  12. output signed [WIDTH-1:0] y0_re, // Output Data #0 (Real)
  13. output signed [WIDTH-1:0] y0_im, // Output Data #0 (Imag)
  14. output signed [WIDTH-1:0] y1_re, // Output Data #1 (Real)
  15. output signed [WIDTH-1:0] y1_im // Output Data #1 (Imag)
  16. );
  17. wire signed [WIDTH:0] add_re, add_im, sub_re, sub_im;
  18. // Add/Sub
  19. assign add_re = x0_re + x1_re;
  20. assign add_im = x0_im + x1_im;
  21. assign sub_re = x0_re - x1_re;
  22. assign sub_im = x0_im - x1_im;
  23. // Scaling
  24. assign y0_re = (add_re + RH) >>> 1;
  25. assign y0_im = (add_im + RH) >>> 1;
  26. assign y1_re = (sub_re + RH) >>> 1;
  27. assign y1_im = (sub_im + RH) >>> 1;
  28. endmodule