Add setup.py entry point to install v2x binary

Signed-off-by: Daniel Lim Wee Soong <weesoong.lim@gmail.com>
diff --git a/README.md b/README.md
index d177279..eceb48e 100644
--- a/README.md
+++ b/README.md
@@ -22,10 +22,10 @@
 ```
 
 ## Usage
-After installing v2x, you can run `python -m v2x` to use it.
+After installing v2x, you can run `v2x` to use it.
 
 ```
-python -m v2x -h
+v2x -h
 usage: __main__.py [-h] [--top TOP] [--outfile OUTFILE] [--includes INCLUDES]
                    [--mode {pb_type,model}]
                    input.v [input.v ...]
@@ -53,19 +53,19 @@
 For example, to generate a pb_type xml file from adder.v, run 
 
 ```
-python -m v2x -o adder.pb_type.xml adder.v
+v2x -o adder.pb_type.xml adder.v
 ```
 
 Or, to generate a model xml file, run 
 
 ```
-python -m v2x --mode model -o adder.model.xml adder.v
+v2x --mode model -o adder.model.xml adder.v
 ```
 
 v2x expects the module name to be the same as the file name. If it is different, make sure to specifiy it with the `--top` argument.
 
 ```
-python -m v2x --top BLOCK -o adder.pb_type.xml adder.v
+v2x --top BLOCK -o adder.pb_type.xml adder.v
 ```
 
 ## Tests
diff --git a/setup.py b/setup.py
index fe0b925..4206b58 100644
--- a/setup.py
+++ b/setup.py
@@ -6,6 +6,9 @@
 setuptools.setup(
     name="v2x",
     version="0.0.1",
+    entry_points={
+        "console_scripts": ["v2x=v2x.__main__:v2x"]
+    },
     author="SymbiFlow Authors",
     author_email="symbiflow@lists.librecores.org",
     description="Python library for generating VPR architecture \
diff --git a/v2x/__main__.py b/v2x/__main__.py
index 0a33dce..2c3691c 100644
--- a/v2x/__main__.py
+++ b/v2x/__main__.py
@@ -34,7 +34,7 @@
                 args.infiles, args.includes, args.top, args.outfile))
 
 
-if __name__ == '__main__':
+def v2x():
     parser = argparse.ArgumentParser(
         description="Verilog to XML"
     )
@@ -84,3 +84,7 @@
     )
     args = parser.parse_args()
     sys.exit(main(args))
+
+
+if __name__ == '__main__':
+    v2x()
\ No newline at end of file