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

Error while regenerating SSITH P2 verilog files #34

Closed
LeonardooAlves opened this issue Apr 15, 2021 · 11 comments
Closed

Error while regenerating SSITH P2 verilog files #34

LeonardooAlves opened this issue Apr 15, 2021 · 11 comments

Comments

@LeonardooAlves
Copy link

LeonardooAlves commented Apr 15, 2021

Hi, I hope you are well. I am facing the following error while regenerating the verilog files in the src_SSITH_P2 folder with make compile command:

compiling ../src_Core/Near_Mem_VM_WB_L1_L2/Cache.bsv
Error: "../src_Core/Near_Mem_VM_WB_L1_L2/Cache.bsv", line 479, column 32: (T0080)
  Type error at the use of the following function:
    Meta

  The expected return type of the function:
    Cache::Meta

  The return type according to the use:
    Meta#(b__, a__)

Error: "../src_Core/Near_Mem_VM_WB_L1_L2/Cache.bsv", line 645, column 46: (T0080)
  Type error at the use of the following function:
    Meta

  The expected return type of the function:
    Cache::Meta

  The return type according to the use:
    Meta#(b__, a__)

Error: "../src_Core/Near_Mem_VM_WB_L1_L2/Cache.bsv", line 716, column 49: (T0080)
  Type error at the use of the following function:
    Meta

  The expected return type of the function:
    Cache::Meta

  The return type according to the use:
    Meta#(b__, a__)

