Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. module top(
  2. input logic i_clk,
  3. input logic i_rst_n,
  4. input logic [1:0] i_foo,
  5. output logic [1:0] o_bar,
  6. output logic [1:0] o_baz
  7. );
  8. if (1) begin : g_bar
  9. function automatic logic [1:0] f(logic [1:0] v);
  10. return ~v;
  11. endfunction
  12. end
  13.  
  14. if (1) begin : g_baz
  15. function automatic logic [1:0] f(logic [1:0] v);
  16. return {v[0], v[1]};
  17. endfunction
  18. end
  19.  
  20. always_ff @(posedge i_clk, negedge i_rst_n) begin
  21. if (!i_rst_n) begin
  22. o_bar <= 0;
  23. o_baz <= 0;
  24. end
  25. else begin
  26. o_bar <= g_bar.f(i_foo);
  27. o_baz <= g_baz.f(i_foo);
  28. end
  29. end
  30. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement