提交 e77f64f8 编写于 作者: 饶先宏's avatar 饶先宏

202108141611

上级 045b9e7a
......@@ -8,7 +8,6 @@ add_subdirectory ("terris")
add_subdirectory ("digitled")
add_subdirectory ("testbignumber")
add_subdirectory ("hdl4secnn")
add_subdirectory ("systemctest")
add_subdirectory ("testmacro")
add_subdirectory ("testvariable")
\ No newline at end of file
......@@ -181,6 +181,6 @@ add_executable(googlenet
include_directories("../../../hdl4seutils/include")
include_directories("../cnn/include")
target_link_libraries(googlenet cnn hdl4seutils)
target_link_libraries(googlenet cnn hdl4seutils m)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
\ No newline at end of file
......@@ -40,7 +40,7 @@
#include "time.h"
#include "cnn.h"
#include "threadlock.h"
#include "windows.h"
#include "keyboard.txt"
......
......@@ -8,7 +8,15 @@ add_executable (googlenetsim
"main.c"
)
target_link_libraries(googlenetsim cnncell hdl4sesim hdl4secell bignumber hdl4seutils verilog_preprocess verilog_parser lcom)
target_link_libraries(googlenetsim cnncell hdl4sesim hdl4secell bignumber hdl4seutils verilog_preprocess verilog_parser lcom m pthread)
FIND_PACKAGE( OpenMP REQUIRED)
if(OPENMP_FOUND)
message("OPENMP FOUND")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
include_directories("../../../../../lcom/include")
include_directories("../../../../hdl4secell/include")
......@@ -16,4 +24,4 @@ include_directories("../../../../hdl4sesim/include")
include_directories("../../../../hdl4seutils/include")
include_directories("../../../../parser")
include_directories("../../../../bignumber/include")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
\ No newline at end of file
add_definitions(-D_CRT_SECURE_NO_WARNINGS -fopenmp)
\ No newline at end of file
# CMakeList.txt: 顶层 CMake 项目文件,在此处执行全局配置
# 并包含子项目。
#
cmake_minimum_required (VERSION 3.8)
add_executable (systemctest
"main.cpp"
)
target_link_libraries(systemctest SystemC::systemc)
include_directories("../../../systemc/src")
#include "systemc.h"
SC_MODULE(half_adder) {
sc_in <bool>a, b;
sc_out <bool> sum, carry;
void prc_half_adder();
SC_CTOR(half_adder) {
SC_METHOD(prc_half_adder);
sensitive << a << b;
}
};
void half_adder::prc_half_adder() {
sum = a ^ b;
carry = a & b;
}
SC_MODULE(full_adder) {
sc_in <bool> a, b, carry_in;
sc_out<bool> sum, carry_out;
sc_signal<bool> c1, s1, c2;
void prc_or();
half_adder* ha1_ptr, * ha2_ptr;
SC_CTOR(full_adder) {
ha1_ptr = new half_adder("ha1");
/*端口连接,命名方式连接*/
ha1_ptr->a(a);
ha1_ptr->b(b);
ha1_ptr->sum(s1);
ha1_ptr->carry(c1);
ha2_ptr = new half_adder("ha2");
/*端口连接,位置方式连接*/
(*ha2_ptr)(s1, carry_in, sum, c2);
SC_METHOD(prc_or);
sensitive<<c1<<c2;
}
~full_adder() {
delete ha1_ptr;
delete ha2_ptr;
}
};
void full_adder::prc_or() {
carry_out = c1 | c2;
}
SC_MODULE(driver) {
sc_out<bool> clk, d_a, d_b, d_cin;
void prc_driver();
SC_CTOR(driver) {
SC_THREAD(prc_driver);
}
};
void driver::prc_driver() {
sc_uint <3> pattern;
pattern = 0;
while (1) {
d_a = pattern[0];
d_b = pattern[1];
d_cin = pattern[2];
clk = 0;
wait(5, SC_NS);
clk = 1;
wait(5, SC_NS);
pattern++;
}
}
SC_MODULE(monitor) {
sc_in<bool> clk, m_a, m_b, m_cin, m_sum, m_cout;
void prc_monitor();
SC_CTOR(monitor) {
SC_METHOD(prc_monitor);
//sensitive << m_a << m_b << m_cin << m_sum << m_cout;
sensitive_pos << clk;
}
};
void monitor::prc_monitor() {
cout << "At time" << sc_time_stamp() << "::";
cout << "(a, b, carry_in):";
cout << m_a << m_b << m_cin;
cout << "(sum, carry_out): " << m_sum << m_cout << endl;
}
int sc_main(int argc, char* argv[]) {
sc_signal <bool> t_a, t_b, t_cin, t_sum, t_cout, clk;
//加法器
full_adder adderobj("FullAdder");
adderobj(t_a, t_b, t_cin, t_sum, t_cout);
//驱动器
driver driverobj("drider");
driverobj(clk, t_a, t_b, t_cin);
//记录仪
monitor monitorobj("monitor");
monitorobj(clk, t_a, t_b, t_cin, t_sum, t_cout);
//开始仿真,持续100ns
sc_start(100, SC_NS);
return (0);
}
......@@ -39,11 +39,13 @@
#include "stdio.h"
#include "string.h"
#include "object.h"
#include "dlist.h"
#include "stdarg.h"
#include "bignumber.h"
#include "hdl4secell.h"
#include "pointerarray.h"
#define max(x, y) (((x)>(y))?(x):(y))
#define HDL4SE_DEBUG 0
static void hdl4seUpdateVariableNone(ModuleVariable* var)
......
......@@ -47,8 +47,6 @@
#include "hdl4secell.h"
#include "threadlock.h"
#include "windows.h"
#define IMPLEMENT_GUID
#include "hdl4sesim.h"
#undef IMPLEMENT_GUID
......@@ -243,7 +241,7 @@ static int hdl4sesim_hdl4se_simulator_SetReset(HOBJECT object, int reset)
return 0;
}
#define THREADCOUNT 8
#define THREADCOUNT 4
static int hdl4sesim_hdl4se_simulator_ClkTick(HOBJECT object)
{
......
......@@ -44,6 +44,8 @@ extern "C" {
#ifndef _ASMLANGUAGE
#include "string.h"
typedef void* THREADLOCK;
THREADLOCK threadlockCreate();
......
......@@ -117,7 +117,6 @@ THREADLOCK threadlockCreate()
pSection = (ThreadLock*)mt_malloc(sizeof(ThreadLock));
if (pSection != NULL) {
pthread_mutexattr_t attr;
pSection->mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
pthread_mutex_init(&pSection->mutex, &attr);
......
......@@ -53,6 +53,8 @@
#include "verilog_expr.h"
#undef IMPLEMENT_GUID
#define max(x, y) (((x) > (y)) ? (x) : (y))
typedef struct _sExpr {
OBJECT_HEADER
INTERFACE_DECLARE(IVerilogNode)
......
此差异已折叠。
......@@ -35,8 +35,8 @@
especially those whose name start with YY_ or yy_. They are
private implementation details that can be changed or removed. */
#ifndef YY_YY_D_GITWORK_HDL4SE_PARSER_VERILOG_PARSER_H_INCLUDED
# define YY_YY_D_GITWORK_HDL4SE_PARSER_VERILOG_PARSER_H_INCLUDED
#ifndef YY_YY_MEDIA_RAOXIANHONG_DDE_DATA_GITWORK_HDL4SE_PARSER_VERILOG_PARSER_H_INCLUDED
# define YY_YY_MEDIA_RAOXIANHONG_DDE_DATA_GITWORK_HDL4SE_PARSER_VERILOG_PARSER_H_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 1
......@@ -45,7 +45,7 @@
extern int yydebug;
#endif
/* "%code requires" blocks. */
#line 81 "D:/gitwork/hdl4se/parser/verilog_parser.y"
#line 81 "/media/raoxianhong/_dde_data/gitwork/hdl4se/parser/verilog_parser.y"
#include "stdio.h"
#include "object.h"
......@@ -68,7 +68,7 @@ extern int yydebug;
#include "verilog_assignment.h"
#include "verilog_statement.h"
#line 72 "D:/gitwork/hdl4se/parser/verilog_parser.h"
#line 72 "/media/raoxianhong/_dde_data/gitwork/hdl4se/parser/verilog_parser.h"
/* Token kinds. */
#ifndef YYTOKENTYPE
......@@ -271,7 +271,7 @@ extern int yydebug;
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 105 "D:/gitwork/hdl4se/parser/verilog_parser.y"
#line 105 "/media/raoxianhong/_dde_data/gitwork/hdl4se/parser/verilog_parser.y"
HOBJECT treenode;
HOBJECT obj;
......@@ -290,7 +290,7 @@ union YYSTYPE
int ival;
IDListVar* list;
#line 294 "D:/gitwork/hdl4se/parser/verilog_parser.h"
#line 294 "/media/raoxianhong/_dde_data/gitwork/hdl4se/parser/verilog_parser.h"
};
typedef union YYSTYPE YYSTYPE;
......@@ -303,4 +303,4 @@ extern YYSTYPE yylval;
int yyparse (void);
#endif /* !YY_YY_D_GITWORK_HDL4SE_PARSER_VERILOG_PARSER_H_INCLUDED */
#endif /* !YY_YY_MEDIA_RAOXIANHONG_DDE_DATA_GITWORK_HDL4SE_PARSER_VERILOG_PARSER_H_INCLUDED */
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册