Error: "../src_Core/Near_Mem_VM_WB_L1_L2/Cache.bsv", line 855, column 27: (T0007)
  Unbound type constructor `Meta_$Meta'
Error: "../src_Core/Near_Mem_VM_WB_L1_L2/Cache.bsv", line 1035, column 49: (T0080)
  Type error at the use of the following function:
    Meta

  The expected return type of the function:
    Cache::Meta

  The return type according to the use:
    Meta#(b__, a__)

Error: "../src_Core/Near_Mem_VM_WB_L1_L2/Cache.bsv", line 1111, column 18: (T0007)
  Unbound type constructor 'Meta_$Meta'
make: *** [Makefile:118: compile] Error 1

I also renegerated the verilog files in the builds/RV64ACDIMSU_Flute_verilator but I had no problems. Looks like it only happens for the SSITH folder.

@rsnikhil
Copy link
Collaborator

Dear Leonardo Alves,

I'm able to do 'make compile' successfully in src_SSITH_P2 folder, to
regenerate the Verilogs.

I attach here 'log_make.txt', a transcript of my run of 'make
compile', for your comparison. Could you kindly compare it with the
details of your 'make compile' and see if something is going wrong in
a path variable or something?

Could you please:

  • 'git pull', to make sure you have the latest version
  • In src_SSITH_P2/, please 'make full_clean' to clean out any previous build
  • and try 'make compile' again, and compare it with 'log_make.txt' that I atttached?

If you are still unable to resolve it, could you kindly make a
transcript of your 'make compile' and attach it so I could take a look
at it?

Thanks,
Nikhil

log_make.txt

@LeonardooAlves
Copy link
Author

Hi Nikhil, I hope you are well.

The log is similar to yours until line 544, then the error occurs (error: "../src_Core/Near_Mem_VM_WB_L1_L2/Cache.bsv", line 479, column 32: (T0080)). Following is the transcript: log_src_SSITH_P2.txt.

@rsnikhil
Copy link
Collaborator

Hello Leonardo Alves,

I still do not have a clear diagnosis about why you're encountering
errors in 'make compile' in src_SSITH_P2. I have not been able to
reproduce your error (see Note 1 below).

My theory is you may be using a version of 'bsc' that was in transition.

I have successfully run 'make compile' in src_SSITH_P2 with two
different versions of 'bsc' (you can find the version you're using
with 'bsc -v'):

(A) A much older version, an 'official release' that predates the open-source 'bsc':

    $ bsc -v
    Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24)

(B) The latest open-source version of bsc:

    $ bsc -v
    Bluespec Compiler (build 16071eec)

based on 'git pull' and 'make all' of:

    https://github.com/B-Lang-org/bsc
    commit 16071eec, branch 'master'

For this run, I also needed 'git pull' of this (see Note 2 below):

    https://github.com/B-Lang-org/bsc-contrib
    commit 272a2aa9, branch 'main'

I attach a 'make compile' transcript for this build, for your reference.

Note 1: I think you may be using a version between (A) and (B).
Could you do a 'bsc -v' and let me know which commit you are using?
I could try building that to see if I can reproduce the error you're seeing.

The error message you see:

  Type error at the use of the following function:
    Meta
  The expected return type of the function:
    Cache::Meta
  The return type according to the use:
    Meta#(b__, a__)

suggests to me that the parser is looking for two type parameters
for Meta (b___ and a___) even though it is monomorphic. I'm not
sure why it's doing that (there has been some recent work by
others on type-level facilities in bsc, and this may be a
consequence of that).

Note 2: If you are not using the latest 'bsc' as (B) above, perhaps
you could upgrade? Note, in src_SSITH_P2/Makefile, you will see a
section at line 96 headed by this comment:

    # Please use one of the following defs of BSC_PATH (and comment out the other)

Please comment out the def of BSC_PATH of Line 99,
uncomment and edit line 104 to point at your clone of bsc-contrib/Libraries/
and uncomment lines 105-106,
before doing 'make compile'.

This is what I did in (B) above, and it successfully compiles (transcript attached).

Nikhil
log_make_RSN_bsc.txt

@quark17
Copy link
Contributor

quark17 commented Apr 21, 2021

As you can see from the above mention, a type/constructor called Meta was recently added to BSC's libraries, and that shouldn't cause a conflict here but it is conflicting because of a bug in BSC.

I confirm that the latest BSC fails in this way. The reason that @rsnikhil didn't observe this is because the BSC repo's main branch was renamed to main, and existing clones that are tracking the old branch name will silently fetch new commits and not see any for the old branch.

@LeonardooAlves
Copy link
Author

LeonardooAlves commented Apr 21, 2021

Hi. This is the bsc version I have:

Bluespec Compiler (build bd141b50)
Copyright 2000-2020 Bluespec, Inc.

I updated Flute repository, but the same error happens.

Then, I downloaded bsc again to:

Bluespec Compiler (build d05342e3)
Copyright 2000-2020 Bluespec, Inc.

I am having issues with bsc-contrib libraries:

make compile
INFO: Generating RTL into Verilog_RTL ...
bsc -u -elab -verilog  -vdir Verilog_RTL  -bdir build_dir  -info-dir build_dir  -D RV64 -D ISA_PRIV_M  -D ISA_PRIV_U  -D ISA_PRIV_S -D SV39 -D ISA_I  -D ISA_M  -D ISA_A  -D ISA_C -D ISA_F -D ISA_D -D INCLUDE_FDIV  -D INCLUDE_FSQRT -D SHIFT_BARREL -D MULT_SYNTH -D Near_Mem_Caches -D FABRIC64 -D INCLUDE_GDB_CONTROL -D INCLUDE_TANDEM_VERIF -D BRVF_TRACE -D XILINX_BSCAN  -D XILINX_XCVU9P  -D JTAG_TAP -D CORE_SMALL -D NUM_CORES=1 -D CACHE_LARGE  -keep-fires -aggressive-conditions -no-warn-action-shadowing -no-show-timestamps -check-assert -suppress-warnings G0020 +RTS -K128M -RTS  -show-range-conflict  -p ../src_Core/Near_Mem_VM_WB_L1_L2/src_LLCache:../src_Core/Near_Mem_VM_WB_L1_L2/src_LLCache/procs/lib:../src_Core/Near_Mem_VM_WB_L1_L2/src_LLCache/procs/RV64G_OOO:../src_Core/Near_Mem_VM_WB_L1_L2/src_LLCache/coherence/src:src_BSV:../src_Core/CPU:../src_Core/ISA:../src_Core/RegFiles:../src_Core/Core_v2:../src_Core/Cache_Config:../src_Core/Near_Mem_VM_WB_L1_L2:../src_Core/PLIC:../src_Core/Near_Mem_IO:../src_Core/Debug_Module:../src_Core/BSV_Additional_Libs:../src_Testbench/Fabrics/AXI4:+:%/Libraries/TLM3:%/Libraries/Axi:%/Libraries/Axi4  src_BSV/P2_Core.bsv
checking package dependencies
compiling src_BSV/Giraffe_IFC.bsv
Error: "Axi.bsv", line 5, column 9: (S0027)
  The package `Axi' was compiled using a different version of the file
  `Prelude.bo' than what was found in the path.
  Please recompile the affected packages in dependency order or with -u.
make: *** [Makefile:128: compile] Error 1

Rebuilding bsc-contrib:


compiling ./BusSwitch.bsv
Warning: "BusSwitch.bsv", line 11, column 8: (S0089)
  Multiple copies of a file were found in the path. Using:
    /home/leo/Documents/bsc/inst/lib/Libraries/BusDefines.bo
  Ignoring:
    /home/leo/Documents/bsc/bsc-contrib/build/bsvlib/AMBA_TLM2/TLM/../../Bus/BusDefines.bo
Error: "BusDefines.bsv", line 5, column 9: (S0027)
  The package `BusDefines' was compiled using a different version of the file
  `Prelude.bo' than what was found in the path.
  Please recompile the affected packages in dependency order or with -u.
make[3]: *** [Makefile:23: build] Error 1
make[3]: Leaving directory '/home/leo/Documents/bsc/bsc-contrib/Libraries/AMBA_TLM2/TLM'
make[2]: *** [Makefile:12: install] Error 2
make[2]: Leaving directory '/home/leo/Documents/bsc/bsc-contrib/Libraries/AMBA_TLM2'
make[1]: *** [Makefile:14: install] Error 2
make[1]: Leaving directory '/home/leo/Documents/bsc/bsc-contrib/Libraries'
make: *** [Makefile:24: install] Error 2

@jrtc27
Copy link
Contributor

jrtc27 commented Apr 21, 2021

Warning: "BusSwitch.bsv", line 11, column 8: (S0089)
  Multiple copies of a file were found in the path. Using:
    /home/leo/Documents/bsc/inst/lib/Libraries/BusDefines.bo
  Ignoring:
    /home/leo/Documents/bsc/bsc-contrib/build/bsvlib/AMBA_TLM2/TLM/../../Bus/BusDefines.bo
Error: "BusDefines.bsv", line 5, column 9: (S0027)
  The package `BusDefines' was compiled using a different version of the file
  `Prelude.bo' than what was found in the path.
  Please recompile the affected packages in dependency order or with -u.

Looks like you installed bsc-contrib to two different places and at least one of them is "old"?

@quark17
Copy link
Contributor

quark17 commented Apr 21, 2021

Note that Flute does fail to compile with the latest BSC. You will need to revert to an older BSC -- commit 88d4eef7 is a reasonable point (or earlier).

Regarding the error with the libraries: An old version of the contrib libraries seems to have been installed into Documents/bsc/inst/lib/Libraries/. When you try to compile the contrib libraries, BSC's search path is finding the previously installed files first. You will either need to remove those old libraries, or change BSC's search path to look in local directories first (which is probably something we should do in the contrib Makefiles anyway). Since you need to revert your BSC to and older version anyway, instead of trying to remove the individual libraries (which is made harder without the hierarchy), I suggest that you just delete the entire inst directory and re-install BSC and don't install the contrib libraries into it. As Nikhil said above, Flute's Makefile has a BSC_PATH statement which can be set to find the contrib libraries elsewhere, if you uncomment the correct lines in the Makefile.

@LeonardooAlves
Copy link
Author

Thanks for the help. I download and installed the bsc commit 88d4eef7 as suggested by @quark17, and modified the Flute Makefile to point to bsc-contrib as suggested by @rsnikhil. However, I still have problems to build (transcript attached):


compiling ../src_Core/CPU/FPU.bsv
Warning: Unknown position: (S0080)
  8 warnings were suppressed.
Error: "../src_Core/CPU/FPU.bsv", line 47, column 31: (T0080)
  Type error at the use of the following function:
    mkFloatingPointDivider

  The expected return type of the function:
    g__#(ClientServer::Server#(Tuple3#(FPU::FDouble, FPU::FDouble, ISA_Decls::RoundMode), FPU::FpuR))

  The return type according to the use:
    c__#(ClientServer::Server#(Tuple3#(FloatingPoint::FloatingPoint#(d__, e__),
				   FloatingPoint::FloatingPoint#(d__, e__),
				   FloatingPoint::RoundMode),
			   Tuple2#(FloatingPoint::FloatingPoint#(d__, e__), FloatingPoint::Exception)))

make: *** [Makefile:128: compile] Error 1

Perhaps I should go to an old commit version?
src_SSITH_P2_make_compile_log.txt

@jrtc27
Copy link
Contributor

jrtc27 commented Apr 22, 2021

See #31

@LeonardooAlves
Copy link
Author

LeonardooAlves commented Apr 23, 2021

Thank you @jrtc27, @quark17 and @rsnikhil. The solution @quark17 proposed here B-Lang-org/bsc#329 solved the issue.
Hence, to solve the problem I had to:

  1. Use an old bsc commit (88d4eef7) to building the Flute.
  2. Modify the src_Core/CPU/FPU.bsv and src_Core/CPU/FBox_Core.bsv by replacing RoundMe by FloatingPoint::RoundMe.
  3. Changed the lines in the MakeFile to correctly redirect for the bsc-contrib folder.

@quark17
Copy link
Contributor

quark17 commented May 6, 2021

The bug in BSC that led to type errors about Meta has been fixed (BSC PR B-Lang-org/bsc#355). Step 1 of your solution (using an old BSC commit), should no longer be needed.

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

4 participants