Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. module top1(output [31:0] result,
  2. output reg negative,
  3. output zero,
  4. output overflow,
  5. output carry,
  6. input [31:0] A,
  7. input [31:0] B,
  8. input control0,
  9. input control1
  10. );
  11.  
  12.  
  13. wire w1,w2,w3,w4;
  14.  
  15. Pand nume_aici1(.out(w1),
  16. .in1(A),
  17. .in2(B)
  18. );
  19.  
  20. Por nume_aici2(.out(w2),
  21. .in1(A),
  22. .in2(B)
  23. );
  24.  
  25. addsub32b nume_aici3( .overflow(overflow),
  26. .carry(carry),
  27. .addsubresult(w3),
  28. .sel(control0),
  29. .a(A),
  30. .b(B)
  31. );
  32.  
  33. selector nume_aici4( .selout(w4),
  34. .control(control0),
  35. .input0(w1),
  36. .input1(w2)
  37. );
  38.  
  39. selector nume_aici5( .selout(result),
  40. .control(control1),
  41. .input0(w4),
  42. .input1(w3)
  43. );
  44. always @(*)
  45. begin
  46. if(result[31]==1)
  47. negative = 1;
  48. else
  49. negative = 0;
  50. end
  51.  
  52. assign zero = ~result;
  53.  
  54.  
  55. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement