Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. // パーセプトロン
  2.  
  3. module perceptron#(
  4. parameter NUM_INPUT = 2,
  5. parameter BIT_WIDTH = 8
  6. )(
  7. input wire [NUM_INPUT-1:0][BIT_WIDTH-1:0] x, w,
  8. output wire [BIT_WIDTH-1:0] out);
  9.  
  10. assign out = fire(x,w);
  11.  
  12. function [BIT_WIDTH-1:0] fire;
  13. input wire [NUM_INPUT-1:0][BIT_WIDTH-1:0] x, w;
  14.  
  15. fire = 0;
  16. for (integer i=0;i<NUM_INPUT;++i) begin
  17. fire = fire + x[i] * w[i];
  18. end
  19. endfunction
  20. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement