lanl / QA-Prolog

Quantum Annealing Prolog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ERROR: Can't guess frontend for input file `-b' (missing -f option)!

andreaBelmont opened this issue · comments

I am getting this error and I am not sure where the toolchain is broken in my system:

qa-prolog --verbose --qmasm-args="-O1 --postproc=opt" --query='friends(P1, P2).' examples/friends.pl
qa-prolog: INFO: Parsing examples/friends.pl as Prolog code
qa-prolog: INFO: Representing symbols with 3 bit(s) and integers with 1 bit(s)
qa-prolog: INFO: Storing intermediate files in /var/folders/t4/f39wd1sd25x8ry2hq74xhz1r0000gn/T/qap-443035463
qa-prolog: INFO: Writing Verilog code to friends.v
qa-prolog: INFO: Writing a Yosys synthesis script to friends.ys
qa-prolog: INFO: Converting Verilog code to an EDIF netlist
qa-prolog: INFO: Executing yosys -q friends.v friends.ys -b edif -o friends.edif
ERROR: Can't guess frontend for input file `-b' (missing -f option)!
qa-prolog: exit status 1

It seems to break at the yosys execution step: in my system yosys is installed in /usr/local/bin/yosys

Yosys 0.9+932 (git sha1 4072a966, clang 10.0.1 -fPIC -Os)

and all its tests are passing.

The files friends.v and friends.ys can be found in the intermediate folder /var/folders/t4/f39wd1sd25x8ry2hq74xhz1r0000gn/T/qap-443035463

ls -al /var/folders/t4/f39wd1sd25x8ry2hq74xhz1r0000gn/T/qap-443035463
total 16
drwx------    4 acortis  staff   128 Oct  7 07:25 .
drwx------@ 207 acortis  staff  6624 Oct  7 07:25 ..
-rw-r--r--    1 acortis  staff  1588 Oct  7 07:25 friends.v
-rw-r--r--    1 acortis  staff   370 Oct  7 07:25 friends.ys

Would be very grateful if you could suggest where to start debugging. Thanks, Andrea

I'm not able to reproduce that problem with a similar version of Yosys: Yosys 0.9 (git sha1 UNKNOWN, gcc 8.3.0-6ubuntu1 -fPIC -Os).

What happens if you run

yosys -q friends.v friends.ys -b edif -o friends.edif

from the intermediate folder? Do you get the same error message? If so, what happens if you add a -s before the script name:

yosys -q friends.v -s friends.ys -b edif -o friends.edif

? How about if you additionally specify Verilog input?

yosys -q friends.v -s friends.ys -f verilog -b edif -o friends.edif

It does not seem to make any difference


pwd
/var/folders/t4/f39wd1sd25x8ry2hq74xhz1r0000gn/T/qap-443035463

yosys -q friends.v friends.ys -b edif -o friends.edif  
ERROR: Can't guess frontend for input file `-b' (missing -f option)!

yosys -q friends.v -s friends.ys -b edif -o friends.edif
ERROR: Can't guess frontend for input file `-s' (missing -f option)!

yosys -q friends.v -s friends.ys -f verilog -b edif -o friends.edif
ERROR: Can't guess frontend for input file `-s' (missing -f option)!

Not sure if this helps or not but, from the temp directory,

>> yosys                                                                 

 /----------------------------------------------------------------------------\
 |                                                                            |
 |  yosys -- Yosys Open SYnthesis Suite                                       |
 |                                                                            |
 |  Copyright (C) 2012 - 2019  Clifford Wolf <clifford@clifford.at>           |
 |                                                                            |
 |  Permission to use, copy, modify, and/or distribute this software for any  |
 |  purpose with or without fee is hereby granted, provided that the above    |
 |  copyright notice and this permission notice appear in all copies.         |
 |                                                                            |
 |  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES  |
 |  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF          |
 |  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR   |
 |  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    |
 |  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN     |
 |  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF   |
 |  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.            |
 |                                                                            |
 \----------------------------------------------------------------------------/

 Yosys 0.9+932 (git sha1 4072a966, clang 10.0.1 -fPIC -Os)


yosys> read_verilog friends.v
1. Executing Verilog-2005 frontend: friends.v
Parsing Verilog input from `friends.v' to AST representation.
Generating RTLIL representation for module `\Query'.
Generating RTLIL representation for module `\hates/2'.
Generating RTLIL representation for module `\enemies/2'.
Generating RTLIL representation for module `\friends/2'.
Successfully finished Verilog frontend.

yosys> write_edif friends.edif

2. Executing EDIF backend.

yosys> exit
>> head -n 10 friends.edif                                         
(edif (rename id00001 "friends/2")
  (edifVersion 2 0 0)
  (edifLevel 0)
  (keywordMap (keywordLevel 0))
  (comment "Generated by Yosys 0.9+932 (git sha1 4072a966, clang 10.0.1 -fPIC -Os)")
  (external LIB
    (edifLevel 0)
    (technology (numberDefinition))
    (cell GND
      (cellType GENERIC)
>> edif2qmasm friends.edif > friends.asm
>> head -n 10 friends.asm
# Module id00001
# Generated by Yosys 0.9+932 (git sha1 4072a966, clang 10.0.1 -fPIC -Os)
# Converted to QMASM by edif2qmasm

!include <stdcell>

# hates/2
!begin_macro id00006
  !use_macro $eq $id00010  # $eq$friends.v:38$5
  !use_macro $eq $id00011  # $eq$friends.v:37$4

The only issue is that I do not understand what I am doing :)

What if you put the input filename at the end?

yosys -q -s friends.ys -f verilog -b edif -o friends.edif friends.v

That works and geenerates the friends.edif.

Great! Does it require the -f verilog, or is that unnecessary?

It seems to be working also without specifying -f verilog

yosys -q -s friends.ys -b edif -o friends.edif friends.v

Does this command break your version or can you simply patch this command?

Patching seems to work. Reopen the issue if the latest commit (80c5da0) doesn't fix the problem.

Thanks for the bug report.

mhmm ... I deleted a couple of time the old version, and tried to install the new one with

go get github.com/lanl/QA-Prolog

but I am running on the same issue.

Strange. Could you repeat the command from your initial post and paste in the output? I'd like to see what yosys command is being generated.

qa-prolog --verbose --qmasm-args="-O1 --postproc=opt" --query='friends(P1, P2).' examples/friends.pl

qa-prolog: INFO: Parsing examples/friends.pl as Prolog code
qa-prolog: INFO: Representing symbols with 3 bit(s) and integers with 1 bit(s)
qa-prolog: INFO: Storing intermediate files in /var/folders/t4/f39wd1sd25x8ry2hq74xhz1r0000gn/T/qap-154530702
qa-prolog: INFO: Writing Verilog code to friends.v
qa-prolog: INFO: Writing a Yosys synthesis script to friends.ys
qa-prolog: INFO: Converting Verilog code to an EDIF netlist
qa-prolog: INFO: Executing yosys -q friends.v friends.ys -b edif -o friends.edif
ERROR: Can't guess frontend for input file `-b' (missing -f option)!
qa-prolog: exit status 1

I have used the Makefile to build qa-prolog from the (80c5da0) commit and it seems to work from there (I only had to remove the -D option because I am on mac OS X):

qa-prolog --verbose --qmasm-args="-O1 --postproc=opt" --query='friends(P1, P2).' examples/friends.pl
qa-prolog: INFO: Parsing examples/friends.pl as Prolog code
qa-prolog: INFO: Representing symbols with 3 bit(s) and integers with 1 bit(s)
qa-prolog: INFO: Storing intermediate files in /var/folders/t4/f39wd1sd25x8ry2hq74xhz1r0000gn/T/qap-549603824
qa-prolog: INFO: Writing Verilog code to friends.v
qa-prolog: INFO: Writing a Yosys synthesis script to friends.ys
qa-prolog: INFO: Converting Verilog code to an EDIF netlist
qa-prolog: INFO: Executing yosys -q -s friends.ys -b edif -o friends.edif friends.v
qa-prolog: INFO: Converting the EDIF netlist to QMASM code
qa-prolog: INFO: Executing edif2qmasm -o friends.qmasm friends.edif
qa-prolog: INFO: Executing qmasm --run --values=ints -O1 --postproc=opt --pin=Query.Valid := true friends.qmasm
qa-prolog: exec: "qmasm": executable file not found in $PATH

I'm glad you got it working!

I just realized why go get didn't work: You forgot the -u (update) option. According to https://golang.org/cmd/go/#hdr-Legacy_GOPATH_go_get,

The -u flag instructs get to use the network to update the named packages and their dependencies. By default, get uses the network to check out missing packages but does not use it to look for updates to existing packages.

Regarding installation failing on macOS: The macOS command-line tools give me no end of grief due to their minimalist feature sets. I just pushed out 793336d, which avoids install -D. I hope this helps other macOS users interested in QA Prolog.

Thank you!