Jump to content

redefinition of enum


Recommended Posts

Hello @Uzmeed,

In you attachements you are missing the header file: file.h

Which seems to re-declare:

  • enum state
  • class cmd

You are also missing the include guard in your arith.h and cmd.h header file. You can see the possible solution here:

////////////////////////////
// Observe these added lines
#ifndef ARITH_H_
#define ARITH_H_
////////////////////////////

#include "systemc.h"
#include "file.h" 

SC_MODULE(arith){



	sc_port<sc_fifo_in_if<cmd> > data_in;
	sc_port<sc_fifo_out_if<cmd> > data_out;

	sc_fifo<cmd> result_buffer;

	void write_result (cmd&, sc_int<64>&);

	void return_proc();
	void arith_proc();

	SC_CTOR(arith) {

	 SC_THREAD(return_proc);
	 SC_THREAD(arith_proc);
	 }

};
////////////////////////////
// Observe these added lines
#endif  // ARITH_H_
////////////////////////////

 

I think you should probably start by learning C++, you can find excellent tutorials online (some of them mentioned below):

Regards,

Ameya Vikram Singh

Link to comment
Share on other sites

Thanks Ameya

I was adding these guards but in cmd.h only adding to both cmd.h and arith.h worked

moreover file.h = cmd.h i just change the name to see if trhere any conflict with name or not

 

One more thing please I am also getrting the following error 

you can also see that in the log i attached previously

 

C:/Xilinx/Vivado_HLS/2015.4/win64/tools/systemc/include/sysc/communication/sc_fifo.h: In member function 'void sc_core::sc_fifo<T>::print(std::ostream&) const [with T = cmd, std::ostream = std::basic_ostream<char>]':
../../../main.cpp:9:2:   instantiated from here
C:/Xilinx/Vivado_HLS/2015.4/win64/tools/systemc/include/sysc/communication/sc_fifo.h:314:13: error: no match for 'operator<<' in 'os << *(((cmd*)((const sc_core::sc_fifo<cmd>*)this)->sc_core::sc_fifo<cmd>::m_buf) + ((unsigned int)(((unsigned int)i) * 16u)))'
C:/Xilinx/Vivado_HLS/2015.4/win64/tools/systemc/include/sysc/communication/sc_fifo.h:314:13: note: candidates are:
c:\xilinx\vivado_hls\2015.4\msys\bin\../lib/gcc/mingw32/4.6.2/include/c++/ostream:110:7: note: std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::basic_ostream<_CharT, _Traits>::__ostream_type& (*)(std::basic_ostream<_CharT, _Traits>::__ostream_type&)) [with _CharT = char, _Traits = std::char_traits<char>, std::basic_ostream<_CharT, _Traits>::__ostream_type = std::basic_ostream<char>].............................................

 

Can u please also help in this regard

 

Regards
 

Link to comment
Share on other sites

Hello @Uzmeed,

I cannot really know what you are doing here (main.cpp line 9) without the source code.

47 minutes ago, Uzmeed said:

../../../main.cpp:9:2:   instantiated from here

Do you really need to use such a heavy weight tool (Vivado HLS) for exploration?

I would recommend that you first try to use the basic tools for developing SystemC models (some of them listed here):

Then move onto to the tools when you have mastered the basics.

Regards,

Ameya Vikram Singh

Link to comment
Share on other sites

I concur with the idea of becoming more proficient in C++. This is the number one best way to improve your SystemC skills. It also helps to get good formal training on SystemC.

Suggestions:

  1. Define your enum's inside your class declarations (e.g. inside a module). Then you enumeration items become CLASS_NAME::ENUM_NAME
  2. Adopt C++11 and use enum classes. See http://en.cppreference.com/w/cpp/language/enum for more details.
  3. Do both!

Any serious C++ programmer should be using C++11 or C++14 by now unless restricted by some antiquated toolset. These are now well supported by modern versions of GCC, CLANG (LLVM), Microsoft Visual Studio, Oracle, and IBM. This even includes most embedded compilers.

Link to comment
Share on other sites

Thanx David 

I am doing my MS and studying the course of reconfigurable computing . 

I admitt that i have to study C before system C but compulsion of doing projects in system C forces me to seek advice .

However I am trying my level best 

Any way thanks ur advice solved my problem

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...