Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b7f27b6
feat: SystemVerilog バックエンド実装 (Phase 1-5)
shadowlink0122 Mar 9, 2026
5fe6293
feat: SVテストにiverilog+vvpシミュレーション実行(Stage 3)を統合
shadowlink0122 Mar 9, 2026
d96b096
fix: SVターゲットのMIR最適化スキップと構文修正
shadowlink0122 Mar 9, 2026
6633abf
feat: SV出力に関数名コメント追加と一時変数のインライン展開
shadowlink0122 Mar 9, 2026
8eef222
feat: SVテストにシミュレーション値検証を追加
shadowlink0122 Mar 9, 2026
35692b0
feat: SV構文網羅テストと3つのバグ修正
shadowlink0122 Mar 9, 2026
a0b2098
feat(sv): SV固有型(posedge/negedge/wire/reg)の明示的サポートを追加
shadowlink0122 Mar 9, 2026
116824a
feat(sv): LED点滅回路テスト(led_blinker.cm)を追加
shadowlink0122 Mar 9, 2026
bec8413
feat(sv): 2進数ビットパターン操作テスト(binary_bits.cm)を追加
shadowlink0122 Mar 9, 2026
a0194c1
feat(sv): SV幅付きリテラル(N'd/N'b/N'h)のパーサー対応
shadowlink0122 Mar 9, 2026
b24da0d
fix(sv): SV幅付きリテラルの元ベース形式を保持
shadowlink0122 Mar 9, 2026
f6d3ff3
feat(sv/vscode): SV幅付きリテラル網羅テスト・VSCode拡張修正
shadowlink0122 Mar 9, 2026
8bf177e
feat(test): SVテストの並列実行対応 (make tsvp)
shadowlink0122 Mar 9, 2026
8f9bc00
fix(sv): SVコード生成のインデント修正
shadowlink0122 Mar 9, 2026
5c9de50
opt(sv): インライン展開済み一時変数のlogic宣言を除去
shadowlink0122 Mar 9, 2026
6d5d22f
docs: v0.15.0 SVバックエンド ドキュメント整備
shadowlink0122 Mar 9, 2026
3874f62
chore: v0.15.0 バージョン更新
shadowlink0122 Mar 9, 2026
3eb6a29
docs: PR.mdをv0.15.0に更新
shadowlink0122 Mar 9, 2026
abfb5bb
fix(test): bitwise_ops.expectの期待値を修正
shadowlink0122 Mar 9, 2026
01b4fbc
fix(test): bitwise_ops.expectの期待値を修正 (programs/パスも)
shadowlink0122 Mar 9, 2026
cccb523
fix: PRレビュー指摘7件を修正
shadowlink0122 Mar 9, 2026
1031607
fix: posedge/negedge/wire/regを文脈キーワード化
shadowlink0122 Mar 9, 2026
faf2cf6
refactor: tests/programs削除・CIにiverilogインストール追加
shadowlink0122 Mar 9, 2026
2c38f0f
feat: プラットフォームディレクティブ + レキサーLexerPlatformモード実装
shadowlink0122 Mar 9, 2026
afcbd64
docs: v0.15.0設計ドキュメント5件のステータス更新
shadowlink0122 Mar 9, 2026
7d25508
fix: type_keyword_namespace — キーワードトークンのget_string()空文字問題を修正
shadowlink0122 Mar 9, 2026
9372396
docs: PR.md・v0.15.0リリースノート更新
shadowlink0122 Mar 9, 2026
1d39689
レビュー指摘対応・ビルド高速化・警告解消
shadowlink0122 Mar 9, 2026
708c39e
token.hppに<optional>のincludeを追加(CI環境での間接include不足を修正)
shadowlink0122 Mar 9, 2026
c772dc9
PR.mdとリリースノートを更新(レビュー対応・ビルド高速化・警告解消を反映)
shadowlink0122 Mar 9, 2026
33ad323
CIランナーを最新に更新(ubuntu-latest / macos-15)
shadowlink0122 Mar 9, 2026
95fd810
SVバックエンド品質改善: 三項演算子最適化・パラメータ化モジュール修正・テスト追加
shadowlink0122 Mar 9, 2026
00db0ce
PR.mdとリリースノート最終更新(三項演算子最適化・parameter修正・テスト23件反映)
shadowlink0122 Mar 9, 2026
a0babeb
SV生成コード品質改善: 定数ビット幅推論・else if正規化・冗長除去
shadowlink0122 Mar 9, 2026
4ff1d6c
代入文の定数ビット幅整合: LHS型→RHS定数幅の伝播
shadowlink0122 Mar 9, 2026
cab694a
SVバックエンド: always_ff/always_comb/always_latch キーワード直接サポートと自動判別
shadowlink0122 Mar 10, 2026
f89bb51
SV構文テスト: switch→case, for_loop, FSM, increment テスト追加 (53テスト全PASS)
shadowlink0122 Mar 10, 2026
ab33396
SV構文拡張Phase1: bit[N]型、assign文、inoutサポート追加 (56テスト全PASS)
shadowlink0122 Mar 10, 2026
cccbfe9
SV構文拡張Phase2: enum→typedef enum, struct→struct packed, function→funct…
shadowlink0122 Mar 10, 2026
114e94d
SV連接({a,b})・複製({N{expr}})構文のフルパイプライン実装
shadowlink0122 Mar 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
56 changes: 36 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# ========================================
lint:
name: Lint
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -34,7 +34,7 @@ jobs:
# ========================================
extension-lint:
name: Extension Lint
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
defaults:
run:
working-directory: vscode-extension
Expand Down Expand Up @@ -68,9 +68,9 @@ jobs:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
- os: ubuntu-latest
arch: x86_64
- os: macos-14
- os: macos-15
arch: arm64
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -161,30 +161,30 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14]
os: [ubuntu-latest, macos-15]
include:
- os: ubuntu-22.04
- os: ubuntu-latest
test_name: Lexer
test_bin: lexer_test
- os: macos-14
- os: macos-15
test_name: Lexer
test_bin: lexer_test
- os: ubuntu-22.04
- os: ubuntu-latest
test_name: HIR Lowering
test_bin: hir_lowering_test
- os: macos-14
- os: macos-15
test_name: HIR Lowering
test_bin: hir_lowering_test
- os: ubuntu-22.04
- os: ubuntu-latest
test_name: MIR Lowering
test_bin: mir_lowering_test
- os: macos-14
- os: macos-15
test_name: MIR Lowering
test_bin: mir_lowering_test
- os: ubuntu-22.04
- os: ubuntu-latest
test_name: MIR Optimization
test_bin: mir_optimization_test
- os: macos-14
- os: macos-15
test_name: MIR Optimization
test_bin: mir_optimization_test
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -235,7 +235,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-14]
os: [ubuntu-latest, macos-15]
config:
- { id: jit-o0, name: "JIT実行 O0", target: tjitp0, backend: jit, needs_node: false }
- { id: jit-o3, name: "JIT実行 O3", target: tjitp3, backend: jit, needs_node: false }
Expand All @@ -245,6 +245,7 @@ jobs:
- { id: wasm-o3, name: "WASMコンパイル+実行 O3", target: twp3, backend: llvm-wasm, needs_node: false }
- { id: js-o0, name: "JSコード生成+実行 O0", target: tjp0, backend: js, needs_node: true }
- { id: js-o3, name: "JSコード生成+実行 O3", target: tjp3, backend: js, needs_node: true }
- { id: sv-o3, name: "SV生成テスト O3", target: tsvp3, backend: sv, needs_node: false }
runs-on: ${{ matrix.os }}

steps:
Expand Down Expand Up @@ -292,6 +293,21 @@ jobs:
with:
version: "latest"

- name: Install SV tools (for SV backend tests)
if: matrix.config.backend == 'sv'
id: sv_tools
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
sudo apt-get install -y iverilog
elif [ "$RUNNER_OS" = "macOS" ]; then
if ! brew install icarus-verilog; then
echo "::warning::iverilog installation failed on macOS, SV tests will be skipped"
echo "sv_tools_available=false" >> $GITHUB_OUTPUT
else
echo "sv_tools_available=true" >> $GITHUB_OUTPUT
fi
fi

- name: Run ${{ matrix.config.name }} Tests
id: run_tests
env:
Expand Down Expand Up @@ -345,21 +361,21 @@ jobs:
baremetal-test:
name: Baremetal / UEFI
needs: build
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: cm-build-ubuntu-22.04
name: cm-build-ubuntu-latest

- run: chmod +x cm 2>/dev/null || true

- name: Cache LLVM
uses: actions/cache@v4
with:
path: /usr/lib/llvm-${{ env.LLVM_VERSION }}
key: llvm-${{ env.LLVM_VERSION }}-ubuntu-22.04
key: llvm-${{ env.LLVM_VERSION }}-ubuntu-latest

- name: Install LLVM
run: |
Expand All @@ -382,22 +398,22 @@ jobs:
benchmark:
name: Benchmark
needs: build
runs-on: ubuntu-22.04
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: cm-build-ubuntu-22.04
name: cm-build-ubuntu-latest

- run: chmod +x cm 2>/dev/null || true

- name: Cache LLVM
uses: actions/cache@v4
with:
path: /usr/lib/llvm-${{ env.LLVM_VERSION }}
key: llvm-${{ env.LLVM_VERSION }}-ubuntu-22.04
key: llvm-${{ env.LLVM_VERSION }}-ubuntu-latest

- name: Install LLVM
run: |
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,9 @@ tests/bench_marks/python/*.pyc
cpp_results.txt
rust_results.txt
python_results.txt

# SV生成物(SystemVerilogバックエンド)
output.sv
output_tb.sv
*.vcd
*.vvp
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# ビルド高速化: ccache自動検出
# ccacheがインストールされている場合、コンパイララッパーとして自動使用
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
message(STATUS "ccache found: ${CCACHE_PROGRAM} (ビルドキャッシュ有効)")
else()
message(STATUS "ccache not found (インストール推奨: brew install ccache)")
endif()

# ビルド高速化: Unity build(ソース結合による翻訳単位削減)
# ヘッダのパース回数を大幅削減し、ビルド時間を短縮
set(CMAKE_UNITY_BUILD ON)
set(CMAKE_UNITY_BUILD_BATCH_SIZE 16)
Comment on lines +26 to +27
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unity build をデフォルトで強制ONにすると、プラットフォームやコンパイラ差・ODR/匿名名前空間/マクロ衝突などでビルドが不安定化しやすく、外部開発者の環境でも挙動差が出ることがあります。option(CM_UNITY_BUILD ...) のようにプロジェクトオプション化してデフォルトOFF(またはCIのみON)にする、もしくはUnity除外リストを整備して安全に段階導入するのがおすすめです。

Suggested change
set(CMAKE_UNITY_BUILD ON)
set(CMAKE_UNITY_BUILD_BATCH_SIZE 16)
option(CM_UNITY_BUILD "Enable unity build (experimental; default OFF)" OFF)
if(CM_UNITY_BUILD)
set(CMAKE_UNITY_BUILD ON)
set(CMAKE_UNITY_BUILD_BATCH_SIZE 16)
endif()

Copilot uses AI. Check for mistakes.

# VERSIONファイルからバージョンを読み取り、コンパイル時定数として埋め込む
file(READ "${CMAKE_SOURCE_DIR}/VERSION" CM_VERSION_RAW)
string(STRIP "${CM_VERSION_RAW}" CM_VERSION)
Expand Down Expand Up @@ -290,6 +306,11 @@ list(APPEND CM_SOURCES
src/codegen/js/runtime.cpp
)

# SystemVerilog backend (LLVMに依存しない)
list(APPEND CM_SOURCES
src/codegen/sv/codegen.cpp
)

# Add LLVM sources if enabled
if(CM_USE_LLVM)
list(APPEND CM_SOURCES
Expand Down Expand Up @@ -327,10 +348,14 @@ if(CM_USE_LLVM)
)

# Apple環境: GPU(Metal)バッキング実装を追加
# Objective-C++はUnity buildから除外(C++と結合不可)
if(APPLE)
list(APPEND CM_SOURCES
libs/native/gpu/gpu_runtime.mm
)
set_source_files_properties(libs/native/gpu/gpu_runtime.mm
PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON
)
endif()
endif()

Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,9 @@ clean:
@find . -name "*.o" -not -path "./build/*" -not -path "./.git/*" -delete 2>/dev/null || true
@find . -name "*.EFI" -not -path "./.git/*" -delete 2>/dev/null || true
@find . -name "*.lib" -not -path "./build/*" -not -path "./.git/*" -delete 2>/dev/null || true
@find . -maxdepth 1 -name "*.sv" -delete 2>/dev/null || true
@find . -maxdepth 1 -name "*.vcd" -delete 2>/dev/null || true
@find . -maxdepth 1 -name "*.vvp" -delete 2>/dev/null || true
@echo "✅ Clean complete!"

.PHONY: rebuild
Expand Down Expand Up @@ -416,6 +419,11 @@ $(eval $(call BACKEND_DEFAULT_TARGETS,js,JavaScript))
$(foreach o,0 1 2 3,$(eval $(call BACKEND_OPT_TARGETS,js,JavaScript,$(o))))
$(eval $(call BACKEND_ALL_OPTS_TARGET,js,JavaScript))

# --- sv (SystemVerilog) ---
$(eval $(call BACKEND_DEFAULT_TARGETS,sv,SystemVerilog))
$(foreach o,0 1 2 3,$(eval $(call BACKEND_OPT_TARGETS,sv,SystemVerilog,$(o))))
$(eval $(call BACKEND_ALL_OPTS_TARGET,sv,SystemVerilog))

# ========================================
# UEFI / Baremetal Test Commands
# ========================================
Expand Down Expand Up @@ -636,6 +644,7 @@ $(eval $(call SHORTCUT_TEMPLATE,tjit,jit))
$(eval $(call SHORTCUT_TEMPLATE,tl,llvm))
$(eval $(call SHORTCUT_TEMPLATE,tw,llvm-wasm))
$(eval $(call SHORTCUT_TEMPLATE,tj,js))
$(eval $(call SHORTCUT_TEMPLATE,tsv,sv))

# LLVM集約ショートカット
.PHONY: tla
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.14.2
0.15.1
Loading
Loading