Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitread: not found #2123

Closed
zliu1Charlotte opened this issue Mar 16, 2023 · 15 comments
Closed

bitread: not found #2123

zliu1Charlotte opened this issue Mar 16, 2023 · 15 comments

Comments

@zliu1Charlotte
Copy link

zliu1Charlotte commented Mar 16, 2023

Hi I am trying to use the bit2fasm.py but it shows that bitread is not found

It was working before but it is not working now.

I ran it in the conda env
python3 third_party/prjxray/utils/bit2fasm.py --db-root third_party/prjxray-db/artix7 --part xc7a200tsbg484-1 add16.bit

/bin/sh: 1: bitread: not found
Traceback (most recent call last):
  File "third_party/prjxray/utils/bit2fasm.py", line 127, in <module>
    main()
  File "third_party/prjxray/utils/bit2fasm.py", line 113, in main
    bit_to_bits(
  File "third_party/prjxray/utils/bit2fasm.py", line 34, in bit_to_bits
    subprocess.check_output(
  File "/home/pc-5/Desktop/fpga_test/f4pga-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/subprocess.py", line 415, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/home/pc-5/Desktop/fpga_test/f4pga-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command 'bitread --part_file third_party/prjxray-db/artix7/xc7a200tsbg484-1/part.yaml  -o /tmp/tmpdc0t2fj5 -z -y add16.bit' returned non-zero exit status 127.
@ad-astra-et-ultra
Copy link
Contributor

ad-astra-et-ultra commented Mar 17, 2023

I added the path to the 'bitread' executable to my system's PATH environment variable. If the 'bitread' executable in your system is located at " /path/to/prjxray/build/tools/bitread ", you can do this by running the following command in your terminal:
export PATH=$PATH:/path/to/prjxray/build/tools . This seems to have solved the issue.

@zliu1Charlotte
Copy link
Author

zliu1Charlotte commented Mar 17, 2023

thank you so much for your reply! life saver. @shake-coder it worked on my end.
Have you seen this before, I am trying to convert fasm to bels.

the command I ran is:
python3 -mfasm2bels --connection_database mydb --db_root /home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/third_party/prjxray-db/artix7 --part xc7a200tsbg484-1 --fasm_file add16.fasm --verilog_file add16_reversed.v --xdc_file output.xdc --input_xdc constraints.xdc


Loading database from 'mydb'
Traceback (most recent call last):
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pc-5/Desktop/fpga_bit_to_verilog/f4pga-xc-fasm2bels/fasm2bels/__main__.py", line 23, in <module>
    main()
  File "/home/pc-5/Desktop/fpga_bit_to_verilog/f4pga-xc-fasm2bels/fasm2bels/fasm2bels.py", line 405, in main
    create_channels(args.db_root, args.part, args.connection_database)
  File "/home/pc-5/Desktop/fpga_bit_to_verilog/f4pga-xc-fasm2bels/fasm2bels/database/create_channels.py", line 458, in create_channels
    with DatabaseCache(connection_database) as conn:
  File "/home/pc-5/Desktop/fpga_bit_to_verilog/f4pga-xc-fasm2bels/fasm2bels/database/connection_database_cache.py", line 57, in __enter__
    self.file_connection.backup(
  File "/home/pc-5/Desktop/fpga_bit_to_verilog/f4pga-xc-fasm2bels/fasm2bels/database/connection_database_cache.py", line 93, in _progress
    self.bar = ProgressBar(max_value=total)
  File "/home/pc-5/Desktop/fpga_bit_to_verilog/f4pga-xc-fasm2bels/fasm2bels/lib/progressbar_utils.py", line 41, in __init__
    super().__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'max_value'

THANK YOU SO MUCH!

@ad-astra-et-ultra
Copy link
Contributor

ad-astra-et-ultra commented Mar 17, 2023

It appears that the problem is with the progress bar utility.
In symbiflow-xc-fasm2bels/fasm2bels/database/connection_database_cache.py change the following function:

def _progress(self, status, remaining, total):

        if self.bar is None:

            self.bar = ProgressBar(max_value=total)

        else: 

            self.bar.update(total - remaining)

to:

def _progress(self, status, remaining, total): 

        return

Also comment out from ..lib.progressbar_utils import ProgressBar.

This will disable the progress bar. You wont be able to see the visual indication of the conversion that you are attempting to do. See if this solves your issue.

@zliu1Charlotte
Copy link
Author

zliu1Charlotte commented Mar 17, 2023

wow thanks!

I edited.

    def _progress(self, status, remaining, total):
        """
        Prints database copy progress.
        """
        return
        #if self.bar is None:
        #    self.bar = ProgressBar(max_value=total)
        #else:
        #    self.bar.update(total - remaining)

and comment out the
#from ..lib.progressbar_utils import ProgressBar

Now this gives:

source /home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/bin/activate f4pga_xc_fasm2bels && python3 -mfasm2bels --connection_database xc7a200tsbg484-1_db --db_root /home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/third_party/prjxray-db/artix7 --part xc7a200tsbg484-1 --fasm_file add16.fasm --verilog_file add16_reversed.v --xdc_file output.xdc --input_xdc constraints.xdc

Loading database from 'xc7a200tsbg484-1_db'
Traceback (most recent call last):
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/__main__.py", line 23, in <module>
    main()
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/fasm2bels.py", line 405, in main
    create_channels(args.db_root, args.part, args.connection_database)
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/database/create_channels.py", line 458, in create_channels
    with DatabaseCache(connection_database) as conn:
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/database/connection_database_cache.py", line 60, in __enter__
    self.bar.finish()
AttributeError: 'NoneType' object has no attribute 'finish'
make: *** [Makefile:65: add16_reversed.v] Error 1

@ad-astra-et-ultra
Copy link
Contributor

ad-astra-et-ultra commented Mar 17, 2023

comment out self.bar.finish() in symbiflow-xc-fasm2bels/fasm2bels/database/connection_database_cache.py

@zliu1Charlotte
Copy link
Author

zliu1Charlotte commented Mar 17, 2023

thank you!

There are two self.bar.finish()

one in def __exit__(self, exc_type, exc_value, traceback):
one in def __enter__(self):

comment both out?

@ad-astra-et-ultra
Copy link
Contributor

yes

@zliu1Charlotte
Copy link
Author

zliu1Charlotte commented Mar 17, 2023

after commented both out it seems to work,

now it shows:

source /home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/bin/activate f4pga_xc_fasm2bels && python3 -mfasm2bels --connection_database xc7a200tsbg484-1_db --db_root /home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/third_party/prjxray-db/artix7 --part xc7a200tsbg484-1 --fasm_file add16.fasm --verilog_file add16_reversed.v --xdc_file output.xdc --input_xdc constraints.xdc

Loading database from 'xc7a200tsbg484-1_db'
2023-03-17 14:31:20.320962: About to load database
2023-03-17 14:31:25.263480: Initial database formed
Dumping database to 'xc7a200tsbg484-1_db'
Traceback (most recent call last):
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/__main__.py", line 23, in <module>
    main()
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/fasm2bels.py", line 405, in main
    create_channels(args.db_root, args.part, args.connection_database)
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/database/create_channels.py", line 464, in create_channels
    import_nodes(db, grid, conn)
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/database/create_channels.py", line 301, in import_nodes
    for tile in progressbar_utils.progressbar(grid.tiles()):
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/lib/progressbar_utils.py", line 33, in progressbar
    b = bar.progressbar(*args, **kwargs)
TypeError: 'module' object is not callable
make: *** [Makefile:65: add16_reversed.v] Error 1

@zliu1Charlotte
Copy link
Author

xc7a200tsbg484-1_db is not empty

18534400 Mar 17 14:38 xc7a200tsbg484-1_db

@ad-astra-et-ultra
Copy link
Contributor

The issue appears to be with the progressbar again. Try updating the progressbar module pip install --upgrade progressbar2

@zliu1Charlotte
Copy link
Author

zliu1Charlotte commented Mar 17, 2023

Thank you for everything!

I updated and sadly got the error again.

source /home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/bin/activate f4pga_xc_fasm2bels && python3 -mfasm2bels --connection_database xc7a200tsbg484-1_db --db_root /home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/third_party/prjxray-db/artix7 --part xc7a200tsbg484-1 --fasm_file add16.fasm --verilog_file add16_reversed.v --xdc_file output.xdc --input_xdc constraints.xdc

Loading database from 'xc7a200tsbg484-1_db'
2023-03-17 15:05:27.249834: About to load database
2023-03-17 15:05:31.919874: Initial database formed
Dumping database to 'xc7a200tsbg484-1_db'
Traceback (most recent call last):
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/env/conda/envs/f4pga_xc_fasm2bels/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/__main__.py", line 23, in <module>
    main()
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/fasm2bels.py", line 405, in main
    create_channels(args.db_root, args.part, args.connection_database)
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/database/create_channels.py", line 464, in create_channels
    import_nodes(db, grid, conn)
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/database/create_channels.py", line 301, in import_nodes
    for tile in progressbar_utils.progressbar(grid.tiles()):
  File "/home/pc-5/Desktop/fpga_reverse_engr/symbiflow-xc-fasm2bels/fasm2bels/lib/progressbar_utils.py", line 33, in progressbar
    b = bar.progressbar(*args, **kwargs)
TypeError: 'module' object is not callable
make: *** [Makefile:65: add16_reversed.v] Error 1

@ad-astra-et-ultra
Copy link
Contributor

ad-astra-et-ultra commented Mar 17, 2023

Try
pip uninstall progressbar

pip install progressbar2
If this does not work out, maybe you should raise another issue titled "progressbar-TypeError: 'module' object is not callable"

@zliu1Charlotte
Copy link
Author

I did

pip uninstall progressbar
pip install progressbar2

big shout out to @shake-coder thanks for helping me in this error I have been stuck on it for 2 weeks!
now it is running with no errors.
It might take few mins, I will get back if the bels are generated!
THANK YOU SO MUCH

@ad-astra-et-ultra
Copy link
Contributor

Hi @zliu1Charlotte You're welcome! Glad I could be of assistance.

@zliu1Charlotte
Copy link
Author

It worked! THANK YOU!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants