VS2012下systemC配置
一、编译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配置的更多相关文章
- VLFeat图像库在VS2012下的配置
近期做课题所需,開始使用VLFeat图像库. 库下载链接: http://download.csdn.net/detail/sunboyiris/7500097 ...
- Windows7+VS2012下OpenGL 4的环境配置
系统环境 Windows 7 Ultimate x64,Visual Studio Ultimate 2012 Update 4,和一块支持OpenGL 4.x的显卡. 准备工作 首先用GPU Cap ...
- Win10下IIS配置图解、MVC项目发布图解、IIS添加网站图解
Win10下IIS配置 .找到控制面板:[开始]菜单鼠标右击,打开[控制面板] .打开控制面板,点击[程序],点击[启用或关闭Windows功能] 下一步,点击[启用虎关闭Windows功能] . 开 ...
- 基于OpenCV做“三维重建”(0)-- OpenCV3.2+VIZ6.3.0在vs2012下的编译和使用
一.问题提出 ViZ对于显示3维的效果图来说,非常有帮助:我在使用OpenCV进行双目测距的过程中,有一些参数希望能够通过可视化的方法显示出来,所以参考了这方面相关的资料.做了一些实验 ...
- 二维码解码器Zbar+VS2012开发环境配置
Zbar条码解码器是一个开源的二维码(包括条形码)解码器,可以识别来至于视频流,图像文件.手持扫码器和视频设备(如摄像头)等二维码识别,支持EAN-13/UPC-A, UPC-E, EAN-8, Co ...
- vs2012下 error4996
原文链接:http://blog.csdn.net/xidianzhimeng/article/details/11457045 分类: VS使用学习 2013-09-09 08:37 24人阅读 评 ...
- ASP.NET Aries 入门开发教程4:查询区的下拉配置
背景: 今天去深圳溜达了一天,刚回来,看到首页都是微软大法好,看来离.NET的春天就差3个月了~~ 回到正题,这篇的教程讲解下拉配置. 查询区的下拉配置: 1:查询框怎么配置成下拉? 在配置表头:格式 ...
- Windows下Nginx配置SSL实现Https访问(包含证书生成)
Vincent.李 Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...
- window下xampp配置多端口、多站点步骤
好些日子没整理知识了,许多新东西不整理出来时间一长就淡忘了.看来以后得继续坚持整理. 配置XAMPP多端口.多站点如下步骤: 多端口: (一个域名下同时配置多个端口,从而达到访问不同程序) 效果例如: ...
随机推荐
- Android Push Notifications using Google Cloud Messaging (GCM), PHP and MySQL
http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php- ...
- [ZZ] python 语言技巧
http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html 感谢原作者 30 Pyt ...
- AFNetWorking POST Multi-Part Request 上传图片
这些天来,做图片上传的时候,我遇到一个问题.对我来说,这只是一个附加的图片将请求超时,这里是代码: AFHTTPRequestOperationManager *manager = [AFHTTPRe ...
- DevExpress.XtraReports.UI.XtraReport 动态报表
原文:DevExpress.XtraReports.UI.XtraReport 动态报表 using System;using System.Collections.Generic;using Sys ...
- 1023 Train Problem II(卡特兰数)
Problem Description As we all know the Train Problem I, the boss of the Ignatius Train Station want ...
- printf 对齐
printf关于对其的问题(参考有关博客加上自己的一些总结) 1.关于左对齐或右对齐问题, 默认的如果%后没有“-”是右对齐的,如果%后跟“0”,不足的个数用0来填充, 例如:printf(&qu ...
- ASP.NET MVC+EF框架+EasyUI实现权限管理系列(10)- VSS源代码管理
原文:ASP.NET MVC+EF框架+EasyUI实现权限管理系列(10)- VSS源代码管理 ASP.NET MVC+EF框架+EasyUI实现权限管系列 (开篇) (1):框架搭建 ( ...
- SlidingMenu 左侧滑动菜单
1.MainActivity package loveworld.slidingmenu; import java.util.ArrayList; import android.app.Activit ...
- C# -- 把json字符串转为对象并读取各属性的值
前面2种方法是不需要声明一个Json字符串的类型即可把Json字符串转换为Dictionary对象 而第3种方法则是声明一个Json字符串的强类型对象,然后反序列化为该对象的数据. List<, ...
- python_在windows下安装配置python开发环境及Ulipad开发工具
最近开始学习Python,在网上寻找一下比较好的IDE.因为以前用C#做开发的,用Visual Studio作为IDE,鉴于用惯了VS这么强大的IDE,所以对IDE有一定的依赖性. Python的ID ...