{"id":2443,"date":"2011-11-28T10:08:03","date_gmt":"2011-11-28T09:08:03","guid":{"rendered":"https:\/\/blogs.mentor.com\/colinwalls\/?p=2443"},"modified":"2026-03-26T16:36:23","modified_gmt":"2026-03-26T20:36:23","slug":"system-c-for-embedded-systems-programming","status":"publish","type":"post","link":"https:\/\/blogs.sw.siemens.com\/embedded-software\/2011\/11\/28\/system-c-for-embedded-systems-programming\/","title":{"rendered":"System-C for embedded systems programming"},"content":{"rendered":"<p>I recent <a href=\"https:\/\/blogs.mentor.com\/colinwalls\/blog\/2011\/10\/31\/hardware-designers-and-software\/\" target=\"_blank\" rel=\"noopener noreferrer\">wrote about<\/a> the similarity in software and hardware design, as they are both performed by writing code in a high level programming language. My colleague <a href=\"mailto:richard_vlamynck@mentor.com\" target=\"_blank\" rel=\"noopener noreferrer\">Richard Vlamynck<\/a>, wrote to me, suggesting that he might be able to usefully expand on this topic. He is an unusual guy, even within Mentor Graphics, as he is a modern day &#8220;Renaissance man&#8221; &#8211; he has a very good understanding of both hardware and software design. So, I was very pleased to accept a guest posting from him &#8230;<!--more--><\/p>\n<p>I\u2019ve been following Colin\u2019s blog and especially interested in the issues, answers and comments regarding programming languages for embedded systems. So, when Colin mentioned VHDL hardware description language (HDL) a couple of posts ago, it caught my attention and made me put down my xacto knife and roll of rubylith just long enough to bring you-all up to date on what I consider to be an exciting development in embedded systems programming, namely the System-C library for hardware\/software co-development.<\/p>\n<p>Let&#8217;s say that you were tasked with building a module to be integrated in a system on a chip (SoC). For the hardware flow, you would first pick a hardware description language such as Colin\u2019s favorite (VHDL) and then create the hardware design by wiring up some registers to hold the incoming and outgoing data, along with the logic and clock circuits to perform the actual functionality of the device.<\/p>\n<p>After designing your hardware block, then you would use a hardware synthesis tool (such as Design Compiler from Synopsys or <a href=\"http:\/\/www.mentor.com\/products\/fpga\/synthesis\/\" target=\"_blank\" rel=\"noopener noreferrer\">Precision<\/a> from Mentor Graphics) which, in short, wires up all the transistors together as you described in your VHDL program.<\/p>\n<p>A hardware description language is similar to a software description language, except that it allows for concurrent programming. A hardware description language, such as VHDL, allows you to have more than one main() function in your program. Think about it for a moment, if you have multiple main() functions running concurrently, then you\u2019ll need to add syntax and semantics to your programming language to synchronize and handshake among all the functions. This is exactly how VHDL differs from a conventional software programming language.<\/p>\n<p>Let\u2019s say that you\u2019ve created your device using VHDL. Next, you are also going to perform some system level analysis to see just how the entire SoC is going to perform. You could wire up all the rest of the SoC modules (ie. in addition to your device, there may also be a CPU block, a USB controller block, a video controller block, an Ethernet controller block, a UART block etc. &#8211; you get the picture.)<\/p>\n<p>This means that you\u2019re going to need a simulator that understands how VHDL operates and can simulate the entire SoC as it\u2019s running. The VHDL simulator know about synchronous and asynchronous clocks and reset signals. The simulator has to know how to handle positive and negative pulse edges on wires and the delay of those signals as they propagate down the wires.<\/p>\n<p>The downside to a VHDL simulator is that while it is very accurate in modeling the actual clock cycles of your device, it\u2019s also very slow when you try to run a huge design such as the entire SoC. That is to say, the actual clock speed of an embedded ARM SoC that\u2019s in your cell phone might be 300MHz, but when you\u2019re the cell phone designer and you run the cell phone SoC HDL in a simulator, you will be running a hundred or a thousand times slower. It\u2019s not practical to do software development on that type of simulation engine.<\/p>\n<p>But there\u2019s a faster way to simulate a SoC, and that\u2019s to simulate not the actual transistors and gates, but to simulate the behaviour of the SoC. So if we had a behavioural model of the SoC written in some high level software programming language, then we could start to explore in real-time the interaction of the software stack that\u2019s going to be running on our SoC.<\/p>\n<p>So now, I will write a description of the behaviour of our device in the c-language. The advantage is that now I can test it much faster and easier using the wealth of standard software programming facilities that are mature, stable and well proven. I don\u2019t have to worry about clocks and resets and wires when I\u2019m programming in the software world. The disadvantage is that now I have to maintain two different models of the same functional block.<\/p>\n<p>Is there some way to get the best of both worlds? What if I could create a behavioral model of a functional block in a software programming language and that same model could be fed into my hardware synthesis tool to create the actual gates and transistors?<\/p>\n<p>The paradigm that I\u2019m looking for is System-C.<\/p>\n<p>System-C is nothing more than a library that you use with your existing C++ development tool kit. Simply stated, System-C is just another set of classes and macros, and in this case, it lets you simulate concurrent processes within a single program. Another advantage to System-C is that it offers a synthesizable language subset. That is to say, some, but not all, System-C programs can be synthesized into real hardware. This means that the judiciously written System-C program can run in a software simulator, or it can be turned into actual silicon gates and transistors.<\/p>\n<p>In a future post, we\u2019ll look at some real world examples of using SystemC.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I recent wrote about the similarity in software and hardware design, as they are both performed by writing code in&#8230;<\/p>\n","protected":false},"author":71677,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spanish_translation":"","french_translation":"","german_translation":"","italian_translation":"","polish_translation":"","japanese_translation":"","chinese_translation":"","footnotes":""},"categories":[1],"tags":[313,300,438,340,439,433],"industry":[],"product":[],"coauthors":[],"class_list":["post-2443","post","type-post","status-publish","format-standard","hentry","category-news","tag-c","tag-embedded-software","tag-precision","tag-programming-languages","tag-system-c","tag-vhdl"],"_links":{"self":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/2443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/users\/71677"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/comments?post=2443"}],"version-history":[{"count":1,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/2443\/revisions"}],"predecessor-version":[{"id":10019,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/posts\/2443\/revisions\/10019"}],"wp:attachment":[{"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/media?parent=2443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/categories?post=2443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/tags?post=2443"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/industry?post=2443"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/product?post=2443"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.sw.siemens.com\/embedded-software\/wp-json\/wp\/v2\/coauthors?post=2443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}