Advertisement
GabryelM22

Untitled

Jul 13th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Aula 13/07/17
  2.  
  3. module teste(SW, LEDR)
  4.  
  5. input [2:0] SW;
  6. output [1:0] LEDR;
  7.  
  8.  
  9. module somador4bits(output [4:0]LEDR, input [8:0]SW);
  10. wire w1,w2,w3;
  11.  
  12. somador a1(SW[0], SW[2], SW[4], w1, LEDR[0]);
  13. somador a2(SW[1], SW[3], w1, w2, LEDR[1]);
  14.  
  15. reg dado;
  16.  
  17. assign dado = SW[0];
  18. assign reset = SW[1];
  19. assign clock = SW[2];
  20.  
  21. always @(negedge reset & posedge clock)
  22. begin
  23.     if (clock)
  24.         dado = ~dado;
  25. end
  26.  
  27. assign LEDR[0] = dado;
  28. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement