Lösung des Praktikums Systementwurf
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.

DelayBuffer.v 919B

1 year ago
1234567891011121314151617181920212223242526272829303132
  1. //----------------------------------------------------------------------
  2. // DelayBuffer: Generate Constant Delay
  3. //----------------------------------------------------------------------
  4. module DelayBuffer #(
  5. parameter DEPTH = 32,
  6. parameter WIDTH = 16
  7. )(
  8. input clock, // Master Clock
  9. input [WIDTH-1:0] di_re, // Data Input (Real)
  10. input [WIDTH-1:0] di_im, // Data Input (Imag)
  11. output [WIDTH-1:0] do_re, // Data Output (Real)
  12. output [WIDTH-1:0] do_im // Data Output (Imag)
  13. );
  14. reg [WIDTH-1:0] buf_re[0:DEPTH-1];
  15. reg [WIDTH-1:0] buf_im[0:DEPTH-1];
  16. integer n;
  17. // Shift Buffer
  18. always @(posedge clock) begin
  19. for (n = DEPTH-1; n > 0; n = n - 1) begin
  20. buf_re[n] <= buf_re[n-1];
  21. buf_im[n] <= buf_im[n-1];
  22. end
  23. buf_re[0] <= di_re;
  24. buf_im[0] <= di_im;
  25. end
  26. assign do_re = buf_re[DEPTH-1];
  27. assign do_im = buf_im[DEPTH-1];
  28. endmodule