Jump to content
Uzmeed

cannot understand error

Recommended Posts

hi 

 

I have written the following code for register transfer logic

#include "systemc.h"
#include "UART_tx.h"

void UART_tx :: Register_Transfer()
{
    bool reset;
    int XMT_shft;
    int bit_count;

    //int word_size=8;
    bool load_XMT_shftreg;
    int clear;
    int shift;
    int start;
    sc_int<9> XMT_shftreg;

    if(reset==false){
        XMT_shft=all_ones;
        bit_count=0;
    }

    else
    if(load_XMT_datareg==1)
        XMT_datareg=data_bus;
    if(load_XMT_shftreg==1)
        XMT_shftreg=(XMT_datareg,1);
    if(start==1)
        XMT_shftreg[0]=0;
    if(clear==1)
        bit_count=0;
    else if (shift==1){
        bit_count=bit_count+1;
        XMT_shftreg=(1,XMT_shftreg.range(8,1));
    }

}
 

 

and getting the following error while synthesis

 

@E [HLS-70] In file included from C:/Users/Home/UART_proj/UART_proj/solution1/.autopilot/db/Register_Transfer.pragma.1.cpp:1:
In file included from UART_proj/Register_Transfer.cpp:1:
In file included from UART_proj/Register_Transfer.cpp:1:
In file included from C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc\systemc.h:1:
In file included from C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc/ap_systemc.h:51:
C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc/ap_sc_core.h:356:20: error: const_cast to '_ap_sc_::sc_core::sc_in<_ap_sc_::sc_dt::sc_int<8> >', which is not a reference, pointer-to-object, or pointer-to-data-member
            return const_cast<sc_in>(this)->read();
                   ^~~~~~~~~~~~~~~~~~~~~~~
UART_proj/Register_Transfer.cpp:24:15: note: in instantiation of member function '_ap_sc_::sc_core::sc_in<_ap_sc_::sc_dt::sc_int<8> >::operator const struct _ap_sc_::sc_dt::sc_int<8> &' requested here
  XMT_datareg=data_bus;
              ^
1 error generated.
Compilation of the preprocessed source 'Register_Transfer.g' failed
    while executing
"source C:/Users/Home/UART_proj/UART_proj/solution1/csynth.tcl"
    invoked from within
"hls::main C:/Users/Home/UART_proj/UART_proj/solution1/csynth.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 hls::main {*}$args"
    (procedure "hls_proc" line 5)
    invoked from within
"hls_proc $argv"
 

 

Share this post


Link to post
Share on other sites

Hi. 

Seems as if the compiler is confused by too many implicit casts.

Could you try explicit read:

XMT_datareg=data_bus.read();

Should save one implicit conversion and might help. Actual root cause could be in the _ap_sc stuff (synthesizer internals?).

 

Greetings

Ralph

Share this post


Link to post
Share on other sites

After making some changes now i am getting the following error

the project is attached 

your immediate response id highly regarded

 

@E [HLS-70] In file included from C:/Users/Home/UART_rx/UART_rx/solution1/.autopilot/db/Output_n_nextstate.pragma.1.cpp:1:
In file included from UART_rx/Output_n_nextstate.cpp:1:
In file included from UART_rx/Output_n_nextstate.cpp:1:
In file included from C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc\systemc.h:1:
In file included from C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc/ap_systemc.h:51:
C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc/ap_sc_core.h:206:15: error: no viable conversion from 'const _ap_sc_::sc_core::sc_signal_inout_if<int>' to 'int'
            T v = v2;
              ^   ~~
C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc/ap_sc_core.h:200:13: note: in instantiation of function template specialization '_ap_sc_::sc_core::sc_signal_inout_if<int>::write<_ap_sc_::sc_core::sc_signal_inout_if<int> >' requested here
            write(v);
            ^
C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc/ap_sc_core.h:322:11: note: in instantiation of member function '_ap_sc_::sc_core::sc_signal_inout_if<int>::operator=' requested here
    class sc_signal : public sc_signal_inout_if<T> {
          ^
C:/Xilinx/Vivado_HLS/2015.4/common/technology/autopilot/ap_sysc/ap_sc_core.h:187:9: note: candidate function not viable: 'this' argument has type 'const _ap_sc_::sc_core::sc_signal_inout_if<int>', but method is not marked const
        operator const T () { return this->read(); }
        ^
1 error generated.
Compilation of the preprocessed source 'Output_n_nextstate.g' failed
    while executing
"source C:/Users/Home/UART_rx/UART_rx/solution1/csynth.tcl"
    invoked from within
"hls::main C:/Users/Home/UART_rx/UART_rx/solution1/csynth.tcl"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 hls::main {*}$args"
    (procedure "hls_proc" line 5)
    invoked from within
"hls_proc $argv"
 

UART_tx.h

State_Transition.cpp

Register_Transfer.cpp

Output_n_nextstate.cpp

main.cpp

Share this post


Link to post
Share on other sites

Hi.

I guess it is the same as before. The implicit conversion from a signal to the type of the inner value is not supported correctly by the HLS library you are using. 

The following should help again:

 

T v = v2.read();

Greetings

Rlaph

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×