Advertisement
Guest User

Untitled

a guest
May 24th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. module senzor (output reg out_senzor,
  2. input clock,start);
  3.  
  4. always @(posedge clock)
  5. begin
  6. if(start==0)
  7. out_senzor<=1;
  8. else
  9. out_senzor<=0;
  10. end
  11. endmodule
  12.  
  13.  
  14. module ram(output [3:0] dataOut1,dataOut2,
  15. input clock,we,
  16. input addr_W,
  17. input addr_R1,
  18. input addr_R2,
  19. input [3:0] dataIn);
  20.  
  21. reg [1:0] mem [0:3] ;
  22. always @(posedge clock)
  23. begin
  24. if(we==0)
  25. mem[addr_W]<=dataIn;
  26. end
  27. assign dataOut1=mem[addr_R1];
  28. assign dataOut2=mem[addr_R2];
  29. endmodule
  30.  
  31.  
  32. module mem_read(output reg out_adresa,)
  33. input clock,reset);
  34.  
  35. reg [31:0] count;
  36. always @(posedge clock)
  37. begin
  38. if(reset==0)
  39. begin
  40. cout<=0;
  41. out_adresa<=0;
  42. end
  43. else
  44. count<=count+1;
  45.  
  46. if(count==49999999)
  47. out_adresa<=1;
  48. else
  49. if(count==99999999)
  50. begin
  51. out_adresa<=0;
  52. count<=0;
  53. end
  54. end
  55. endmoule
  56.  
  57.  
  58. module control ( output [2:0] bias,
  59. output up_down,
  60. input [3:0] in_dO2);
  61.  
  62. assign up_down=in_dO2[3];
  63. assign bias=in_dO2[2:0];
  64. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement