Home / SystemC / Communication via Ports with User-defined Data Types

Communication via Ports with User-defined Data Types

SystemC supports many data types to communicate between 2 ports. eg: bool, unsigned char, unsigned int, sc_uint, … But, in some cases, we want to use a user-defined data type. In this post, we are going to discuss it.

Suppose, DUT_1 model needs some info of DUT_2 model. It is a group, ID, and address. Instead of, we declare 3 input ports for DUT_1 model corresponding 3 output ports of DUT_2 model, we will define an “extension_info” struct to store and information exchange between DUT_1 and DUT_2 model by 1 port.

It is the same as :

For extension_info works correct. We need :

  • Overload “==” operator

“==” operator using for judge value change or not in sc_signal_t::write( const T& value_ ) and sc_signal_t::update() functions (sc_signal.h)

  • Overload “<<“ operator

“<<“ operator using in sc_signal_t::print( ::std::ostream& os ) const and sc_signal_t::dump( ::std::ostream& os ) const functions (sc_signal.h)

  • Implement sc_trace function

It is necessary for end_of_elaboration function (sc_signal_port.h)

And final, you can use extension_info as other data types for sc_in, sc_out, sc_signal… and using read(), write() function to read/write data.

Download :

Google Drive 1

__FreeSourceC.com__

About admin

Check Also

[ SC Tutorial ] 3. SystemC Data types

SystemC has a number of predefined data types to support hardware designs spanning from the …

48 comments

  1. There are no words to show my appreciation!

  2. I really appreciate your help with my project!

  3. Good day! This post couldn’t be written any better! Reading this post reminds me of my good old room mate! He always kept chatting about this. I will forward this page to him. Fairly certain he will have a good read. Many thanks for sharing!

  4. Woah! I’m really enjoying the template/theme of this blog. It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between superb usability and appearance. I must say that you’ve done a excellent job with this. In addition, the blog loads super quick for me on Opera. Outstanding Blog!

  5. good article. Your knowledge is definitely intensive. I enjoyed reading the article on your Website

  6. I just want to tell you that I am new to weblog and absolutely enjoyed you’re web site. More than likely I’m going to bookmark your site . You definitely have awesome articles. Thanks a lot for sharing with us your website.

  7. This design is spectacular! You certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job. I really loved what you had to say, and more than that, how you presented it. Too cool!

  8. I simply want to mention I am newbie to blogging and definitely savored you’re blog. Very likely I’m planning to bookmark your website . You actually come with beneficial articles and reviews. Thanks a lot for revealing your website.

  9. There is definately a lot to know about this issue. I really like all the points you have made.

  10. Good information. Lucky me I discovered your website by accident (stumbleupon). I’ve saved as a favorite for later!

  11. I’m pretty pleased to find this website. I need to to thank you for ones time just for this wonderful read!! I definitely loved every little bit of it and I have you saved to fav to look at new information in your web site.

  12. Howdy, I do think your website could be having internet browser compatibility issues. When I look at your site in Safari, it looks fine however, when opening in IE, it has some overlapping issues. I just wanted to provide you with a quick heads up! Apart from that, great website!

  13. That is a good tip particularly to those fresh to the blogosphere. Short but very accurate information… Appreciate your sharing this one. A must read post!

  14. Way cool! Some very valid points! I appreciate you writing this article plus the rest of the site is also very good.

  15. Wonderful article! We are linking to this particularly great content on our site. Keep up the good writing.

  16. I’m extremely pleased to find this page. I want to to thank you for ones time due to this fantastic read!! I definitely appreciated every little bit of it and i also have you saved to fav to check out new stuff on your website.

  17. I’m excited to uncover this site. I want to to thank you for ones time for this wonderful read!! I definitely enjoyed every bit of it and I have you bookmarked to see new information in your site.

  18. Greetings! Very helpful advice in this particular article! It is the little changes that produce the most important changes. Thanks for sharing!

  19. I quite like looking through a post that can make men and women think. Also, thank you for permitting me to comment!

  20. There’s definately a lot to find out about this issue. I like all of the points you have made.

  21. Excellent web site you have here.. It’s difficult to find good quality writing like yours nowadays. I seriously appreciate individuals like you! Take care!!

  22. Right here is the perfect webpage for anyone who hopes to find out about this topic. You realize so much its almost hard to argue with you (not that I actually will need to…HaHa). You certainly put a fresh spin on a subject which has been discussed for a long time. Excellent stuff, just excellent!

  23. I was more than happy to find this web site. I wanted to thank you for your time just for this fantastic read!! I definitely liked every part of it and I have you saved to fav to look at new stuff in your web site.

  24. I’m pretty pleased to find this site. I need to to thank you for ones time due to this fantastic read!! I definitely loved every little bit of it and I have you book marked to check out new stuff in your site.

  25. The next time I read a blog, I hope that it doesn’t disappoint me as much as this one. After all, Yes, it was my choice to read through, nonetheless I genuinely thought you would have something helpful to say. All I hear is a bunch of complaining about something you could possibly fix if you were not too busy seeking attention.

  26. I blog frequently and I really thank you for your content. This article has truly peaked my interest. I’m going to take a note of your blog and keep checking for new details about once per week. I opted in for your Feed too.

  27. You have made some decent points there. I checked on the web for more info about the issue and found most individuals will go along with your views on this website.

  28. Very good information. Lucky me I came across your website by accident (stumbleupon). I have book marked it for later!

  29. This excellent website definitely has all the information I wanted about this subject and didn’t know who to ask.

  30. Way cool! Some very valid points! I appreciate you penning this post and the rest of the site is really good.

  31. I’m impressed, I have to admit. Seldom do I encounter a blog that’s both equally educative and entertaining, and without a doubt, you’ve hit the nail on the head. The issue is something that too few folks are speaking intelligently about. Now i’m very happy that I came across this in my hunt for something regarding this.

  32. I enjoy reading through a post that will make people think. Also, many thanks for allowing me to comment!

  33. Howdy, I believe your web site might be having web browser compatibility issues. When I look at your web site in Safari, it looks fine however, if opening in IE, it’s got some overlapping issues. I simply wanted to provide you with a quick heads up! Apart from that, great website!

  34. May I simply just say what a relief to find somebody who really understands what they’re discussing on the internet. You definitely understand how to bring a problem to light and make it important. More and more people really need to check this out and understand this side of the story. I was surprised you’re not more popular because you certainly have the gift.

  35. Having read this I thought it was really informative. I appreciate you spending some time and energy to put this article together. I once again find myself personally spending a significant amount of time both reading and posting comments. But so what, it was still worth it!

  36. Oh my goodness! Amazing article dude! Thank you so much, However I am experiencing troubles with your RSS. I don’t understand why I cannot subscribe to it. Is there anyone else getting similar RSS issues? Anybody who knows the answer will you kindly respond? Thanx!!

  37. This is a topic that’s near to my heart… Thank you! Exactly where are your contact details though?

  38. Your style is so unique in comparison to other folks I’ve read stuff from. Thanks for posting when you have the opportunity, Guess I’ll just book mark this page.

  39. I seriously love your site.. Pleasant colors & theme. Did you develop this web site yourself? Please reply back as I’m attempting to create my own website and would like to learn where you got this from or what the theme is called. Thank you!

  40. I’m amazed, I have to admit. Rarely do I encounter a blog that’s both educative and entertaining, and let me tell you, you’ve hit the nail on the head. The problem is something which not enough people are speaking intelligently about. Now i’m very happy I stumbled across this in my hunt for something regarding this.

Leave a Reply

Your email address will not be published. Required fields are marked *