Minesweeper(マインスイーパー) Verilog HDL実装

DAシンポジウム アルゴリズムデザインコンテスト課題


1. 概要

本プロジェクトは、クラシックゲーム「マインスイーパー」をVerilog HDLで実装したものです。

開発・シミュレーション環境は以下を使用しています:


2. プロジェクト構成

2.1 top.v — トップモジュール

全コンポーネントを接続するトップモジュールです。

各モジュール間の信号を制御し、盤面情報を出力します。


2.2 board.v — 盤面管理モジュール


2.3 counter.v — セルカウンタモジュール


2.4 solver.v — セル選択モジュール


2.5 testbench.v — シミュレーション用テストベンチ


3. シミュレーション手順

3.1 コンパイル

$ iverilog -o minesweeper_sim top.v board.v counter.v solver.v testbench.v

3.2 シミュレーション実行

$ vvp minesweeper_sim

3.3 波形表示(任意)

$ gtkwave wave.vcd

4. ファイル一覧

ファイル名 説明
top.v トップモジュール
board.v 盤面管理モジュール
counter.v 開いたセル・地雷カウンタ
solver.v 自動解答モジュール
testbench.v シミュレーション用テストベンチ
board.txt 盤面データ(セルの内容)
board_size.txt 盤面サイズ(行数・列数)
wave.vcd 波形データ(シミュレーション出力)

5. 補足



Minesweeper in Verilog HDL

A project for the Algorithm Design Contest, DA Symposium


1. Overview

This project implements the classic Minesweeper game using Verilog HDL, designed to run in an FPGA-friendly, synthesizable environment.

All components are verified via simulation using:


2. Project Structure

2.1 top.v — Top Module

This is the main module that connects all subsystems:

It manages global signal routing and outputs the board state for visualization or testing.


2.2 board.v — Board Management

Responsible for:


2.3 counter.v — Open/Bomb Counter

Monitors the board state (current_board) and:


2.4 solver.v — Cell Selector

Implements a simple algorithm to automatically select cells to open:


2.5 testbench.v — Simulation Testbench

Stimulates the system under test:


3. Simulation Instructions

3.1 Compile

$ iverilog -o minesweeper_sim top.v board.v counter.v solver.v testbench.v

3.2 Run Simulation

$ vvp minesweeper_sim

3.3 View Waveform (Optional)

$ gtkwave wave.vcd

4. File List

File Description
top.v Top-level system module
board.v Minesweeper board manager
counter.v Opened/bomb cell counter
solver.v Automatic solver logic
testbench.v Simulation testbench
board.txt Board layout (cell values)
board_size.txt Board size (rows and columns)
wave.vcd Simulation waveform (generated)

5. Notes