Advertisement
Guest User

Untitled

a guest
Dec 13th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. module tb_max316b;
  2. reg signed [15:0] a, b, c;
  3. wire signed [15:0] y;
  4.  
  5. reg[8 * 100:1] aline;
  6. integer count, status, fd;
  7. integer i_a, i_b, i_c, i_result;
  8. integer errors;
  9.  
  10. max316b instance1(a, b, c, y);
  11.  
  12. initial begin
  13. a = 0;
  14. b = 0;
  15. c = 0;
  16.  
  17. fd = $fopen("/home/osboxes/max316b_vectors.txt", "r");
  18. if (fd == 0)
  19. fd = $fopen("/home/osboxes/max316b_vectors.txt", "r");
  20. count = 1;
  21.  
  22. #100;
  23. errors = 0;
  24. while ($fgets(aline, fd)) begin
  25. status = $sscanf(aline, "%d %d %d %d", i_a, i_b, i_c, i_result);
  26. a = i_a;
  27. b = i_b;
  28. c = i_c;
  29. #50;
  30.  
  31. if (i_result == y)
  32. $display("%d(%t):YUPI, a:%d, b:%d, c:%d, y:%d\n", count, $time, a, b, c, y);
  33. else begin
  34. errors = errors + 1;
  35. $display("%d(%t):ERROR, a:%d, b:%d, c:%d, y(calculat):%d, y(asteptat):%d\n", count, $time, a, b, c, y, i_result);
  36. end
  37. count = count + 1;
  38. end
  39. end
  40.  
  41. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement