From f86bda7b50368c8c4b80bcc1f3bc35a5f87437bb Mon Sep 17 00:00:00 2001 From: bLueriVerLHR Date: Thu, 11 May 2023 12:33:10 +0800 Subject: [PATCH] [Init] initialize repo --- .gitignore | 1 + CMakeLists.txt | 26 ++++++++++++++++++++++++++ README.md | 1 + cxxsrc/main.cc | 3 +++ cxxsrc/spec.cc | 0 cxxsrc/spec.hh | 0 vsrc/top.v | 6 ++++++ 7 files changed, 37 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 cxxsrc/main.cc create mode 100644 cxxsrc/spec.cc create mode 100644 cxxsrc/spec.hh create mode 100644 vsrc/top.v diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d163863 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e3ace04 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.12) +cmake_policy(SET CMP0074 NEW) +project(lacpu) + +# set environment variables for verilator +# remove if already install one +set(verilator_DIR "/home/blur/gits/verilator") +set(ENV{VERILATOR_ROOT} ${verilator_DIR}) + +find_package(verilator) + +if (NOT verilator_FOUND) + message(FATAL_ERROR "Verilator was not found.") +endif() + +# set default top module as top file +set(VSRC ${CMAKE_SOURCE_DIR}/vsrc/top.v) + +# get all cxx source files from cxxsrc +file(GLOB_RECURSE CXXSRC ${CMAKE_SOURCE_DIR}/cxxsrc/*.cc) + +add_executable(${CMAKE_PROJECT_NAME} ${CXXSRC}) + +verilate(${CMAKE_PROJECT_NAME} + INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/vsrc ${verilator_DIR}/include + SOURCES ${VSRC}) \ No newline at end of file diff --git a/README.md b/README.md index fa062c4..76ff027 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # neulacpu + loongarch cpu development repo diff --git a/cxxsrc/main.cc b/cxxsrc/main.cc new file mode 100644 index 0000000..e9cdae1 --- /dev/null +++ b/cxxsrc/main.cc @@ -0,0 +1,3 @@ +int main() { + return 0; +} \ No newline at end of file diff --git a/cxxsrc/spec.cc b/cxxsrc/spec.cc new file mode 100644 index 0000000..e69de29 diff --git a/cxxsrc/spec.hh b/cxxsrc/spec.hh new file mode 100644 index 0000000..e69de29 diff --git a/vsrc/top.v b/vsrc/top.v new file mode 100644 index 0000000..c74fa1f --- /dev/null +++ b/vsrc/top.v @@ -0,0 +1,6 @@ +module top ( + input wire i_x, + output wire o_y +); + assign o_y = i_x; +endmodule \ No newline at end of file