Jump to content

Recommended Posts

Hi 

Attached is the code for parallel to serial and serial to parallel conversion

i have two problems in converter.cpp

1- count is not incrementing the value

2- Lout is not getting value of PS_reg

 

in SPPS48 i am getting the following error

./../../SPPS48.h: In constructor 'SPPS48::SPPS48(sc_core::sc_module_name)':
../../../SPPS48.h:51:9: error: 'struct SPPS48' has no member named 'M1'
../../../SPPS48.h:51:16: error: expected type-specifier before 'SPPS'
../../../SPPS48.h:51:16: error: expected ';' before 'SPPS'
../../../SPPS48.h:52:3: error: 'M1' was not declared in this scope
../../../SPPS48.h:60:3: error: 'M2' was not declared in this scope
../../../SPPS48.h:60:10: error: expected type-specifier before 'SPPS'
../../../SPPS48.h:60:10: error: expected ';' before 'SPPS'
../../../SPPS48.h:69:3: error: 'M3' was not declared in this scope
../../../SPPS48.h:69:10: error: expected type-specifier before 'SPPS'
../../../SPPS48.h:69:10: error: expected ';' before 'SPPS'

convert.cpp

main.cpp

SPPS.h

SPPS48.h

Share this post


Link to post
Share on other sites

From a quick glance into your source files, I see:

  • Your headers are missing #include guards.
  • You don't include SPPS.h in your header SPPS48.h, but your members M1, M2, and M3 are of type SPPS, which you define in SPPS.h
  • I recommend that you don't use the header <systemc.h>, as it seriously pollutes your public namespace. Use header <systemc> instead and import only the symbols in your current namespace, which you actually use.
  • Your constructor allocates manually memory for the members M1, M2, and M3 using "new", but lacks a destructor, which would release the objects using "delete". Anyway, this is not considered "Modern C++". Instead of raw pointers to objects of type SPPS, use a smart pointer. In your case, std::unique_ptr is probably the appropriate choice.
  • All members of your SC_MODULE are exposed to public. This may be good for debugging, but it is better to only expose those members, which constitute the public interface of your module (i.e., at least the input/output ports, constructor, and destructor). Your SC_METHODs and SC_THREADs don't need to be public.
  • Your approach to generate a clock signal in sc_main() is tedious the most. A clk signal of type sc_core::sc_clock is a more comfortable solution. To generate more comfortably complex stimuli, I recommend that you implement them in an own stimuli module. Therein, you can register an SC_THREAD, which performs the stimuli generation and which can easily wait for delays or event before proceeding to the next stimulus. In the same way a monitor for your output signal can be implemented.

I repeat my recommendation to learn first the basics of modern C++ and to read a good book on SystemC to get more efficient in your modelling attempts!

Share this post


Link to post
Share on other sites

Hello @Uzmeed,

You are assigning multiple values in the PS_reg in the same delta cycle in SC_METHOD.

It is better that you refer for SystemC LRM (refer: here) sections: 5.2.95.2.105.2.11 specifically to know about the differences in different processes in SystemC.

Regards,

Ameya Vikram Singh

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

×