correct author, description, and license
[pythondata-cpu-libresoc.git] / README.md
1 # pythondata-cpu-libresoc
2
3 Non-Python files needed for the cpu Libre-SOC, packaged
4 into a Python module so they can be used with Python libraries and tools.
5
6 This Useful for usage with tools like
7 [LiteX](https://github.com/enjoy-digital/litex.git).
8
9 The data files can be found under the Python module `pythondata_cpu_libresoc`. The
10 `pythondata_cpu_libresoc.data_location` value can be used to find the files on the file
11 system.
12
13 Example of getting the data file directly;
14 ```python
15 import pythondata_cpu_libresoc
16
17 my_data_file = "abc.txt"
18
19 with open(os.path.join(pythondata_cpu_libresoc.data_location, my_data_file)) as f:
20 print(f.read())
21 ```
22
23 Example of getting the data file using `litex.data.find` API;
24 ```python
25 from pythondata_cpu_libresoc import data_file
26
27 my_data_file = "abc.txt"
28
29 with open(data_file(my_data_file)) as f:
30 print(f.read())
31 ```
32
33 The verilog files are built from https://git.libre-soc.org/soc.git
34 due to the original source being over 130,000 lines of nmigen.
35 Instructions on how to re-build the verilog can be found in the
36 [Software prerequisites](https://libre-soc.org/HDL_workflow/#software-prerequisites)
37 section of Libre-SOC [HDL_workflow](https://libre-soc.org/HDL_workflow/)
38
39
40 ## Installing from git repository
41
42 ## Manually
43
44 You can install the package manually, however this is **not** recommended.
45
46 ```
47 git clone https://github.com/litex-hub/pythondata-cpu-libresoc.git
48 cd pythondata-cpu-libresoc
49 sudo python setup.py install
50 ```
51
52 ## Using [pip](https://pip.pypa.io/) with git repository
53
54 You can use [pip](https://pip.pypa.io/) to install the data package directly
55 from github using;
56
57 ```
58 pip install --user git+https://github.com/litex-hub/pythondata-cpu-libresoc.git
59 ```
60
61 If you want to install for the whole system rather than just the current user,
62 you need to remove the `--user` argument and run as sudo like so;
63
64 ```
65 sudo pip install git+https://github.com/litex-hub/pythondata-cpu-libresoc.git
66 ```
67
68 You can install a specific revision of the repository using;
69 ```
70 pip install --user git+https://github.com/litex-hub/pythondata-cpu-libresoc.git@<tag>
71 pip install --user git+https://github.com/litex-hub/pythondata-cpu-libresoc.git@<branch>
72 pip install --user git+https://github.com/litex-hub/pythondata-cpu-libresoc.git@<hash>
73 ```
74
75 ### With `requirements.txt` file
76
77 Add to your Python `requirements.txt` file using;
78 ```
79 -e git+https://github.com/litex-hub/pythondata-cpu-libresoc.git
80 ```
81
82 To use a specific revision of the repository, use the following;
83 ```
84 -e https://github.com/litex-hub/pythondata-cpu-libresoc.git@<hash>
85 ```
86
87 ## Installing from [PyPi](https://pypi.org/project/pythondata-cpu-libresoc/)
88
89 ## Using [pip](https://pip.pypa.io/)
90
91 ```
92 pip install --user pythondata-cpu-libresoc
93 ```