Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. module LogicalOperationsByBuildInPrimitives(sw,led);
  2. input [6:0] sw; // "[6:0]" means bus. From sw[0] to sw[6] is defined for input.
  3. output [3:0] led; // From led[0] to led[3] is defined.
  4. wire w_and,w_or,w_not,w_xor; // To define the wire for inner crossline.
  5.  
  6. and(w_and, sw[0], sw[1]); // "&" -> and().
  7. or(w_or, sw[2], sw[3]); // "|" -> or().
  8. not(w_not, sw[4]); // "~" -> not().
  9. xor(w_xor, sw[5], sw[6]); // "^" -> xor().
  10.  
  11. // {} is Linking Operator. (RENKETSU in Japanese)
  12. assign led={w_xor,w_not,w_or,w_and}; // assign led[3]=w_xor; assign led[2]=w_not; assign led[1]=w_or; assign led[0]=w_and;
  13. endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement