一、编译System库

1.下载SystemC library source code
              到http://www.systemc.org注册会员账号后,即可下载SystemC library soure code

2. 以SystemC 23.0为例,下载后的文件名喂systemc-2.3.0.tgz,解压到C盘目录下:F:\systemc-2.2.0

3. 打开C:\systemc-2.3.0\msvc80\SystemC目录下的SystemC.sln

4.VS一般都是Debug模式,所以直接"生成(Build英文)"-->“生成解决方案(Build Solution)”,如果编译成功的话(忽略那些Warning)。在C:\systemc-2.3.0\msvc80\SystemC\debug目录下就生成了SystemC.lib

我在编译时遇到这样的问题:fatal error C1189: #error :  The C++ Standard Library forbids macroizing keywords. Enable warning C4005 to find the forbidden macro. 在这截下来跟大家分享下,解决方案是:

右键Properties -> configuration Properties ->C/C++ -> Preprocessor -> Preprocessor Definitions 添加_XKEYCHECK_H 。

二、新建一个控制台应用程序。添加测试代码,这里给出一个测试代码:

//mon.h

#ifndef _MON_H
#define _MON_H
#include <systemc>
SC_MODULE(mon){
sc_in<bool> A,B,F;
sc_in_clk Clk;
void monitor(){ //watch the inport and outport signal until simulatus stop
while(1){
wait();
cout<<sc_time_stamp()<<"\t"<<A.read()
<<" "<<B.read()<<" "<<F.read()<<endl;
}
}
SC_CTOR(mon){
SC_THREAD(monitor);
sensitive<<Clk.pos();
cout<<"Time\tA B F"<<endl;
}
};
#endif

//nand2.h

#ifndef _NAND2_H
#define _NAND2_H #include <systemc> SC_MODULE (nand2){ //declare nand2 module
sc_in<bool> A,B; //input signal ports
sc_out<bool> F; //output port
void do_nand(){ //simulate logic function of the nand
F.write(!( A.read() && B.read()));
};
SC_CTOR(nand2){ //constructor for nand2
SC_METHOD (do_nand); //register do_nand with kernel
sensitive<<A<<B; //sensitivity list
}
};
#endif

//stim.h

#ifndef _STIM_H
#define _STIM_H #include <systemc> SC_MODULE(stim){
sc_out<bool> A,B; //declare outport signal
sc_in<bool> Clk; //declare clock void gen_stim(){ //function to generate the test bench
A.write(0);
B.write(0);
wait();
A.write(0);
B.write(1);
wait();
A.write(1);
B.write(0);
wait();
A.write(1);
B.write(1);
wait();
sc_stop();
}
SC_CTOR(stim){
SC_THREAD(gen_stim);
sensitive<<Clk.pos();
}
};
#endif

//main.cpp

#include"nand2.h"
#include"stim.h"
#include"mon.h" int sc_main(int argc, char* argv[]){
sc_signal<bool> Asig, Bsig, Fsig;
sc_clock testClk("TestClock",10,SC_NS,0.5); nand2 nand("nand2");
nand.A(Asig);
nand.B(Bsig);
nand.F(Fsig); stim stim1("Stimulus");
stim1.A(Asig);
stim1.B(Bsig);
stim1.Clk(testClk); mon monitor1("Monitor");
monitor1.A(Asig);
monitor1.B(Bsig);
monitor1.F(Fsig);
monitor1.Clk(testClk); sc_start(); //stimulus start
return 0;
}

右击工程名选择Properties

C/C++→General →Additional Include Directories (F:\systemc-2.3.0\src)

C/C++ →Language →Enable Run-Time Type Info→Yes

C/C++→Code Generation→Runtime Library→Multi-thread Debug(/MTd)

C/C++→ Command Line→Additional Options加上/vmg /D_CRT_SECURE_NO_DEPRECATE

Linker →General→Additional Library Directories (D:\systemc- 2.3.0\msvc80\SystemC\Debug)

Linker →Input→Additional Dependencies (SystemC.lib)

之后编译运行即可。

VS2012下systemC配置的更多相关文章

  1. VLFeat图像库在VS2012下的配置

         近期做课题所需,開始使用VLFeat图像库.      库下载链接:      http://download.csdn.net/detail/sunboyiris/7500097     ...

  2. Windows7+VS2012下OpenGL 4的环境配置

    系统环境 Windows 7 Ultimate x64,Visual Studio Ultimate 2012 Update 4,和一块支持OpenGL 4.x的显卡. 准备工作 首先用GPU Cap ...

  3. Win10下IIS配置图解、MVC项目发布图解、IIS添加网站图解

    Win10下IIS配置 .找到控制面板:[开始]菜单鼠标右击,打开[控制面板] .打开控制面板,点击[程序],点击[启用或关闭Windows功能] 下一步,点击[启用虎关闭Windows功能] . 开 ...

  4. 基于OpenCV做“三维重建”(0)-- OpenCV3.2+VIZ6.3.0在vs2012下的编译和使用

    一.问题提出         ViZ对于显示3维的效果图来说,非常有帮助:我在使用OpenCV进行双目测距的过程中,有一些参数希望能够通过可视化的方法显示出来,所以参考了这方面相关的资料.做了一些实验 ...

  5. 二维码解码器Zbar+VS2012开发环境配置

    Zbar条码解码器是一个开源的二维码(包括条形码)解码器,可以识别来至于视频流,图像文件.手持扫码器和视频设备(如摄像头)等二维码识别,支持EAN-13/UPC-A, UPC-E, EAN-8, Co ...

  6. vs2012下 error4996

    原文链接:http://blog.csdn.net/xidianzhimeng/article/details/11457045 分类: VS使用学习 2013-09-09 08:37 24人阅读 评 ...

  7. ASP.NET Aries 入门开发教程4:查询区的下拉配置

    背景: 今天去深圳溜达了一天,刚回来,看到首页都是微软大法好,看来离.NET的春天就差3个月了~~ 回到正题,这篇的教程讲解下拉配置. 查询区的下拉配置: 1:查询框怎么配置成下拉? 在配置表头:格式 ...

  8. Windows下Nginx配置SSL实现Https访问(包含证书生成)

    Vincent.李   Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...

  9. window下xampp配置多端口、多站点步骤

    好些日子没整理知识了,许多新东西不整理出来时间一长就淡忘了.看来以后得继续坚持整理. 配置XAMPP多端口.多站点如下步骤: 多端口: (一个域名下同时配置多个端口,从而达到访问不同程序) 效果例如: ...

随机推荐

  1. poj2431 Expedition

    直接代码... #include<string.h> #include<stdio.h> #include<queue> #include<iostream& ...

  2. Binary Tree Maximum Path Sum [leetcode] dp

    a(i):在节点i由于单边路径的最大结束 b(i):在节点i路径和 a(i) = max{ i->val, i->val + max{a(i->left), a(i->righ ...

  3. C++定义自己的命名空间和头文件

    下面的例子演示如何使用一个简单的演示空间和自己的头文件定义.码如下面: compare.h: namespace compare{ double max(const double* data,int ...

  4. Serverlet具体解释

    Serverlet简单介绍: Servlet(Server Applet),全称Java Servlet,未有中文译文.是用Java编写的server端程序.其主要功能在于交互式地浏览和改动数据,生成 ...

  5. 蜘蛛牌 (DFS)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1584 全部状态都判断一遍 代码: #include <stdio.h> #include ...

  6. css+html菜单适应性学习的宽度

    本文就是利用css和html自适应于文本菜单的长度. 后效果图实现,例如下列: watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvajkwMzgyOTE4Mg= ...

  7. ASP.NET MVC+EF框架+EasyUI实现权限管理系列(9)-TT模板的学习

    原文:ASP.NET MVC+EF框架+EasyUI实现权限管理系列(9)-TT模板的学习 ASP.NET MVC+EF框架+EasyUI实现权限管系列 (开篇)   (1):框架搭建    (2): ...

  8. 获取调用者Class和method、反射获取get方法、获取注解信息

    调用者Class 及 method StackTraceElement stacks[] = Thread.currentThread().getStackTrace(); for (StackTra ...

  9. 插件式Web框架

    转载构建高性能插件式Web框架 基于MVC插件模式构建支持数据库集群.数据实时同步.数据发布与订阅的Web框架系统.如下图: 1.基于插件式开发 采用插件模式开发的优点是使得系统框架和业务模式有效地进 ...

  10. WPF - Visual调试工具Snoop

    原文:WPF - Visual调试工具Snoop Snoop经过很长一段时间,最近更新到支持NET 3.5了,它是一个WPF运行时对Visual UI调试的一个工具,最近我用过它调试修改过一个bug, ...