diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..e7b7e8911468731505dab1345b8098402b99f4a8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -33,3 +33,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text *tfevents* filter=lfs diff=lfs merge=lfs -text +tasks/task1/sim_build/Vtop filter=lfs diff=lfs merge=lfs -text +tasks/task1/sim_build/verilated.o filter=lfs diff=lfs merge=lfs -text +tasks/task1/sim_build/verilated_vpi.o filter=lfs diff=lfs merge=lfs -text +tasks/task3/sim_build/Vtop filter=lfs diff=lfs merge=lfs -text +tasks/task3/sim_build/verilated.o filter=lfs diff=lfs merge=lfs -text +tasks/task3/sim_build/verilated_vpi.o filter=lfs diff=lfs merge=lfs -text diff --git a/Dockerfile b/Dockerfile index 23b5497944683a929f588cf8f14966efe3660513..5bcb1b7539562e48011b9d77448b969321e3dd10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,11 +16,24 @@ FROM ${BASE_IMAGE} AS builder WORKDIR /app # Ensure git, iverilog, and make are available -ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ - apt-get install -y --no-install-recommends git iverilog make && \ + apt-get install -y --no-install-recommends \ + git make autoconf g++ flex bison help2man \ + libfl-dev zlib1g-dev python3 \ + iverilog && \ rm -rf /var/lib/apt/lists/* +# Install Verilator (required version) +RUN git clone https://github.com/verilator/verilator && \ + cd verilator && \ + git checkout v5.036 && \ + autoconf && \ + ./configure && \ + make -j$(nproc) && \ + make install && \ + cd .. && \ + rm -rf verilator + # Build argument to control whether we're building standalone or in-repo ARG BUILD_MODE=in-repo ARG ENV_NAME=rtl_debugger @@ -61,7 +74,9 @@ FROM ${BASE_IMAGE} # Install runtime dependencies (iverilog and make) ARG DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ - apt-get install -y --no-install-recommends iverilog make && \ + apt-get install -y --no-install-recommends \ + git make \ + iverilog && \ rm -rf /var/lib/apt/lists/* WORKDIR /app @@ -72,6 +87,8 @@ COPY --from=builder /app/env/.venv /app/.venv # Copy the environment code COPY --from=builder /app/env /app/env +COPY --from=builder /usr/local/bin/verilator /usr/local/bin/verilator +COPY --from=builder /usr/local/share/verilator /usr/local/share/verilator # Set PATH to use the virtual environment ENV PATH="/app/.venv/bin:$PATH" @@ -82,8 +99,8 @@ ENV ENABLE_WEB_INTERFACE=true # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD curl -f http://localhost:8000/health || exit 1 + CMD curl -f http://localhost:7860/health || exit 1 # Run the FastAPI server # The module path is constructed to work with the /app/env structure -CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000"] +CMD ["sh", "-c", "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 7860"] diff --git a/README.md b/README.md index 13b23b54e9e9407b246195afa164e6918ec623d4..9ffa2f7cf462898ff4caaf251e8490c72ba90a36 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ colorFrom: blue colorTo: green sdk: docker pinned: false -app_port: 8000 +app_port: 7860 base_path: /web tags: - openenv @@ -16,7 +16,16 @@ tags: # RTL Debugger Environment -The **RTL Debugger** is a Reinforcement Learning environment designed for automated hardware design fixing. It enables LLM-based agents to iteratively debug Verilog code. +The **RTL Debugger** is a Reinforcement Learning environment designed for automated hardware design fixing. It enables LLM-based agents to iteratively debug Verilog code through high-fidelity simulation feedback. + +## 🚀 Motivation +Hardware debugging is a high-cost, iterative process. While LLMs are proficient at syntax-level code generation, fixing semantic bugs in RTL (Register Transfer Level) designs requires a deep understanding of timing, cycle-by-cycle logic, and state transitions. This environment provides a standardized sandbox for training and evaluating agents capable of interprets complex simulation logs and autonomously resolving hardware logic flaws. + +## 🛠️ Environment Description +The RTL Debugger is an OpenEnv-compliant environment that wraps industry-standard hardware tools: +- **Simulation Engines**: Supports both **Icarus Verilog** and **Verilator** for fast, cycle-accurate simulation. +- **Feedback Loop**: For every submitted design, the environment provides a detailed diagnostic report, including compilation errors, failed test cycles, and FSM transition mismatches. +- **Iterative Debugging**: Agents can build upon their previous attempts, utilizing line-based edit distance (Levenshtein) and pass-rate progress to guide their refinement. ## Quick Start @@ -30,9 +39,9 @@ docker build -t rtl_debugger-env:latest . ### 2. Launch the Environment Server ```bash -docker run -p 8000:8000 --rm rtl_debugger-env:latest +docker run -p 7860:7860 --rm rtl_debugger-env:latest ``` -Access the interactive web-playground at: [http://localhost:8000/web](http://localhost:8000/web) +Access the interactive web-playground at: [http://localhost:7860/web](http://localhost:7860/web) ### 3. Run the Inference Agent We provide a reference inference script that uses LLM to play the environment: @@ -48,20 +57,31 @@ uv run python inference.py ## Environment Details -### Action Model (`RtlDebuggerAction`) -Agents submit their corrected Verilog module: -- `fixed_code` (str): The full Verilog module source. +### Action Space (`RtlDebuggerAction`) +The action space is **unstructured text** representing the revised hardware design: +- `fixed_code` (str): The full Verilog module source intended to replace the current `design_active.v`. + +### Observation Space: `RtlDebuggerObservation` +Agents receive a rich observation after every edit, containing both raw technical feedback and normalized metrics: -### Observation: `RtlDebuggerObservation` | Field | Type | Description | | :--- | :--- | :--- | -| `task_id` | `str` | Name of the selected task (e.g., `task0`). | -| `feedback` | `str` | Combined compiler errors and testbench results. | -| `pass_rate` | `float` | Percent of testcases passed [0.0 - 1.0]. | -| `progress_ratio` | `float` | Percent of simulation sequence completed before the first failure. | -| `compiled` | `bool` | Whether the Verilog code is syntactically valid. | -| `lev_distance` | `int` | Number of modified lines compared to the previous attempt. | -| `score` | `float` | Final normalized grader score [0.0 - 1.0]. | +| `task_id` | `str` | Name of the selected task (e.g., `task1`). | +| `feedback` | `str` | Human-readable diagnostics: compiler logs or a cycle-by-cycle breakdown of test failures. | +| `pass_rate` | `float` | Continuous metric [0.0 - 1.0] representing the percentage of test cases passed. | +| `progress_ratio` | `float` | Percent of the test sequence completed before the first failure (measures sequential depth). | +| `compiled` | `bool` | Boolean flag indicating if the Verilog code is syntactically valid and compilation succeeded. | +| `lev_distance` | `int` | Line-based edit distance from the *previous* attempt, encouraging minimal, targeted fixes. | +| `score` | `float` | The final grading metric [0.0 - 1.0]. High scores reward both correctness and minimal steps. | + +## 🎯 Tasks and Difficulty +The environment features curated hardware modules designed to test specific debugging capabilities: + +| Task Tier | Name | Description | Grading Focus | +| :--- | :--- | :--- | :--- | +| **Easy** | Task 1 | Syntax & Compilation: Fixing basic wiring or keyword errors. | Compilation OK, Step Count | +| **Medium** | Task 2 | Combinational Logic: Fixing XOR maps, Decoders, or Binary-to-Gray logic. | Test Case Pass Rate | +| **Hard** | Task 3 | Sequential Logic: Debugging FSMs (e.g., Moore/Mealy sequence detectors). | Transition Accuracy, Reset Logic | --- diff --git a/client.py b/client.py index 1ce879e7641b68aeb08478f2c99c3bd6c5e74e08..4ec0c604d7bdd9daf2a81b3744ae4c27e20c773b 100644 --- a/client.py +++ b/client.py @@ -30,7 +30,7 @@ class RtlDebuggerEnv( Example: >>> # Connect to a running server - >>> with RtlDebuggerEnv(base_url="http://localhost:8000") as client: + >>> with RtlDebuggerEnv(base_url="http://localhost:7860") as client: ... result = client.reset() ... print(result.observation.echoed_message) ... diff --git a/inference.py b/inference.py index 121e6258d4f97a216e4104bb1d405e27a7de2d46..f6ca216fb5b0dcc6aaaedb0419acfb2da40de5b6 100644 --- a/inference.py +++ b/inference.py @@ -36,30 +36,30 @@ except ImportError: from models import RtlDebuggerAction # type: ignore # --- Configuration ------------------------------------------------------------- -OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") -GEMINI_API_KEY = os.getenv("GEMINI_API_KEY") -HF_TOKEN = os.getenv("HF_TOKEN") - -if OPENAI_API_KEY: - # Use OpenAI directly - API_BASE_URL = os.getenv("API_BASE_URL") # use default (None) for OpenAI - API_KEY = OPENAI_API_KEY - MODEL_NAME = "gpt-4o" -elif GEMINI_API_KEY: - # Set defaults for Gemini (which uses an OpenAI-compatible endpoint) - API_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/" - API_KEY = GEMINI_API_KEY - MODEL_NAME = "gemini-2.5-flash" -else: - # Fall back to Hugging Face router - API_BASE_URL = "https://router.huggingface.co/v1" - API_KEY = HF_TOKEN or os.getenv("API_KEY") - MODEL_NAME = os.getenv("MODEL_NAME") or "Qwen/Qwen2.5-72B-Instruct:novita" - - -# API_BASE_URL = os.getenv("API_BASE_URL") or "https://router.huggingface.co/v1" -# API_KEY = os.getenv("API_KEY") or os.getenv("HF_TOKEN") -# MODEL_NAME = os.getenv("MODEL_NAME") or "Qwen/Qwen2.5-72B-Instruct:novita" +# OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") +# GEMINI_API_KEY = os.getenv("GEMINI_API_KEY") +# HF_TOKEN = os.getenv("HF_TOKEN") + +# if OPENAI_API_KEY: +# # Use OpenAI directly +# API_BASE_URL = os.getenv("API_BASE_URL") # use default (None) for OpenAI +# API_KEY = OPENAI_API_KEY +# MODEL_NAME = "gpt-4o" +# elif GEMINI_API_KEY: +# # Set defaults for Gemini (which uses an OpenAI-compatible endpoint) +# API_BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/" +# API_KEY = GEMINI_API_KEY +# MODEL_NAME = "gemini-2.5-flash" +# else: +# # Fall back to Hugging Face router +# API_BASE_URL = "https://router.huggingface.co/v1" +# API_KEY = HF_TOKEN or os.getenv("API_KEY") +# MODEL_NAME = os.getenv("MODEL_NAME") or "Qwen/Qwen2.5-72B-Instruct:novita" + + +API_BASE_URL = os.getenv("API_BASE_URL") or "https://router.huggingface.co/v1" +API_KEY = os.getenv("API_KEY") or os.getenv("HF_TOKEN") +MODEL_NAME = os.getenv("MODEL_NAME") or "Qwen/Qwen2.5-72B-Instruct:novita" TASK_NAME = os.getenv("RTL_DEBUGGER_TASK_NAME", "unknown-task") IMAGE_NAME = os.getenv("LOCAL_IMAGE_NAME") @@ -70,7 +70,7 @@ MAX_TOKENS = 8192 SUCCESS_SCORE_THRESHOLD = 0.1 -ENV_BASE_URL = os.getenv("ENV_BASE_URL ", "http://localhost:8000") +ENV_BASE_URL = os.getenv("ENV_BASE_URL", "http://localhost:7860") # --- Prompts ------------------------------------------------------------------- diff --git a/openenv.yaml b/openenv.yaml index fe1e6a537bab51651ab5d255a31da6054199b1a9..642283a18e07da15422c7e487ac0575ff26525f5 100644 --- a/openenv.yaml +++ b/openenv.yaml @@ -3,23 +3,23 @@ name: RTL Code Debugging Environment type: space runtime: fastapi app: server.app:app -port: 8000 +port: 7860 tasks: - id: task1 description: "Easy — syntax/compilation errors" difficulty: easy max_steps: 10 - grader: server.graders:RtlGrader + grader: server.graders:Task1Grader - id: task2 description: "Medium — logic errors in combinational circuit" difficulty: medium max_steps: 10 - grader: server.graders:RtlGrader + grader: server.graders:Task2Grader - id: task3 description: "Hard — logic errors in sequential circuit" difficulty: hard max_steps: 10 - grader: server.graders:RtlGrader + grader: server.graders:Task3Grader constraints: max_runtime_seconds: 1200 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..9a71ca37d518e2d41f2ceda3cdeeaa8d782bb2f6 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,12 @@ +cocotb>=2.0.1 +fastapi>=0.135.2 +openai>=2.30.0 +openenv-core[core]>=0.2.3 +pydantic>=2.12.5 +uvicorn>=0.42.0 +python-dotenv + +# System dependencies (installed in Docker but listed here for context): +# iverilog +# make +# verilator (v5.036) diff --git a/server/app.py b/server/app.py index b72635433536c8a0aab9151a0d6a12b2ef60b267..2ec3c428416492a43f2a7782ec280087eba3a063 100644 --- a/server/app.py +++ b/server/app.py @@ -19,10 +19,10 @@ Endpoints: Usage: # Development (with auto-reload): - uvicorn server.app:app --reload --host 0.0.0.0 --port 8000 + uvicorn server.app:app --reload --host 0.0.0.0 --port 7860 # Production: - uvicorn server.app:app --host 0.0.0.0 --port 8000 --workers 4 + uvicorn server.app:app --host 0.0.0.0 --port 7860 --workers 4 # Or run directly: python -m server.app @@ -69,11 +69,11 @@ app = create_app( RtlDebuggerAction, RtlDebuggerObservation, env_name="rtl_debugger", - max_concurrent_envs=1, # increase this number to allow more concurrent WebSocket sessions + max_concurrent_envs=10, # increase this number to allow more concurrent WebSocket sessions ) -def main(host: str = "0.0.0.0", port: int = 8000): +def main(host: str = "0.0.0.0", port: int = 7860): """ Entry point for direct execution via uv run or python -m. @@ -84,7 +84,7 @@ def main(host: str = "0.0.0.0", port: int = 8000): Args: host: Host address to bind to (default: "0.0.0.0") - port: Port number to listen on (default: 8000) + port: Port number to listen on (default: 7860) For production deployments, consider using uvicorn directly with multiple workers: diff --git a/server/graders.py b/server/graders.py index 87d5a36b36da5af05c69d71d38db648f022445fe..514544d518aca131874d7e847ff8418f1198da2e 100644 --- a/server/graders.py +++ b/server/graders.py @@ -2,20 +2,46 @@ import json import os from openenv.core.env_server.types import State -class RtlGrader: +class Task1Grader: """ - External Grader for the RTL Debugger Environment. - Evaluates the final state of the environment after the episode finishes. + Grader for Task 1 (Syntax/Compilation Errors). + Evaluates based on: + - Linting and Compilation passed. + - Number of steps needed. """ - + def __init__(self, max_steps: int = 10): + self.max_steps = max_steps + def __call__(self, state: State, env: "RtlDebuggerEnvironment") -> float: - """ - OpenEnv interface for grading. - Reads the final result.json from the active task directory and computes the score. - """ result_path = os.path.join(env._task_dir, "result.json") + if not os.path.exists(result_path): + return 0.01 + + try: + with open(result_path, "r") as f: + result_json = json.load(f) + except json.JSONDecodeError: + return 0.01 + + step_efficiency = (state.step_count / self.max_steps) + score = 1.0 - step_efficiency - # If no result.json exists, the simulation crashed or failed to compile + + return max(0.01, min(0.99, score)) + + +class Task2Grader: + """ + Grader for Task 2 (Combinational Logic). + Evaluates based on: + - Number of test cases passed. + - Number of steps needed. + """ + def __init__(self, max_steps: int = 10): + self.max_steps = max_steps + + def __call__(self, state: State, env: "RtlDebuggerEnvironment") -> float: + result_path = os.path.join(env._task_dir, "result.json") if not os.path.exists(result_path): return 0.01 @@ -25,20 +51,78 @@ class RtlGrader: except json.JSONDecodeError: return 0.01 - num_tests = result_json.get("num_tests", 1) num_passed = result_json.get("num_passed", 0) + num_tests = result_json.get("num_tests", 1) passed_all = result_json.get("passed", False) - - pass_rate = num_passed / num_tests if num_tests > 0 else 0.0 - max_steps = 8 - step_efficiency = (state.step_count / max_steps) + pass_rate = num_passed / num_tests if num_tests > 0 else 0.0 if passed_all: - # Solved — difficulty determined by how many steps it needed - score = 1.0 - step_efficiency + step_efficiency = (state.step_count / self.max_steps) + score = 1.0 - step_efficiency else: - # Not solved — difficulty = how far it got from a full solution - score = (pass_rate * 0.7) + score = pass_rate * 0.7 + + return max(0.01, min(0.99, score)) + + +class Task3Grader: + """ + Grader for Task 3 (Sequential Logic). + Evaluates based on: + - Sequence correctness + - Transition correctness + - Penalties for deadlock, oscillation, wrong encoding + - Reset working + """ + def __init__(self, max_steps: int = 10): + self.max_steps = max_steps + + def __call__(self, state: State, env: "RtlDebuggerEnvironment") -> float: + result_path = os.path.join(env._task_dir, "result.json") + if not os.path.exists(result_path): + # No result.json usually means compilation error or simulation timeout (deadlock/oscillation) + return 0.01 + + try: + with open(result_path, "r") as f: + result_json = json.load(f) + except json.JSONDecodeError: + return 0.01 - # Clamp to (0, 1) range strictly + seq_count = result_json.get("sequence_correctness", 0) + trans_count = result_json.get("transition_correctness", 0) + + num_passed = result_json.get("num_passed", 0) + num_tests = result_json.get("num_tests", 1) + + seq_rate = seq_count / num_tests if num_tests > 0 else 0.0 + trans_rate = trans_count / num_tests if num_tests > 0 else 0.0 + pass_rate = num_passed / num_tests if num_tests > 0 else 0.0 + + passed_all = result_json.get("passed", False) + + score = 0.0 + # Partial credit based on sequential milestones + score += seq_rate * 0.4 + score += trans_rate * 0.4 + # Note: reset_working was removed from testbench or ignored for now, + # but we could add it back if needed. For now let's use the remaining 0.2 + # as a bonus for passing everything. + + if passed_all: + score += 0.2 + step_efficiency = (state.step_count / self.max_steps) + score = 1.0 - step_efficiency + return max(0.01, min(0.99, score)) + + +def get_grader(task_id: str): + """Factory function to retrieve the appropriate grader for a task.""" + graders = { + "task1": Task1Grader(), + "task2": Task2Grader(), + "task3": Task3Grader(), + } + return graders.get(task_id, Task1Grader()) + diff --git a/server/rtl_debugger_environment.py b/server/rtl_debugger_environment.py index 903e87fd902b9491335b8adbfbf8b037a47828ed..4c2180df00c6ec948e1f668073dc8be233a41ef2 100644 --- a/server/rtl_debugger_environment.py +++ b/server/rtl_debugger_environment.py @@ -35,8 +35,7 @@ try: except ImportError: from models import RtlDebuggerAction, RtlDebuggerObservation -from .graders import RtlGrader -_rtl_grader_instance = RtlGrader() +from .graders import get_grader # Tasks directory is usually at the project root. # We first try the current working directory (e.g. /app/env in Docker), @@ -307,8 +306,11 @@ class RtlDebuggerEnvironment(Environment): if passed_all: reward += 20.0 + seq_count = result_data.get("sequence_correctness", "?") + trans_count = result_data.get("transition_correctness", "?") + feedback_lines = [ - f"Compiled: OK | Tests: {num_passed}/{num_tests} passed | First failure after: {progress_ratio:.2f} of sequence | Levenshtein distance: {lev_distance}" + f"Compiled: OK | Tests: {num_passed}/{num_tests} passed | Seq: {seq_count}/{num_tests} | Trans: {trans_count}/{num_tests} | First failure after: {progress_ratio:.2f} of sequence" ] # Parse failed test cases from result.json @@ -320,11 +322,11 @@ class RtlDebuggerEnvironment(Environment): inp = ft.get("inputs") or ft.get("input", {}) inputs_str = ", ".join(f"{k}={v}" for k, v in inp.items()) if isinstance(inp, dict) else str(inp) cycle = ft.get("test_id", "?") - expected = ft.get("expected_output", ft.get("expected_next_state", ft.get("expected", "?"))) - actual = ft.get("actual_output", ft.get("actual", "?")) + expected = ft.get("expected_output", "?") + actual = ft.get("actual_output", "?") state_info = "" - if "actual_state" in ft or "transition_to" in ft: + if "transition_to" in ft: was_s = ft.get("actual_state_meaning", ft.get("actual_state", "?")) went_s = ft.get("transition_to_meaning", ft.get("transition_to", "?")) exp_s = ft.get("expected_next_state_meaning", ft.get("expected_next_state", "?")) @@ -333,7 +335,8 @@ class RtlDebuggerEnvironment(Environment): feedback_lines.append(f"- Cycle {cycle}: [{inputs_str}] -> Expected: {expected}, Got: {actual}{state_info}") feedback = "\n".join(filter(None, feedback_lines)) - final_score = _rtl_grader_instance(self._state, self) + grader = get_grader(self._task_name) + final_score = grader(self._state, self) return RtlDebuggerObservation( task_id=self._task_name, diff --git a/tasks/task1/design_active.v b/tasks/task1/design_active.v index befc10bb7273a2f63184b36c507cb6931fbe686a..22fcc0e70994cc565a5327558178c105fc858374 100644 --- a/tasks/task1/design_active.v +++ b/tasks/task1/design_active.v @@ -1,9 +1,7 @@ module half_adder( - input a, - input b, - output sum, - output carry + input a, b, + output sum, carry ); assign sum = a ^ b; - assign carry = a & b; + assign carry = a & b; endmodule \ No newline at end of file diff --git a/tasks/task1/results.xml b/tasks/task1/results.xml index 530059c06171a776eb2d4abbd029c75e4afb0b95..39d3972af9dfe6979ec2cd66138d6189a68a68c6 100644 --- a/tasks/task1/results.xml +++ b/tasks/task1/results.xml @@ -1,6 +1,6 @@ - - + + \ No newline at end of file diff --git a/tasks/task1/sim_build/Vtop b/tasks/task1/sim_build/Vtop new file mode 100644 index 0000000000000000000000000000000000000000..0888a8b8eb766f303cf8200d006e6575a4007b40 --- /dev/null +++ b/tasks/task1/sim_build/Vtop @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:790e2bb6d9bf1dac2b0fdd8304ef96f7bc47313da65fc484139a5335e6105db7 +size 320920 diff --git a/tasks/task1/sim_build/Vtop.cpp b/tasks/task1/sim_build/Vtop.cpp new file mode 100644 index 0000000000000000000000000000000000000000..61f2bf6bf2191247637d55e2ae419f135d1db290 --- /dev/null +++ b/tasks/task1/sim_build/Vtop.cpp @@ -0,0 +1,99 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Model implementation (design independent parts) + +#include "Vtop__pch.h" + +//============================================================ +// Constructors + +Vtop::Vtop(VerilatedContext* _vcontextp__, const char* _vcname__) + : VerilatedModel{*_vcontextp__} + , vlSymsp{new Vtop__Syms(contextp(), _vcname__, this)} + , a{vlSymsp->TOP.a} + , b{vlSymsp->TOP.b} + , sum{vlSymsp->TOP.sum} + , carry{vlSymsp->TOP.carry} + , rootp{&(vlSymsp->TOP)} +{ + // Register model with the context + contextp()->addModel(this); +} + +Vtop::Vtop(const char* _vcname__) + : Vtop(Verilated::threadContextp(), _vcname__) +{ +} + +//============================================================ +// Destructor + +Vtop::~Vtop() { + delete vlSymsp; +} + +//============================================================ +// Evaluation function + +#ifdef VL_DEBUG +void Vtop___024root___eval_debug_assertions(Vtop___024root* vlSelf); +#endif // VL_DEBUG +void Vtop___024root___eval_static(Vtop___024root* vlSelf); +void Vtop___024root___eval_initial(Vtop___024root* vlSelf); +void Vtop___024root___eval_settle(Vtop___024root* vlSelf); +void Vtop___024root___eval(Vtop___024root* vlSelf); + +void Vtop::eval_step() { + VL_DEBUG_IF(VL_DBG_MSGF("+++++TOP Evaluate Vtop::eval_step\n"); ); +#ifdef VL_DEBUG + // Debug assertions + Vtop___024root___eval_debug_assertions(&(vlSymsp->TOP)); +#endif // VL_DEBUG + vlSymsp->__Vm_deleter.deleteAll(); + if (VL_UNLIKELY(!vlSymsp->__Vm_didInit)) { + vlSymsp->__Vm_didInit = true; + VL_DEBUG_IF(VL_DBG_MSGF("+ Initial\n");); + Vtop___024root___eval_static(&(vlSymsp->TOP)); + Vtop___024root___eval_initial(&(vlSymsp->TOP)); + Vtop___024root___eval_settle(&(vlSymsp->TOP)); + } + VL_DEBUG_IF(VL_DBG_MSGF("+ Eval\n");); + Vtop___024root___eval(&(vlSymsp->TOP)); + // Evaluate cleanup + Verilated::endOfEval(vlSymsp->__Vm_evalMsgQp); +} + +//============================================================ +// Events and timing +bool Vtop::eventsPending() { return false; } + +uint64_t Vtop::nextTimeSlot() { + VL_FATAL_MT(__FILE__, __LINE__, "", "No delays in the design"); + return 0; +} + +//============================================================ +// Utilities + +const char* Vtop::name() const { + return vlSymsp->name(); +} + +//============================================================ +// Invoke final blocks + +void Vtop___024root___eval_final(Vtop___024root* vlSelf); + +VL_ATTR_COLD void Vtop::final() { + Vtop___024root___eval_final(&(vlSymsp->TOP)); +} + +//============================================================ +// Implementations of abstract methods from VerilatedModel + +const char* Vtop::hierName() const { return vlSymsp->name(); } +const char* Vtop::modelName() const { return "Vtop"; } +unsigned Vtop::threads() const { return 1; } +void Vtop::prepareClone() const { contextp()->prepareClone(); } +void Vtop::atClone() const { + contextp()->threadPoolpOnClone(); +} diff --git a/tasks/task1/sim_build/Vtop.h b/tasks/task1/sim_build/Vtop.h new file mode 100644 index 0000000000000000000000000000000000000000..5e4083991edfba61a159b093ce7fd86476a9fd45 --- /dev/null +++ b/tasks/task1/sim_build/Vtop.h @@ -0,0 +1,92 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Primary model header +// +// This header should be included by all source files instantiating the design. +// The class here is then constructed to instantiate the design. +// See the Verilator manual for examples. + +#ifndef VERILATED_VTOP_H_ +#define VERILATED_VTOP_H_ // guard + +#include "verilated.h" +#include "svdpi.h" + +class Vtop__Syms; +class Vtop___024root; + +// This class is the main interface to the Verilated model +class alignas(VL_CACHE_LINE_BYTES) Vtop VL_NOT_FINAL : public VerilatedModel { + private: + // Symbol table holding complete model state (owned by this class) + Vtop__Syms* const vlSymsp; + + public: + + // CONSTEXPR CAPABILITIES + // Verilated with --trace? + static constexpr bool traceCapable = false; + + // PORTS + // The application code writes and reads these signals to + // propagate new values into/out from the Verilated model. + VL_IN8(&a,0,0); + VL_IN8(&b,0,0); + VL_OUT8(&sum,0,0); + VL_OUT8(&carry,0,0); + + // CELLS + // Public to allow access to /* verilator public */ items. + // Otherwise the application code can consider these internals. + + // Root instance pointer to allow access to model internals, + // including inlined /* verilator public_flat_* */ items. + Vtop___024root* const rootp; + + // CONSTRUCTORS + /// Construct the model; called by application code + /// If contextp is null, then the model will use the default global context + /// If name is "", then makes a wrapper with a + /// single model invisible with respect to DPI scope names. + explicit Vtop(VerilatedContext* contextp, const char* name = "TOP"); + explicit Vtop(const char* name = "TOP"); + /// Destroy the model; called (often implicitly) by application code + virtual ~Vtop(); + private: + VL_UNCOPYABLE(Vtop); ///< Copying not allowed + + public: + // API METHODS + /// Evaluate the model. Application must call when inputs change. + void eval() { eval_step(); } + /// Evaluate when calling multiple units/models per time step. + void eval_step(); + /// Evaluate at end of a timestep for tracing, when using eval_step(). + /// Application must call after all eval() and before time changes. + void eval_end_step() {} + /// Simulation complete, run final blocks. Application must call on completion. + void final(); + /// Are there scheduled events to handle? + bool eventsPending(); + /// Returns time at next time slot. Aborts if !eventsPending() + uint64_t nextTimeSlot(); + /// Trace signals in the model; called by application code + void trace(VerilatedTraceBaseC* tfp, int levels, int options = 0) { contextp()->trace(tfp, levels, options); } + /// Retrieve name of this model instance (as passed to constructor). + const char* name() const; + + // Abstract methods from VerilatedModel + const char* hierName() const override final; + const char* modelName() const override final; + unsigned threads() const override final; + /// Prepare for cloning the model at the process level (e.g. fork in Linux) + /// Release necessary resources. Called before cloning. + void prepareClone() const; + /// Re-init after cloning the model at the process level (e.g. fork in Linux) + /// Re-allocate necessary resources. Called after cloning. + void atClone() const; + private: + // Internal functions - trace registration + void traceBaseModel(VerilatedTraceBaseC* tfp, int levels, int options); +}; + +#endif // guard diff --git a/tasks/task1/sim_build/Vtop.mk b/tasks/task1/sim_build/Vtop.mk new file mode 100644 index 0000000000000000000000000000000000000000..198569e991e0e9c96463d732045f8764476a9254 --- /dev/null +++ b/tasks/task1/sim_build/Vtop.mk @@ -0,0 +1,72 @@ +# Verilated -*- Makefile -*- +# DESCRIPTION: Verilator output: Makefile for building Verilated archive or executable +# +# Execute this makefile from the object directory: +# make -f Vtop.mk + +default: Vtop + +### Constants... +# Perl executable (from $PERL, defaults to 'perl' if not set) +PERL = perl +# Python3 executable (from $PYTHON3, defaults to 'python3' if not set) +PYTHON3 = python3 +# Path to Verilator kit (from $VERILATOR_ROOT) +VERILATOR_ROOT = /usr/local/share/verilator +# SystemC include directory with systemc.h (from $SYSTEMC_INCLUDE) +SYSTEMC_INCLUDE ?= +# SystemC library directory with libsystemc.a (from $SYSTEMC_LIBDIR) +SYSTEMC_LIBDIR ?= + +### Switches... +# C++ code coverage 0/1 (from --prof-c) +VM_PROFC = 0 +# SystemC output mode? 0/1 (from --sc) +VM_SC = 0 +# Legacy or SystemC output mode? 0/1 (from --sc) +VM_SP_OR_SC = $(VM_SC) +# Deprecated +VM_PCLI = 1 +# Deprecated: SystemC architecture to find link library path (from $SYSTEMC_ARCH) +VM_SC_TARGET_ARCH = linux + +### Vars... +# Design prefix (from --prefix) +VM_PREFIX = Vtop +# Module prefix (from --prefix) +VM_MODPREFIX = Vtop +# User CFLAGS (from -CFLAGS on Verilator command line) +VM_USER_CFLAGS = \ + +# User LDLIBS (from -LDFLAGS on Verilator command line) +VM_USER_LDLIBS = \ + -Wl,-rpath,/mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/libs -L/mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/libs -lcocotbvpi_verilator \ + +# User .cpp files (from .cpp's on Verilator command line) +VM_USER_CLASSES = \ + verilator \ + +# User .cpp directories (from .cpp's on Verilator command line) +VM_USER_DIR = \ + .. \ + ../../../../open_venv/lib/python3.12/site-packages/cocotb/share/lib/verilator \ + + +### Default rules... +# Include list of all generated classes +include Vtop_classes.mk +# Include global rules +include $(VERILATOR_ROOT)/include/verilated.mk + +### Executable rules... (from --exe) +VPATH += $(VM_USER_DIR) + +verilator.o: /mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/share/lib/verilator/verilator.cpp + $(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $< + +### Link rules... (from --exe) +Vtop: $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_PREFIX)__ALL.a $(VM_HIER_LIBS) + $(LINK) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) $(LIBS) $(SC_LIBS) -o $@ + + +# Verilated -*- Makefile -*- diff --git a/tasks/task1/sim_build/Vtop__ALL.a b/tasks/task1/sim_build/Vtop__ALL.a new file mode 100644 index 0000000000000000000000000000000000000000..38b8bfef355a6b5f46c18d76d4a124aa35f461d1 Binary files /dev/null and b/tasks/task1/sim_build/Vtop__ALL.a differ diff --git a/tasks/task1/sim_build/Vtop__ALL.cpp b/tasks/task1/sim_build/Vtop__ALL.cpp new file mode 100644 index 0000000000000000000000000000000000000000..60a0a5f23b33150481c346ce17a6239da9cfe1eb --- /dev/null +++ b/tasks/task1/sim_build/Vtop__ALL.cpp @@ -0,0 +1,10 @@ +// DESCRIPTION: Generated by verilator_includer via makefile +#define VL_INCLUDE_OPT include +#include "Vtop.cpp" +#include "Vtop___024root__DepSet_h84412442__0.cpp" +#include "Vtop___024root__DepSet_heccd7ead__0.cpp" +#include "Vtop__Dpi.cpp" +#include "Vtop___024root__Slow.cpp" +#include "Vtop___024root__DepSet_h84412442__0__Slow.cpp" +#include "Vtop___024root__DepSet_heccd7ead__0__Slow.cpp" +#include "Vtop__Syms.cpp" diff --git a/tasks/task1/sim_build/Vtop__ALL.d b/tasks/task1/sim_build/Vtop__ALL.d new file mode 100644 index 0000000000000000000000000000000000000000..b156d27bc632174ff4b37433a4db6bba2a1a4003 --- /dev/null +++ b/tasks/task1/sim_build/Vtop__ALL.d @@ -0,0 +1,14 @@ +Vtop__ALL.o: Vtop__ALL.cpp Vtop.cpp Vtop__pch.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/verilated_dpi.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/vltstd/svdpi.h Vtop__Syms.h Vtop.h \ + Vtop___024root.h Vtop___024root__DepSet_h84412442__0.cpp \ + Vtop___024root__DepSet_heccd7ead__0.cpp Vtop__Dpi.cpp Vtop__Dpi.h \ + Vtop___024root__Slow.cpp Vtop___024root__DepSet_h84412442__0__Slow.cpp \ + Vtop___024root__DepSet_heccd7ead__0__Slow.cpp Vtop__Syms.cpp diff --git a/tasks/task1/sim_build/Vtop__ALL.o b/tasks/task1/sim_build/Vtop__ALL.o new file mode 100644 index 0000000000000000000000000000000000000000..f4d242bfbc63f64533109cdfb475348e5884475f Binary files /dev/null and b/tasks/task1/sim_build/Vtop__ALL.o differ diff --git a/tasks/task1/sim_build/Vtop__Dpi.cpp b/tasks/task1/sim_build/Vtop__Dpi.cpp new file mode 100644 index 0000000000000000000000000000000000000000..acad4c5a4e766690fde1749581a4624fb11d6b27 --- /dev/null +++ b/tasks/task1/sim_build/Vtop__Dpi.cpp @@ -0,0 +1,16 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Implementation of DPI export functions. +// +// Verilator compiles this file in when DPI functions are used. +// If you have multiple Verilated designs with the same DPI exported +// function names, you will get multiple definition link errors from here. +// This is an unfortunate result of the DPI specification. +// To solve this, either +// 1. Call Vtop::{export_function} instead, +// and do not even bother to compile this file +// or 2. Compile all __Dpi.cpp files in the same compiler run, +// and #ifdefs already inserted here will sort everything out. + +#include "Vtop__Dpi.h" +#include "Vtop.h" + diff --git a/tasks/task1/sim_build/Vtop__Dpi.h b/tasks/task1/sim_build/Vtop__Dpi.h new file mode 100644 index 0000000000000000000000000000000000000000..61f34bca460693665a4035fac95b145eb4d48ac8 --- /dev/null +++ b/tasks/task1/sim_build/Vtop__Dpi.h @@ -0,0 +1,22 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Prototypes for DPI import and export functions. +// +// Verilator includes this file in all generated .cpp files that use DPI functions. +// Manually include this file where DPI .c import functions are declared to ensure +// the C functions match the expectations of the DPI imports. + +#ifndef VERILATED_VTOP__DPI_H_ +#define VERILATED_VTOP__DPI_H_ // guard + +#include "svdpi.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif // guard diff --git a/tasks/task1/sim_build/Vtop__Syms.cpp b/tasks/task1/sim_build/Vtop__Syms.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1045fd239b87a465f1810110c8fac76e031acf35 --- /dev/null +++ b/tasks/task1/sim_build/Vtop__Syms.cpp @@ -0,0 +1,50 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Symbol table implementation internals + +#include "Vtop__pch.h" +#include "Vtop.h" +#include "Vtop___024root.h" + +// FUNCTIONS +Vtop__Syms::~Vtop__Syms() +{ + + // Tear down scope hierarchy + __Vhier.remove(0, &__Vscope_half_adder); + +} + +Vtop__Syms::Vtop__Syms(VerilatedContext* contextp, const char* namep, Vtop* modelp) + : VerilatedSyms{contextp} + // Setup internal state of the Syms class + , __Vm_modelp{modelp} + // Setup module instances + , TOP{this, namep} +{ + // Check resources + Verilated::stackCheck(25); + // Configure time unit / time precision + _vm_contextp__->timeunit(-9); + _vm_contextp__->timeprecision(-12); + // Setup each module's pointers to their submodules + // Setup each module's pointer back to symbol table (for public functions) + TOP.__Vconfigure(true); + // Setup scopes + __Vscope_TOP.configure(this, name(), "TOP", "TOP", "", 0, VerilatedScope::SCOPE_OTHER); + __Vscope_half_adder.configure(this, name(), "half_adder", "half_adder", "half_adder", -9, VerilatedScope::SCOPE_MODULE); + + // Set up scope hierarchy + __Vhier.add(0, &__Vscope_half_adder); + + // Setup export functions + for (int __Vfinal = 0; __Vfinal < 2; ++__Vfinal) { + __Vscope_TOP.varInsert(__Vfinal,"a", &(TOP.a), false, VLVT_UINT8,VLVD_IN|VLVF_PUB_RW,0,0); + __Vscope_TOP.varInsert(__Vfinal,"b", &(TOP.b), false, VLVT_UINT8,VLVD_IN|VLVF_PUB_RW,0,0); + __Vscope_TOP.varInsert(__Vfinal,"carry", &(TOP.carry), false, VLVT_UINT8,VLVD_OUT|VLVF_PUB_RW,0,0); + __Vscope_TOP.varInsert(__Vfinal,"sum", &(TOP.sum), false, VLVT_UINT8,VLVD_OUT|VLVF_PUB_RW,0,0); + __Vscope_half_adder.varInsert(__Vfinal,"a", &(TOP.half_adder__DOT__a), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,0); + __Vscope_half_adder.varInsert(__Vfinal,"b", &(TOP.half_adder__DOT__b), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,0); + __Vscope_half_adder.varInsert(__Vfinal,"carry", &(TOP.half_adder__DOT__carry), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,0); + __Vscope_half_adder.varInsert(__Vfinal,"sum", &(TOP.half_adder__DOT__sum), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,0); + } +} diff --git a/tasks/task1/sim_build/Vtop__Syms.h b/tasks/task1/sim_build/Vtop__Syms.h new file mode 100644 index 0000000000000000000000000000000000000000..fe30e053eb14c1f058c6353a5c01b30c8142379a --- /dev/null +++ b/tasks/task1/sim_build/Vtop__Syms.h @@ -0,0 +1,47 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Symbol table internal header +// +// Internal details; most calling programs do not need this header, +// unless using verilator public meta comments. + +#ifndef VERILATED_VTOP__SYMS_H_ +#define VERILATED_VTOP__SYMS_H_ // guard + +#include "verilated.h" + +// INCLUDE MODEL CLASS + +#include "Vtop.h" + +// INCLUDE MODULE CLASSES +#include "Vtop___024root.h" + +// DPI TYPES for DPI Export callbacks (Internal use) + +// SYMS CLASS (contains all model state) +class alignas(VL_CACHE_LINE_BYTES)Vtop__Syms final : public VerilatedSyms { + public: + // INTERNAL STATE + Vtop* const __Vm_modelp; + VlDeleter __Vm_deleter; + bool __Vm_didInit = false; + + // MODULE INSTANCE STATE + Vtop___024root TOP; + + // SCOPE NAMES + VerilatedScope __Vscope_TOP; + VerilatedScope __Vscope_half_adder; + + // SCOPE HIERARCHY + VerilatedHierarchy __Vhier; + + // CONSTRUCTORS + Vtop__Syms(VerilatedContext* contextp, const char* namep, Vtop* modelp); + ~Vtop__Syms(); + + // METHODS + const char* name() { return TOP.name(); } +}; + +#endif // guard diff --git a/tasks/task1/sim_build/Vtop___024root.h b/tasks/task1/sim_build/Vtop___024root.h new file mode 100644 index 0000000000000000000000000000000000000000..63e327d1a5b58f8557c0ab612ff6e3ea5c77b078 --- /dev/null +++ b/tasks/task1/sim_build/Vtop___024root.h @@ -0,0 +1,47 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design internal header +// See Vtop.h for the primary calling header + +#ifndef VERILATED_VTOP___024ROOT_H_ +#define VERILATED_VTOP___024ROOT_H_ // guard + +#include "verilated.h" + + +class Vtop__Syms; + +class alignas(VL_CACHE_LINE_BYTES) Vtop___024root final : public VerilatedModule { + public: + + // DESIGN SPECIFIC STATE + VL_IN8(a,0,0); + VL_IN8(b,0,0); + VL_OUT8(sum,0,0); + VL_OUT8(carry,0,0); + CData/*0:0*/ half_adder__DOT__a; + CData/*0:0*/ half_adder__DOT__b; + CData/*0:0*/ half_adder__DOT__sum; + CData/*0:0*/ half_adder__DOT__carry; + CData/*0:0*/ __VstlFirstIteration; + CData/*0:0*/ __VicoFirstIteration; + CData/*0:0*/ __VactContinue; + IData/*31:0*/ __VactIterCount; + VlTriggerVec<1> __VstlTriggered; + VlTriggerVec<1> __VicoTriggered; + VlTriggerVec<0> __VactTriggered; + VlTriggerVec<0> __VnbaTriggered; + + // INTERNAL VARIABLES + Vtop__Syms* const vlSymsp; + + // CONSTRUCTORS + Vtop___024root(Vtop__Syms* symsp, const char* v__name); + ~Vtop___024root(); + VL_UNCOPYABLE(Vtop___024root); + + // INTERNAL METHODS + void __Vconfigure(bool first); +}; + + +#endif // guard diff --git a/tasks/task1/sim_build/Vtop___024root__DepSet_h84412442__0.cpp b/tasks/task1/sim_build/Vtop___024root__DepSet_h84412442__0.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0873dfdead106e80e9abb4307c80b4754d72a2dd --- /dev/null +++ b/tasks/task1/sim_build/Vtop___024root__DepSet_h84412442__0.cpp @@ -0,0 +1,40 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop__Syms.h" +#include "Vtop___024root.h" + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__ico(Vtop___024root* vlSelf); +#endif // VL_DEBUG + +void Vtop___024root___eval_triggers__ico(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_triggers__ico\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelfRef.__VicoTriggered.setBit(0U, (IData)(vlSelfRef.__VicoFirstIteration)); +#ifdef VL_DEBUG + if (VL_UNLIKELY(vlSymsp->_vm_contextp__->debug())) { + Vtop___024root___dump_triggers__ico(vlSelf); + } +#endif +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__act(Vtop___024root* vlSelf); +#endif // VL_DEBUG + +void Vtop___024root___eval_triggers__act(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_triggers__act\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body +#ifdef VL_DEBUG + if (VL_UNLIKELY(vlSymsp->_vm_contextp__->debug())) { + Vtop___024root___dump_triggers__act(vlSelf); + } +#endif +} diff --git a/tasks/task1/sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp b/tasks/task1/sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..62d44d41af91002af668948c5313b5d2999d24e9 --- /dev/null +++ b/tasks/task1/sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp @@ -0,0 +1,24 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop__Syms.h" +#include "Vtop___024root.h" + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__stl(Vtop___024root* vlSelf); +#endif // VL_DEBUG + +VL_ATTR_COLD void Vtop___024root___eval_triggers__stl(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_triggers__stl\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelfRef.__VstlTriggered.setBit(0U, (IData)(vlSelfRef.__VstlFirstIteration)); +#ifdef VL_DEBUG + if (VL_UNLIKELY(vlSymsp->_vm_contextp__->debug())) { + Vtop___024root___dump_triggers__stl(vlSelf); + } +#endif +} diff --git a/tasks/task1/sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp b/tasks/task1/sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp new file mode 100644 index 0000000000000000000000000000000000000000..671ce4d3115a1eeda565cb43d30c89b7da9694b3 --- /dev/null +++ b/tasks/task1/sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp @@ -0,0 +1,179 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop___024root.h" + +void Vtop___024root___ico_sequent__TOP__0(Vtop___024root* vlSelf); + +void Vtop___024root___eval_ico(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_ico\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1ULL & vlSelfRef.__VicoTriggered.word(0U))) { + Vtop___024root___ico_sequent__TOP__0(vlSelf); + } +} + +VL_INLINE_OPT void Vtop___024root___ico_sequent__TOP__0(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___ico_sequent__TOP__0\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelfRef.half_adder__DOT__a = vlSelfRef.a; + vlSelfRef.half_adder__DOT__b = vlSelfRef.b; + vlSelfRef.carry = ((IData)(vlSelfRef.a) & (IData)(vlSelfRef.b)); + vlSelfRef.half_adder__DOT__sum = ((IData)(vlSelfRef.a) + ^ (IData)(vlSelfRef.b)); + vlSelfRef.half_adder__DOT__carry = vlSelfRef.carry; + vlSelfRef.sum = vlSelfRef.half_adder__DOT__sum; +} + +void Vtop___024root___eval_triggers__ico(Vtop___024root* vlSelf); + +bool Vtop___024root___eval_phase__ico(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_phase__ico\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + CData/*0:0*/ __VicoExecute; + // Body + Vtop___024root___eval_triggers__ico(vlSelf); + __VicoExecute = vlSelfRef.__VicoTriggered.any(); + if (__VicoExecute) { + Vtop___024root___eval_ico(vlSelf); + } + return (__VicoExecute); +} + +void Vtop___024root___eval_act(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_act\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); +} + +void Vtop___024root___eval_nba(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_nba\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); +} + +void Vtop___024root___eval_triggers__act(Vtop___024root* vlSelf); + +bool Vtop___024root___eval_phase__act(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_phase__act\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + VlTriggerVec<0> __VpreTriggered; + CData/*0:0*/ __VactExecute; + // Body + Vtop___024root___eval_triggers__act(vlSelf); + __VactExecute = vlSelfRef.__VactTriggered.any(); + if (__VactExecute) { + __VpreTriggered.andNot(vlSelfRef.__VactTriggered, vlSelfRef.__VnbaTriggered); + vlSelfRef.__VnbaTriggered.thisOr(vlSelfRef.__VactTriggered); + Vtop___024root___eval_act(vlSelf); + } + return (__VactExecute); +} + +bool Vtop___024root___eval_phase__nba(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_phase__nba\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + CData/*0:0*/ __VnbaExecute; + // Body + __VnbaExecute = vlSelfRef.__VnbaTriggered.any(); + if (__VnbaExecute) { + Vtop___024root___eval_nba(vlSelf); + vlSelfRef.__VnbaTriggered.clear(); + } + return (__VnbaExecute); +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__ico(Vtop___024root* vlSelf); +#endif // VL_DEBUG +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__nba(Vtop___024root* vlSelf); +#endif // VL_DEBUG +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__act(Vtop___024root* vlSelf); +#endif // VL_DEBUG + +void Vtop___024root___eval(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + IData/*31:0*/ __VicoIterCount; + CData/*0:0*/ __VicoContinue; + IData/*31:0*/ __VnbaIterCount; + CData/*0:0*/ __VnbaContinue; + // Body + __VicoIterCount = 0U; + vlSelfRef.__VicoFirstIteration = 1U; + __VicoContinue = 1U; + while (__VicoContinue) { + if (VL_UNLIKELY(((0x64U < __VicoIterCount)))) { +#ifdef VL_DEBUG + Vtop___024root___dump_triggers__ico(vlSelf); +#endif + VL_FATAL_MT("design_active.v", 1, "", "Input combinational region did not converge."); + } + __VicoIterCount = ((IData)(1U) + __VicoIterCount); + __VicoContinue = 0U; + if (Vtop___024root___eval_phase__ico(vlSelf)) { + __VicoContinue = 1U; + } + vlSelfRef.__VicoFirstIteration = 0U; + } + __VnbaIterCount = 0U; + __VnbaContinue = 1U; + while (__VnbaContinue) { + if (VL_UNLIKELY(((0x64U < __VnbaIterCount)))) { +#ifdef VL_DEBUG + Vtop___024root___dump_triggers__nba(vlSelf); +#endif + VL_FATAL_MT("design_active.v", 1, "", "NBA region did not converge."); + } + __VnbaIterCount = ((IData)(1U) + __VnbaIterCount); + __VnbaContinue = 0U; + vlSelfRef.__VactIterCount = 0U; + vlSelfRef.__VactContinue = 1U; + while (vlSelfRef.__VactContinue) { + if (VL_UNLIKELY(((0x64U < vlSelfRef.__VactIterCount)))) { +#ifdef VL_DEBUG + Vtop___024root___dump_triggers__act(vlSelf); +#endif + VL_FATAL_MT("design_active.v", 1, "", "Active region did not converge."); + } + vlSelfRef.__VactIterCount = ((IData)(1U) + + vlSelfRef.__VactIterCount); + vlSelfRef.__VactContinue = 0U; + if (Vtop___024root___eval_phase__act(vlSelf)) { + vlSelfRef.__VactContinue = 1U; + } + } + if (Vtop___024root___eval_phase__nba(vlSelf)) { + __VnbaContinue = 1U; + } + } +} + +#ifdef VL_DEBUG +void Vtop___024root___eval_debug_assertions(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_debug_assertions\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if (VL_UNLIKELY(((vlSelfRef.a & 0xfeU)))) { + Verilated::overWidthError("a");} + if (VL_UNLIKELY(((vlSelfRef.b & 0xfeU)))) { + Verilated::overWidthError("b");} +} +#endif // VL_DEBUG diff --git a/tasks/task1/sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp b/tasks/task1/sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..93d6a014f78c50bb11ffe6dbecf0730e935466da --- /dev/null +++ b/tasks/task1/sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp @@ -0,0 +1,154 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop___024root.h" + +VL_ATTR_COLD void Vtop___024root___eval_static(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_static\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); +} + +VL_ATTR_COLD void Vtop___024root___eval_initial(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_initial\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); +} + +VL_ATTR_COLD void Vtop___024root___eval_final(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_final\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__stl(Vtop___024root* vlSelf); +#endif // VL_DEBUG +VL_ATTR_COLD bool Vtop___024root___eval_phase__stl(Vtop___024root* vlSelf); + +VL_ATTR_COLD void Vtop___024root___eval_settle(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_settle\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + IData/*31:0*/ __VstlIterCount; + CData/*0:0*/ __VstlContinue; + // Body + __VstlIterCount = 0U; + vlSelfRef.__VstlFirstIteration = 1U; + __VstlContinue = 1U; + while (__VstlContinue) { + if (VL_UNLIKELY(((0x64U < __VstlIterCount)))) { +#ifdef VL_DEBUG + Vtop___024root___dump_triggers__stl(vlSelf); +#endif + VL_FATAL_MT("design_active.v", 1, "", "Settle region did not converge."); + } + __VstlIterCount = ((IData)(1U) + __VstlIterCount); + __VstlContinue = 0U; + if (Vtop___024root___eval_phase__stl(vlSelf)) { + __VstlContinue = 1U; + } + vlSelfRef.__VstlFirstIteration = 0U; + } +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__stl(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___dump_triggers__stl\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1U & (~ vlSelfRef.__VstlTriggered.any()))) { + VL_DBG_MSGF(" No triggers active\n"); + } + if ((1ULL & vlSelfRef.__VstlTriggered.word(0U))) { + VL_DBG_MSGF(" 'stl' region trigger index 0 is active: Internal 'stl' trigger - first iteration\n"); + } +} +#endif // VL_DEBUG + +void Vtop___024root___ico_sequent__TOP__0(Vtop___024root* vlSelf); + +VL_ATTR_COLD void Vtop___024root___eval_stl(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_stl\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1ULL & vlSelfRef.__VstlTriggered.word(0U))) { + Vtop___024root___ico_sequent__TOP__0(vlSelf); + } +} + +VL_ATTR_COLD void Vtop___024root___eval_triggers__stl(Vtop___024root* vlSelf); + +VL_ATTR_COLD bool Vtop___024root___eval_phase__stl(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_phase__stl\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + CData/*0:0*/ __VstlExecute; + // Body + Vtop___024root___eval_triggers__stl(vlSelf); + __VstlExecute = vlSelfRef.__VstlTriggered.any(); + if (__VstlExecute) { + Vtop___024root___eval_stl(vlSelf); + } + return (__VstlExecute); +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__ico(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___dump_triggers__ico\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1U & (~ vlSelfRef.__VicoTriggered.any()))) { + VL_DBG_MSGF(" No triggers active\n"); + } + if ((1ULL & vlSelfRef.__VicoTriggered.word(0U))) { + VL_DBG_MSGF(" 'ico' region trigger index 0 is active: Internal 'ico' trigger - first iteration\n"); + } +} +#endif // VL_DEBUG + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__act(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___dump_triggers__act\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1U & (~ vlSelfRef.__VactTriggered.any()))) { + VL_DBG_MSGF(" No triggers active\n"); + } +} +#endif // VL_DEBUG + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__nba(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___dump_triggers__nba\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1U & (~ vlSelfRef.__VnbaTriggered.any()))) { + VL_DBG_MSGF(" No triggers active\n"); + } +} +#endif // VL_DEBUG + +VL_ATTR_COLD void Vtop___024root___ctor_var_reset(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___ctor_var_reset\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelf->a = VL_RAND_RESET_I(1); + vlSelf->b = VL_RAND_RESET_I(1); + vlSelf->sum = VL_RAND_RESET_I(1); + vlSelf->carry = VL_RAND_RESET_I(1); + vlSelf->half_adder__DOT__a = VL_RAND_RESET_I(1); + vlSelf->half_adder__DOT__b = VL_RAND_RESET_I(1); + vlSelf->half_adder__DOT__sum = VL_RAND_RESET_I(1); + vlSelf->half_adder__DOT__carry = VL_RAND_RESET_I(1); +} diff --git a/tasks/task1/sim_build/Vtop___024root__Slow.cpp b/tasks/task1/sim_build/Vtop___024root__Slow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..26aff1d7520b5c97352612f6abe92474d9762fd4 --- /dev/null +++ b/tasks/task1/sim_build/Vtop___024root__Slow.cpp @@ -0,0 +1,24 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop__Syms.h" +#include "Vtop___024root.h" + +void Vtop___024root___ctor_var_reset(Vtop___024root* vlSelf); + +Vtop___024root::Vtop___024root(Vtop__Syms* symsp, const char* v__name) + : VerilatedModule{v__name} + , vlSymsp{symsp} + { + // Reset structure values + Vtop___024root___ctor_var_reset(this); +} + +void Vtop___024root::__Vconfigure(bool first) { + (void)first; // Prevent unused variable warning +} + +Vtop___024root::~Vtop___024root() { +} diff --git a/tasks/task1/sim_build/Vtop__pch.h b/tasks/task1/sim_build/Vtop__pch.h new file mode 100644 index 0000000000000000000000000000000000000000..e8a66ca476701a3366cc19b6cbb940b97e115de2 --- /dev/null +++ b/tasks/task1/sim_build/Vtop__pch.h @@ -0,0 +1,29 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Precompiled header +// +// Internal details; most user sources do not need this header, +// unless using verilator public meta comments. +// Suggest use Vtop.h instead. + + +#ifndef VERILATED_VTOP__PCH_H_ +#define VERILATED_VTOP__PCH_H_ // guard + +// GCC and Clang only will precompile headers (PCH) for the first header. +// So, make sure this is the one and only PCH. +// If multiple module's includes are needed, use individual includes. +#ifdef VL_PCH_INCLUDED +# error "Including multiple precompiled header files" +#endif +#define VL_PCH_INCLUDED + + +#include "verilated.h" +#include "verilated_dpi.h" + +#include "Vtop__Syms.h" +#include "Vtop.h" + +// Additional include files added using '--compiler-include' + +#endif // guard diff --git a/tasks/task1/sim_build/Vtop__ver.d b/tasks/task1/sim_build/Vtop__ver.d new file mode 100644 index 0000000000000000000000000000000000000000..a21136f631da48b21494ec53c1d4dd98a0dc4d3f --- /dev/null +++ b/tasks/task1/sim_build/Vtop__ver.d @@ -0,0 +1 @@ +sim_build/Vtop.cpp sim_build/Vtop.h sim_build/Vtop.mk sim_build/Vtop__Dpi.cpp sim_build/Vtop__Dpi.h sim_build/Vtop__Syms.cpp sim_build/Vtop__Syms.h sim_build/Vtop___024root.h sim_build/Vtop___024root__DepSet_h84412442__0.cpp sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp sim_build/Vtop___024root__Slow.cpp sim_build/Vtop__pch.h sim_build/Vtop__ver.d sim_build/Vtop_classes.mk : /usr/local/bin/verilator_bin /usr/local/bin/verilator_bin /usr/local/share/verilator/include/verilated_std.sv /usr/local/share/verilator/include/verilated_std_waiver.vlt design_active.v diff --git a/tasks/task1/sim_build/Vtop__verFiles.dat b/tasks/task1/sim_build/Vtop__verFiles.dat new file mode 100644 index 0000000000000000000000000000000000000000..170651a10af1b0f6034b8410a99100369fc96214 --- /dev/null +++ b/tasks/task1/sim_build/Vtop__verFiles.dat @@ -0,0 +1,23 @@ +# DESCRIPTION: Verilator output: Timestamp data for --skip-identical. Delete at will. +C "-cc --exe -Mdir sim_build --top-module half_adder --timescale 1ns/1ps --vpi --public-flat-rw --prefix Vtop -o Vtop -LDFLAGS -Wl,-rpath,/mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/libs -L/mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/libs -lcocotbvpi_verilator design_active.v /mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/share/lib/verilator/verilator.cpp" +S 15982304 152497 1775633558 952547019 1775633558 952547019 "/usr/local/bin/verilator_bin" +S 6525 152673 1775633559 122559598 1775633559 122559598 "/usr/local/share/verilator/include/verilated_std.sv" +S 2787 152655 1775633559 112558860 1775633559 112558860 "/usr/local/share/verilator/include/verilated_std_waiver.vlt" +S 281 7036874417799606 1775634224 763642000 1775634224 763642000 "design_active.v" +T 2984 3096224745706922 1775634226 861395500 1775634226 861395500 "sim_build/Vtop.cpp" +T 3505 5066549582681425 1775634226 857854000 1775634226 857854000 "sim_build/Vtop.h" +T 2326 2814749768996448 1775634226 886766700 1775634226 886766700 "sim_build/Vtop.mk" +T 669 4503599629259776 1775634226 855839700 1775634226 855839700 "sim_build/Vtop__Dpi.cpp" +T 520 18858823441462464 1775634226 853826700 1775634226 853826700 "sim_build/Vtop__Dpi.h" +T 2212 30117822508124560 1775634226 850045500 1775634226 850045500 "sim_build/Vtop__Syms.cpp" +T 1115 16325548650952681 1775634226 850556400 1775634226 850556400 "sim_build/Vtop__Syms.h" +T 1189 2533274792285651 1775634226 866813600 1775634226 866813600 "sim_build/Vtop___024root.h" +T 1369 3096224745707037 1775634226 875505300 1775634226 875505300 "sim_build/Vtop___024root__DepSet_h84412442__0.cpp" +T 845 2533274792285659 1775634226 871423000 1775634226 871423000 "sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp" +T 6754 2814749768996437 1775634226 880370400 1775634226 880370400 "sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp" +T 6003 2533274792285689 1775634226 873486000 1775634226 873486000 "sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp" +T 620 2533274792285653 1775634226 868852200 1775634226 868852200 "sim_build/Vtop___024root__Slow.cpp" +T 773 2814749768996274 1775634226 863436900 1775634226 863436900 "sim_build/Vtop__pch.h" +T 682 3940649675839252 1775634226 890540100 1775634226 890540100 "sim_build/Vtop__ver.d" +T 0 0 1775634226 892089400 1775634226 892089400 "sim_build/Vtop__verFiles.dat" +T 1770 2814749768996438 1775634226 881448700 1775634226 881448700 "sim_build/Vtop_classes.mk" diff --git a/tasks/task1/sim_build/Vtop_classes.mk b/tasks/task1/sim_build/Vtop_classes.mk new file mode 100644 index 0000000000000000000000000000000000000000..d0dddac36614be5b07baf976ce1cec00f6796a03 --- /dev/null +++ b/tasks/task1/sim_build/Vtop_classes.mk @@ -0,0 +1,57 @@ +# Verilated -*- Makefile -*- +# DESCRIPTION: Verilator output: Make include file with class lists +# +# This file lists generated Verilated files, for including in higher level makefiles. +# See Vtop.mk for the caller. + +### Switches... +# C11 constructs required? 0/1 (always on now) +VM_C11 = 1 +# Timing enabled? 0/1 +VM_TIMING = 0 +# Coverage output mode? 0/1 (from --coverage) +VM_COVERAGE = 0 +# Parallel builds? 0/1 (from --output-split) +VM_PARALLEL_BUILDS = 0 +# Tracing output mode? 0/1 (from --trace-fst/--trace-saif/--trace-vcd) +VM_TRACE = 0 +# Tracing output mode in FST format? 0/1 (from --trace-fst) +VM_TRACE_FST = 0 +# Tracing output mode in SAIF format? 0/1 (from --trace-saif) +VM_TRACE_SAIF = 0 +# Tracing output mode in VCD format? 0/1 (from --trace-vcd) +VM_TRACE_VCD = 0 + +### Object file lists... +# Generated module classes, fast-path, compile with highest optimization +VM_CLASSES_FAST += \ + Vtop \ + Vtop___024root__DepSet_h84412442__0 \ + Vtop___024root__DepSet_heccd7ead__0 \ + +# Generated module classes, non-fast-path, compile with low/medium optimization +VM_CLASSES_SLOW += \ + Vtop___024root__Slow \ + Vtop___024root__DepSet_h84412442__0__Slow \ + Vtop___024root__DepSet_heccd7ead__0__Slow \ + +# Generated support classes, fast-path, compile with highest optimization +VM_SUPPORT_FAST += \ + Vtop__Dpi \ + +# Generated support classes, non-fast-path, compile with low/medium optimization +VM_SUPPORT_SLOW += \ + Vtop__Syms \ + +# Global classes, need linked once per executable, fast-path, compile with highest optimization +VM_GLOBAL_FAST += \ + verilated \ + verilated_dpi \ + verilated_vpi \ + verilated_threads \ + +# Global classes, need linked once per executable, non-fast-path, compile with low/medium optimization +VM_GLOBAL_SLOW += \ + + +# Verilated -*- Makefile -*- diff --git a/tasks/task1/sim_build/sim.vvp b/tasks/task1/sim_build/sim.vvp index f777178c89294c2f5fc4b08ffd1fbf2a54c782a1..c7b2d5fe6a4d36c33a2df783888ea9433e0df619 100644 --- a/tasks/task1/sim_build/sim.vvp +++ b/tasks/task1/sim_build/sim.vvp @@ -8,22 +8,22 @@ :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/v2005_math.vpi"; :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/va_math.vpi"; :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/v2009.vpi"; -S_0x55f0dc01f510 .scope package, "$unit" "$unit" 2 1; +S_0x56539094a510 .scope package, "$unit" "$unit" 2 1; .timescale -9 -12; -S_0x55f0dc01f6a0 .scope module, "half_adder" "half_adder" 3 1; +S_0x56539094a6a0 .scope module, "half_adder" "half_adder" 3 1; .timescale -9 -12; .port_info 0 /INPUT 1 "a"; .port_info 1 /INPUT 1 "b"; .port_info 2 /OUTPUT 1 "sum"; .port_info 3 /OUTPUT 1 "carry"; -o0x7fa1802ff018 .functor BUFZ 1, C4; HiZ drive -o0x7fa1802ff048 .functor BUFZ 1, C4; HiZ drive -L_0x55f0dc066d00 .functor XOR 1, o0x7fa1802ff018, o0x7fa1802ff048, C4<0>, C4<0>; -L_0x55f0dc066df0 .functor AND 1, o0x7fa1802ff018, o0x7fa1802ff048, C4<1>, C4<1>; -v0x55f0dc031430_0 .net "a", 0 0, o0x7fa1802ff018; 0 drivers -v0x55f0dc066a00_0 .net "b", 0 0, o0x7fa1802ff048; 0 drivers -v0x55f0dc066ac0_0 .net "carry", 0 0, L_0x55f0dc066df0; 1 drivers -v0x55f0dc066b90_0 .net "sum", 0 0, L_0x55f0dc066d00; 1 drivers +o0x7fab61caa018 .functor BUFZ 1, C4; HiZ drive +o0x7fab61caa048 .functor BUFZ 1, C4; HiZ drive +L_0x565390991d00 .functor XOR 1, o0x7fab61caa018, o0x7fab61caa048, C4<0>, C4<0>; +L_0x565390991df0 .functor AND 1, o0x7fab61caa018, o0x7fab61caa048, C4<1>, C4<1>; +v0x56539095c430_0 .net "a", 0 0, o0x7fab61caa018; 0 drivers +v0x565390991a00_0 .net "b", 0 0, o0x7fab61caa048; 0 drivers +v0x565390991ac0_0 .net "carry", 0 0, L_0x565390991df0; 1 drivers +v0x565390991b90_0 .net "sum", 0 0, L_0x565390991d00; 1 drivers # The file index is used to find the file name in the following table. :file_names 4; "N/A"; diff --git a/tasks/task1/sim_build/verilated.d b/tasks/task1/sim_build/verilated.d new file mode 100644 index 0000000000000000000000000000000000000000..33b20989f85f189b4facc333c18162bde9ad1811 --- /dev/null +++ b/tasks/task1/sim_build/verilated.d @@ -0,0 +1,12 @@ +verilated.o: /usr/local/share/verilator/include/verilated.cpp \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_imp.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/verilated_syms.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/verilated_threads.h \ + /usr/local/share/verilator/include/verilated_trace.h \ + /usr/local/share/verilator/include/verilatedos_c.h diff --git a/tasks/task1/sim_build/verilated.o b/tasks/task1/sim_build/verilated.o new file mode 100644 index 0000000000000000000000000000000000000000..2d51f088859acb7158634b8b97ec313ff02938c4 --- /dev/null +++ b/tasks/task1/sim_build/verilated.o @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d2edda4f644db03fd038b6221b9ce178237c0885957111ee515d6473fd895b7 +size 233592 diff --git a/tasks/task1/sim_build/verilated_dpi.d b/tasks/task1/sim_build/verilated_dpi.d new file mode 100644 index 0000000000000000000000000000000000000000..674a8230bf0b598187a9afb9dbaf52508a7671a4 --- /dev/null +++ b/tasks/task1/sim_build/verilated_dpi.d @@ -0,0 +1,12 @@ +verilated_dpi.o: /usr/local/share/verilator/include/verilated_dpi.cpp \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_dpi.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/vltstd/svdpi.h \ + /usr/local/share/verilator/include/verilated_imp.h \ + /usr/local/share/verilator/include/verilated_syms.h \ + /usr/local/share/verilator/include/vltstd/svdpi.h diff --git a/tasks/task1/sim_build/verilated_dpi.o b/tasks/task1/sim_build/verilated_dpi.o new file mode 100644 index 0000000000000000000000000000000000000000..648516bf4d297ff3734f4852c3b16fa860c493c7 Binary files /dev/null and b/tasks/task1/sim_build/verilated_dpi.o differ diff --git a/tasks/task1/sim_build/verilated_threads.d b/tasks/task1/sim_build/verilated_threads.d new file mode 100644 index 0000000000000000000000000000000000000000..c850804111cbe66e5214f2f6821d39b2989ef590 --- /dev/null +++ b/tasks/task1/sim_build/verilated_threads.d @@ -0,0 +1,8 @@ +verilated_threads.o: \ + /usr/local/share/verilator/include/verilated_threads.cpp \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_threads.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h diff --git a/tasks/task1/sim_build/verilated_threads.o b/tasks/task1/sim_build/verilated_threads.o new file mode 100644 index 0000000000000000000000000000000000000000..a5850df71155e74ff9918ce7455268d1669559d8 Binary files /dev/null and b/tasks/task1/sim_build/verilated_threads.o differ diff --git a/tasks/task1/sim_build/verilated_vpi.d b/tasks/task1/sim_build/verilated_vpi.d new file mode 100644 index 0000000000000000000000000000000000000000..b02da8e1f395b53313108b7846745c3c6d8dc6e4 --- /dev/null +++ b/tasks/task1/sim_build/verilated_vpi.d @@ -0,0 +1,13 @@ +verilated_vpi.o: /usr/local/share/verilator/include/verilated_vpi.cpp \ + /usr/local/share/verilator/include/verilated_vpi.h \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/verilated_syms.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/vltstd/sv_vpi_user.h \ + /usr/local/share/verilator/include/vltstd/vpi_user.h \ + /usr/local/share/verilator/include/verilated_imp.h \ + /usr/local/share/verilator/include/vltstd/vpi_user.h diff --git a/tasks/task1/sim_build/verilated_vpi.o b/tasks/task1/sim_build/verilated_vpi.o new file mode 100644 index 0000000000000000000000000000000000000000..09c51e9a569f6c3b8c15b298c5b037aec2513c63 --- /dev/null +++ b/tasks/task1/sim_build/verilated_vpi.o @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68715e90d84a5a87f2765d14b91e0cfb3231b20adf84d426d7e0d92aa0b03e0a +size 217616 diff --git a/tasks/task1/sim_build/verilator.d b/tasks/task1/sim_build/verilator.d new file mode 100644 index 0000000000000000000000000000000000000000..13fc9d74cab9d073dd147e4418c08fc708dfcbe1 --- /dev/null +++ b/tasks/task1/sim_build/verilator.d @@ -0,0 +1,14 @@ +verilator.o: \ + /mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/share/lib/verilator/verilator.cpp \ + Vtop.h /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/vltstd/svdpi.h \ + /usr/local/share/verilator/include/verilated_vpi.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_syms.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/vltstd/sv_vpi_user.h \ + /usr/local/share/verilator/include/vltstd/vpi_user.h diff --git a/tasks/task1/sim_build/verilator.o b/tasks/task1/sim_build/verilator.o new file mode 100644 index 0000000000000000000000000000000000000000..d6e4de1527300e8e5db99b7652c13ad107912503 Binary files /dev/null and b/tasks/task1/sim_build/verilator.o differ diff --git a/tasks/task2/design_active.v b/tasks/task2/design_active.v index 082ab9a906196087c1fd8de63f2c047f83d38f66..6a9a387ec5a62d86c93485f508789ddba21b03cc 100644 --- a/tasks/task2/design_active.v +++ b/tasks/task2/design_active.v @@ -1,19 +1,16 @@ -module bin_gry #(parameter N = 8) - ( - input [N-1:0] binary, - output reg [N-1:0] gray - ); - -always @ (*) // Use '*' for combinational logic sensitivity list - begin - // The most significant bit (MSB) of the Gray code is the same as the MSB of the binary code. - gray[N-1] = binary[N-1]; - - // For all other bits, the i-th Gray code bit is the XOR of the i-th binary bit and the (i+1)-th binary bit. - // gray[i] = binary[i+1] ^ binary[i] - for (integer i = 0; i < N - 1; i = i + 1) begin - gray[i] = binary[i+1] ^ binary[i]; - end - end - +module bin_gry #(parameter N = 8) + ( + binary , + gray + ) ; + +input [N-1:0] binary ; +output reg [N-1:0] gray ; + +always @ (binary) + begin + gray[N-1] = binary[N-1] ; + gray[N-2:0] = binary[N-1:1] & binary[N-2:0] ; + end + endmodule \ No newline at end of file diff --git a/tasks/task2/result.json b/tasks/task2/result.json index 9e34117552716b9ed9b5f5e242d57aeab796c3e9..5b5f921a2fba5960a61dba9e3977d5fc827cd620 100644 --- a/tasks/task2/result.json +++ b/tasks/task2/result.json @@ -1,7 +1,7 @@ { - "passed": true, + "passed": false, "num_tests": 12, - "num_passed": 12, + "num_passed": 1, "simulation_time": 12.0, "results": [ { @@ -19,8 +19,8 @@ "binary": 1 }, "expected_output": 1, - "actual_output": 1, - "pass": true + "actual_output": 0, + "pass": false }, { "test_id": 2, @@ -28,8 +28,8 @@ "binary": 2 }, "expected_output": 3, - "actual_output": 3, - "pass": true + "actual_output": 0, + "pass": false }, { "test_id": 3, @@ -37,8 +37,8 @@ "binary": 3 }, "expected_output": 2, - "actual_output": 2, - "pass": true + "actual_output": 1, + "pass": false }, { "test_id": 4, @@ -46,8 +46,8 @@ "binary": 127 }, "expected_output": 64, - "actual_output": 64, - "pass": true + "actual_output": 63, + "pass": false }, { "test_id": 5, @@ -55,8 +55,8 @@ "binary": 255 }, "expected_output": 128, - "actual_output": 128, - "pass": true + "actual_output": 255, + "pass": false }, { "test_id": 6, @@ -64,8 +64,8 @@ "binary": 254 }, "expected_output": 129, - "actual_output": 129, - "pass": true + "actual_output": 254, + "pass": false }, { "test_id": 7, @@ -73,8 +73,8 @@ "binary": 5 }, "expected_output": 7, - "actual_output": 7, - "pass": true + "actual_output": 0, + "pass": false }, { "test_id": 8, @@ -82,8 +82,8 @@ "binary": 10 }, "expected_output": 15, - "actual_output": 15, - "pass": true + "actual_output": 0, + "pass": false }, { "test_id": 9, @@ -91,8 +91,8 @@ "binary": 15 }, "expected_output": 8, - "actual_output": 8, - "pass": true + "actual_output": 7, + "pass": false }, { "test_id": 10, @@ -100,8 +100,8 @@ "binary": 128 }, "expected_output": 192, - "actual_output": 192, - "pass": true + "actual_output": 128, + "pass": false }, { "test_id": 11, @@ -109,8 +109,8 @@ "binary": 127 }, "expected_output": 64, - "actual_output": 64, - "pass": true + "actual_output": 63, + "pass": false } ] } \ No newline at end of file diff --git a/tasks/task2/results.xml b/tasks/task2/results.xml index ecc2c2d433a855b4304c8c87bd1ec3586afc8c9e..8913db8b370bbc6640d9fbf454362bac1ebebeb5 100644 --- a/tasks/task2/results.xml +++ b/tasks/task2/results.xml @@ -1,6 +1,8 @@ - - + + + + \ No newline at end of file diff --git a/tasks/task2/sim_build/sim.vvp b/tasks/task2/sim_build/sim.vvp index fb4ec006b508f5d062d5159ec50066ae5cef73c9..7be1657cbc3ee009feadb5abefedbb139ce8c8b2 100644 --- a/tasks/task2/sim_build/sim.vvp +++ b/tasks/task2/sim_build/sim.vvp @@ -8,56 +8,33 @@ :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/v2005_math.vpi"; :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/va_math.vpi"; :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/v2009.vpi"; -S_0x55b47534e490 .scope package, "$unit" "$unit" 2 1; +S_0x55f98416c570 .scope package, "$unit" "$unit" 2 1; .timescale -9 -12; -S_0x55b47534e620 .scope module, "bin_gry" "bin_gry" 3 1; +S_0x55f98416c700 .scope module, "bin_gry" "bin_gry" 3 1; .timescale -9 -12; .port_info 0 /INPUT 8 "binary"; .port_info 1 /OUTPUT 8 "gray"; -P_0x55b47534e7b0 .param/l "N" 0 3 1, +C4<00000000000000000000000000001000>; -o0x7fe4c9e7a048 .functor BUFZ 8, C4; HiZ drive -v0x55b475360430_0 .net "binary", 7 0, o0x7fe4c9e7a048; 0 drivers -v0x55b4753987b0_0 .var "gray", 7 0; -E_0x55b475387890 .event anyedge, v0x55b475360430_0; -S_0x55b475375940 .scope begin, "$ivl_for_loop0" "$ivl_for_loop0" 3 14, 3 14 0, S_0x55b47534e620; - .timescale -9 -12; -v0x55b47535fd50_0 .var/i "i", 31 0; - .scope S_0x55b47534e620; +P_0x55f98416c890 .param/l "N" 0 3 1, +C4<00000000000000000000000000001000>; +o0x7f3e501fc018 .functor BUFZ 8, C4; HiZ drive +v0x55f98417dd50_0 .net "binary", 7 0, o0x7f3e501fc018; 0 drivers +v0x55f98417e430_0 .var "gray", 7 0; +E_0x55f98416d080 .event anyedge, v0x55f98417dd50_0; + .scope S_0x55f98416c700; T_0 ; - %wait E_0x55b475387890; - %load/vec4 v0x55b475360430_0; + %wait E_0x55f98416d080; + %load/vec4 v0x55f98417dd50_0; %parti/s 1, 7, 4; %ix/load 4, 7, 0; %flag_set/imm 4, 0; - %store/vec4 v0x55b4753987b0_0, 4, 1; - %fork t_1, S_0x55b475375940; - %jmp t_0; - .scope S_0x55b475375940; -t_1 ; - %pushi/vec4 0, 0, 32; - %store/vec4 v0x55b47535fd50_0, 0, 32; -T_0.0 ; - %load/vec4 v0x55b47535fd50_0; - %cmpi/s 7, 0, 32; - %jmp/0xz T_0.1, 5; - %load/vec4 v0x55b475360430_0; - %load/vec4 v0x55b47535fd50_0; - %addi 1, 0, 32; - %part/s 1; - %load/vec4 v0x55b475360430_0; - %load/vec4 v0x55b47535fd50_0; - %part/s 1; - %xor; - %ix/getv/s 4, v0x55b47535fd50_0; - %store/vec4 v0x55b4753987b0_0, 4, 1; - %load/vec4 v0x55b47535fd50_0; - %addi 1, 0, 32; - %store/vec4 v0x55b47535fd50_0, 0, 32; - %jmp T_0.0; -T_0.1 ; - %end; - .scope S_0x55b47534e620; -t_0 %join; + %store/vec4 v0x55f98417e430_0, 4, 1; + %load/vec4 v0x55f98417dd50_0; + %parti/s 7, 1, 2; + %load/vec4 v0x55f98417dd50_0; + %parti/s 7, 0, 2; + %and; + %ix/load 4, 0, 0; + %flag_set/imm 4, 0; + %store/vec4 v0x55f98417e430_0, 4, 7; %jmp T_0; .thread T_0, $push; # The file index is used to find the file name in the following table. diff --git a/tasks/task3/design_active.v b/tasks/task3/design_active.v index 7429fbe88102343dd458fd254b85f02953f55ac4..e9fade6f280cd74cdc1f6703d838a4675cb6e44c 100644 --- a/tasks/task3/design_active.v +++ b/tasks/task3/design_active.v @@ -1,62 +1,62 @@ module moore_ol( - inp, - clk, - reset, - out - ); + inp, + clk, + reset, + out +); input inp, clk, reset; output reg out; -parameter S0 = 0 , S1 = 1 , S2 = 2 , S3 = 3, S4 = 4; +parameter S0 = 0, S1 = 1, S2 = 2, S3 = 3, S4 = 4; reg [2:0] present_state, next_state; always @ (posedge clk or posedge reset) - begin - if(reset) - present_state <= S0; - else - present_state <= next_state; - end +begin + if (reset) + present_state <= S0; + else + present_state <= next_state; +end always @ (present_state or inp) - begin - case(present_state) - S0 : begin +begin + case(present_state) + S0 : begin if (inp) - next_state = S1; + next_state = S1; else - next_state = S0; + next_state = S0; out = 0; - end - S1 : begin + end + S1 : begin if (inp) - next_state = S2; + next_state = S2; else - next_state = S0; + next_state = S0; out = 0; - end - S2 : begin + end + S2 : begin if (inp) - next_state = S2; // FIX: If current state is S2 (seen '11') and input is '1', the sequence becomes '111'. The longest suffix of '111' that is also a prefix of '1101' is '11'. So, the FSM should remain in S2. It was incorrectly transitioning to S1. + next_state = S3; else - next_state = S3; + next_state = S0; out = 0; - end - S3 : begin + end + S3 : begin if (inp) - next_state = S4; + next_state = S4; else - next_state = S0; + next_state = S0; out = 0; - end - S4 : begin + end + S4 : begin if (inp) - next_state = S2; + next_state = S2; else - next_state = S0; + next_state = S0; out = 1; - end - default: next_state = S0; - endcase - end + end + default: next_state = S0; + endcase +end endmodule \ No newline at end of file diff --git a/tasks/task3/result.json b/tasks/task3/result.json index 750dec3ab92bbfea56c5cd1039ee88ecffdd9e3c..11d3a8d47065374d8bd5ec527e8a2f4fb406d80e 100644 --- a/tasks/task3/result.json +++ b/tasks/task3/result.json @@ -1,7 +1,7 @@ { - "passed": true, - "num_tests": 13, - "num_passed": 13, + "passed": false, + "num_tests": 17, + "num_passed": 2, "results": [ { "test_id": 0, @@ -23,147 +23,147 @@ "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, - "transition_to": 1, - "transition_to_meaning": "S1: Seen '1'", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 1, "expected_next_state_meaning": "S1: Seen '1'", - "pass": true + "pass": false }, { "test_id": 2, "input": 1, - "actual_state": 1, - "actual_state_meaning": "S1: Seen '1'", + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, - "transition_to": 2, - "transition_to_meaning": "S2: Seen '11'", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 2, "expected_next_state_meaning": "S2: Seen '11'", - "pass": true + "pass": false }, { "test_id": 3, "input": 0, - "actual_state": 2, - "actual_state_meaning": "S2: Seen '11'", + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, - "transition_to": 3, - "transition_to_meaning": "S3: Seen '110'", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 3, "expected_next_state_meaning": "S3: Seen '110'", - "pass": true + "pass": false }, { "test_id": 4, "input": 1, - "actual_state": 3, - "actual_state_meaning": "S3: Seen '110'", - "actual_output": 1, + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", + "actual_output": 0, "expected_output": 1, - "transition_to": 4, - "transition_to_meaning": "S4: Seen '1101' (Pattern Detected)", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 4, "expected_next_state_meaning": "S4: Seen '1101' (Pattern Detected)", - "pass": true + "pass": false }, { "test_id": 5, "input": 1, - "actual_state": 4, - "actual_state_meaning": "S4: Seen '1101' (Pattern Detected)", + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, - "transition_to": 2, - "transition_to_meaning": "S2: Seen '11'", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 2, "expected_next_state_meaning": "S2: Seen '11'", - "pass": true + "pass": false }, { "test_id": 6, "input": 1, - "actual_state": 2, - "actual_state_meaning": "S2: Seen '11'", + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, - "transition_to": 2, - "transition_to_meaning": "S2: Seen '11'", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 2, "expected_next_state_meaning": "S2: Seen '11'", - "pass": true + "pass": false }, { "test_id": 7, "input": 0, - "actual_state": 2, - "actual_state_meaning": "S2: Seen '11'", + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, - "transition_to": 3, - "transition_to_meaning": "S3: Seen '110'", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 3, "expected_next_state_meaning": "S3: Seen '110'", - "pass": true + "pass": false }, { "test_id": 8, "input": 1, - "actual_state": 3, - "actual_state_meaning": "S3: Seen '110'", - "actual_output": 1, + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", + "actual_output": 0, "expected_output": 1, - "transition_to": 4, - "transition_to_meaning": "S4: Seen '1101' (Pattern Detected)", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 4, "expected_next_state_meaning": "S4: Seen '1101' (Pattern Detected)", - "pass": true + "pass": false }, { "test_id": 9, "input": 1, - "actual_state": 4, - "actual_state_meaning": "S4: Seen '1101' (Pattern Detected)", + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, - "transition_to": 2, - "transition_to_meaning": "S2: Seen '11'", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 2, "expected_next_state_meaning": "S2: Seen '11'", - "pass": true + "pass": false }, { "test_id": 10, "input": 0, - "actual_state": 2, - "actual_state_meaning": "S2: Seen '11'", + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, - "transition_to": 3, - "transition_to_meaning": "S3: Seen '110'", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 3, "expected_next_state_meaning": "S3: Seen '110'", - "pass": true + "pass": false }, { "test_id": 11, "input": 1, - "actual_state": 3, - "actual_state_meaning": "S3: Seen '110'", - "actual_output": 1, + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", + "actual_output": 0, "expected_output": 1, - "transition_to": 4, - "transition_to_meaning": "S4: Seen '1101' (Pattern Detected)", + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", "expected_next_state": 4, "expected_next_state_meaning": "S4: Seen '1101' (Pattern Detected)", - "pass": true + "pass": false }, { "test_id": 12, "input": 0, - "actual_state": 4, - "actual_state_meaning": "S4: Seen '1101' (Pattern Detected)", + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", "actual_output": 0, "expected_output": 0, "transition_to": 0, @@ -171,7 +171,61 @@ "expected_next_state": 0, "expected_next_state_meaning": "S0: Seen nothing (Reset/Idle)", "pass": true + }, + { + "test_id": 13, + "input": 1, + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", + "actual_output": 0, + "expected_output": 0, + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", + "expected_next_state": 1, + "expected_next_state_meaning": "S1: Seen '1'", + "pass": false + }, + { + "test_id": 14, + "input": 1, + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", + "actual_output": 0, + "expected_output": 0, + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", + "expected_next_state": 2, + "expected_next_state_meaning": "S2: Seen '11'", + "pass": false + }, + { + "test_id": 15, + "input": 0, + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", + "actual_output": 0, + "expected_output": 0, + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", + "expected_next_state": 3, + "expected_next_state_meaning": "S3: Seen '110'", + "pass": false + }, + { + "test_id": 16, + "input": 1, + "actual_state": 0, + "actual_state_meaning": "S0: Seen nothing (Reset/Idle)", + "actual_output": 0, + "expected_output": 1, + "transition_to": 0, + "transition_to_meaning": "S0: Seen nothing (Reset/Idle)", + "expected_next_state": 4, + "expected_next_state_meaning": "S4: Seen '1101' (Pattern Detected)", + "pass": false } ], - "simulation_time": 141.0 + "sequence_correctness": 13, + "transition_correctness": 2, + "simulation_time": 171.0 } \ No newline at end of file diff --git a/tasks/task3/results.xml b/tasks/task3/results.xml index a4f7bf4bd0aaac441240b40415aa646fc7a9d069..a65a75c43aadd34e36ea11256c4b7f71446866fe 100644 --- a/tasks/task3/results.xml +++ b/tasks/task3/results.xml @@ -1,6 +1,8 @@ - - + + + + \ No newline at end of file diff --git a/tasks/task3/sim_build/Vtop b/tasks/task3/sim_build/Vtop new file mode 100644 index 0000000000000000000000000000000000000000..9b49b5ee5e00fd4f9ad7d1b9c2529c116e5552b3 --- /dev/null +++ b/tasks/task3/sim_build/Vtop @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12f9fbe76a6a4f56a2f6dcdbbe0c61c5ad78719325d10b99e0bd9c9cf29c6925 +size 321552 diff --git a/tasks/task3/sim_build/Vtop.cpp b/tasks/task3/sim_build/Vtop.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0972045f493c423953ea4704c98f4f53c76c0a1e --- /dev/null +++ b/tasks/task3/sim_build/Vtop.cpp @@ -0,0 +1,99 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Model implementation (design independent parts) + +#include "Vtop__pch.h" + +//============================================================ +// Constructors + +Vtop::Vtop(VerilatedContext* _vcontextp__, const char* _vcname__) + : VerilatedModel{*_vcontextp__} + , vlSymsp{new Vtop__Syms(contextp(), _vcname__, this)} + , inp{vlSymsp->TOP.inp} + , clk{vlSymsp->TOP.clk} + , reset{vlSymsp->TOP.reset} + , out{vlSymsp->TOP.out} + , rootp{&(vlSymsp->TOP)} +{ + // Register model with the context + contextp()->addModel(this); +} + +Vtop::Vtop(const char* _vcname__) + : Vtop(Verilated::threadContextp(), _vcname__) +{ +} + +//============================================================ +// Destructor + +Vtop::~Vtop() { + delete vlSymsp; +} + +//============================================================ +// Evaluation function + +#ifdef VL_DEBUG +void Vtop___024root___eval_debug_assertions(Vtop___024root* vlSelf); +#endif // VL_DEBUG +void Vtop___024root___eval_static(Vtop___024root* vlSelf); +void Vtop___024root___eval_initial(Vtop___024root* vlSelf); +void Vtop___024root___eval_settle(Vtop___024root* vlSelf); +void Vtop___024root___eval(Vtop___024root* vlSelf); + +void Vtop::eval_step() { + VL_DEBUG_IF(VL_DBG_MSGF("+++++TOP Evaluate Vtop::eval_step\n"); ); +#ifdef VL_DEBUG + // Debug assertions + Vtop___024root___eval_debug_assertions(&(vlSymsp->TOP)); +#endif // VL_DEBUG + vlSymsp->__Vm_deleter.deleteAll(); + if (VL_UNLIKELY(!vlSymsp->__Vm_didInit)) { + vlSymsp->__Vm_didInit = true; + VL_DEBUG_IF(VL_DBG_MSGF("+ Initial\n");); + Vtop___024root___eval_static(&(vlSymsp->TOP)); + Vtop___024root___eval_initial(&(vlSymsp->TOP)); + Vtop___024root___eval_settle(&(vlSymsp->TOP)); + } + VL_DEBUG_IF(VL_DBG_MSGF("+ Eval\n");); + Vtop___024root___eval(&(vlSymsp->TOP)); + // Evaluate cleanup + Verilated::endOfEval(vlSymsp->__Vm_evalMsgQp); +} + +//============================================================ +// Events and timing +bool Vtop::eventsPending() { return false; } + +uint64_t Vtop::nextTimeSlot() { + VL_FATAL_MT(__FILE__, __LINE__, "", "No delays in the design"); + return 0; +} + +//============================================================ +// Utilities + +const char* Vtop::name() const { + return vlSymsp->name(); +} + +//============================================================ +// Invoke final blocks + +void Vtop___024root___eval_final(Vtop___024root* vlSelf); + +VL_ATTR_COLD void Vtop::final() { + Vtop___024root___eval_final(&(vlSymsp->TOP)); +} + +//============================================================ +// Implementations of abstract methods from VerilatedModel + +const char* Vtop::hierName() const { return vlSymsp->name(); } +const char* Vtop::modelName() const { return "Vtop"; } +unsigned Vtop::threads() const { return 1; } +void Vtop::prepareClone() const { contextp()->prepareClone(); } +void Vtop::atClone() const { + contextp()->threadPoolpOnClone(); +} diff --git a/tasks/task3/sim_build/Vtop.h b/tasks/task3/sim_build/Vtop.h new file mode 100644 index 0000000000000000000000000000000000000000..24b88cb26c6a602aaef1844c8568435150f9e31d --- /dev/null +++ b/tasks/task3/sim_build/Vtop.h @@ -0,0 +1,92 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Primary model header +// +// This header should be included by all source files instantiating the design. +// The class here is then constructed to instantiate the design. +// See the Verilator manual for examples. + +#ifndef VERILATED_VTOP_H_ +#define VERILATED_VTOP_H_ // guard + +#include "verilated.h" +#include "svdpi.h" + +class Vtop__Syms; +class Vtop___024root; + +// This class is the main interface to the Verilated model +class alignas(VL_CACHE_LINE_BYTES) Vtop VL_NOT_FINAL : public VerilatedModel { + private: + // Symbol table holding complete model state (owned by this class) + Vtop__Syms* const vlSymsp; + + public: + + // CONSTEXPR CAPABILITIES + // Verilated with --trace? + static constexpr bool traceCapable = false; + + // PORTS + // The application code writes and reads these signals to + // propagate new values into/out from the Verilated model. + VL_IN8(&inp,0,0); + VL_IN8(&clk,0,0); + VL_IN8(&reset,0,0); + VL_OUT8(&out,0,0); + + // CELLS + // Public to allow access to /* verilator public */ items. + // Otherwise the application code can consider these internals. + + // Root instance pointer to allow access to model internals, + // including inlined /* verilator public_flat_* */ items. + Vtop___024root* const rootp; + + // CONSTRUCTORS + /// Construct the model; called by application code + /// If contextp is null, then the model will use the default global context + /// If name is "", then makes a wrapper with a + /// single model invisible with respect to DPI scope names. + explicit Vtop(VerilatedContext* contextp, const char* name = "TOP"); + explicit Vtop(const char* name = "TOP"); + /// Destroy the model; called (often implicitly) by application code + virtual ~Vtop(); + private: + VL_UNCOPYABLE(Vtop); ///< Copying not allowed + + public: + // API METHODS + /// Evaluate the model. Application must call when inputs change. + void eval() { eval_step(); } + /// Evaluate when calling multiple units/models per time step. + void eval_step(); + /// Evaluate at end of a timestep for tracing, when using eval_step(). + /// Application must call after all eval() and before time changes. + void eval_end_step() {} + /// Simulation complete, run final blocks. Application must call on completion. + void final(); + /// Are there scheduled events to handle? + bool eventsPending(); + /// Returns time at next time slot. Aborts if !eventsPending() + uint64_t nextTimeSlot(); + /// Trace signals in the model; called by application code + void trace(VerilatedTraceBaseC* tfp, int levels, int options = 0) { contextp()->trace(tfp, levels, options); } + /// Retrieve name of this model instance (as passed to constructor). + const char* name() const; + + // Abstract methods from VerilatedModel + const char* hierName() const override final; + const char* modelName() const override final; + unsigned threads() const override final; + /// Prepare for cloning the model at the process level (e.g. fork in Linux) + /// Release necessary resources. Called before cloning. + void prepareClone() const; + /// Re-init after cloning the model at the process level (e.g. fork in Linux) + /// Re-allocate necessary resources. Called after cloning. + void atClone() const; + private: + // Internal functions - trace registration + void traceBaseModel(VerilatedTraceBaseC* tfp, int levels, int options); +}; + +#endif // guard diff --git a/tasks/task3/sim_build/Vtop.mk b/tasks/task3/sim_build/Vtop.mk new file mode 100644 index 0000000000000000000000000000000000000000..198569e991e0e9c96463d732045f8764476a9254 --- /dev/null +++ b/tasks/task3/sim_build/Vtop.mk @@ -0,0 +1,72 @@ +# Verilated -*- Makefile -*- +# DESCRIPTION: Verilator output: Makefile for building Verilated archive or executable +# +# Execute this makefile from the object directory: +# make -f Vtop.mk + +default: Vtop + +### Constants... +# Perl executable (from $PERL, defaults to 'perl' if not set) +PERL = perl +# Python3 executable (from $PYTHON3, defaults to 'python3' if not set) +PYTHON3 = python3 +# Path to Verilator kit (from $VERILATOR_ROOT) +VERILATOR_ROOT = /usr/local/share/verilator +# SystemC include directory with systemc.h (from $SYSTEMC_INCLUDE) +SYSTEMC_INCLUDE ?= +# SystemC library directory with libsystemc.a (from $SYSTEMC_LIBDIR) +SYSTEMC_LIBDIR ?= + +### Switches... +# C++ code coverage 0/1 (from --prof-c) +VM_PROFC = 0 +# SystemC output mode? 0/1 (from --sc) +VM_SC = 0 +# Legacy or SystemC output mode? 0/1 (from --sc) +VM_SP_OR_SC = $(VM_SC) +# Deprecated +VM_PCLI = 1 +# Deprecated: SystemC architecture to find link library path (from $SYSTEMC_ARCH) +VM_SC_TARGET_ARCH = linux + +### Vars... +# Design prefix (from --prefix) +VM_PREFIX = Vtop +# Module prefix (from --prefix) +VM_MODPREFIX = Vtop +# User CFLAGS (from -CFLAGS on Verilator command line) +VM_USER_CFLAGS = \ + +# User LDLIBS (from -LDFLAGS on Verilator command line) +VM_USER_LDLIBS = \ + -Wl,-rpath,/mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/libs -L/mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/libs -lcocotbvpi_verilator \ + +# User .cpp files (from .cpp's on Verilator command line) +VM_USER_CLASSES = \ + verilator \ + +# User .cpp directories (from .cpp's on Verilator command line) +VM_USER_DIR = \ + .. \ + ../../../../open_venv/lib/python3.12/site-packages/cocotb/share/lib/verilator \ + + +### Default rules... +# Include list of all generated classes +include Vtop_classes.mk +# Include global rules +include $(VERILATOR_ROOT)/include/verilated.mk + +### Executable rules... (from --exe) +VPATH += $(VM_USER_DIR) + +verilator.o: /mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/share/lib/verilator/verilator.cpp + $(OBJCACHE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(OPT_FAST) -c -o $@ $< + +### Link rules... (from --exe) +Vtop: $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_PREFIX)__ALL.a $(VM_HIER_LIBS) + $(LINK) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) $(LIBS) $(SC_LIBS) -o $@ + + +# Verilated -*- Makefile -*- diff --git a/tasks/task3/sim_build/Vtop__ALL.a b/tasks/task3/sim_build/Vtop__ALL.a new file mode 100644 index 0000000000000000000000000000000000000000..1274cf7cdd16f2aae46655e968f389c76a51b2c8 Binary files /dev/null and b/tasks/task3/sim_build/Vtop__ALL.a differ diff --git a/tasks/task3/sim_build/Vtop__ALL.cpp b/tasks/task3/sim_build/Vtop__ALL.cpp new file mode 100644 index 0000000000000000000000000000000000000000..9f852b3a130266e9a0ca9fa33e4f09a4640ba695 --- /dev/null +++ b/tasks/task3/sim_build/Vtop__ALL.cpp @@ -0,0 +1,11 @@ +// DESCRIPTION: Generated by verilator_includer via makefile +#define VL_INCLUDE_OPT include +#include "Vtop.cpp" +#include "Vtop___024root__DepSet_h84412442__0.cpp" +#include "Vtop___024root__DepSet_heccd7ead__0.cpp" +#include "Vtop__Dpi.cpp" +#include "Vtop__ConstPool_0.cpp" +#include "Vtop___024root__Slow.cpp" +#include "Vtop___024root__DepSet_h84412442__0__Slow.cpp" +#include "Vtop___024root__DepSet_heccd7ead__0__Slow.cpp" +#include "Vtop__Syms.cpp" diff --git a/tasks/task3/sim_build/Vtop__ALL.d b/tasks/task3/sim_build/Vtop__ALL.d new file mode 100644 index 0000000000000000000000000000000000000000..7a9a618f78d2285fe3e987515a68cd9b638ee5d0 --- /dev/null +++ b/tasks/task3/sim_build/Vtop__ALL.d @@ -0,0 +1,15 @@ +Vtop__ALL.o: Vtop__ALL.cpp Vtop.cpp Vtop__pch.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/verilated_dpi.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/vltstd/svdpi.h Vtop__Syms.h Vtop.h \ + Vtop___024root.h Vtop___024root__DepSet_h84412442__0.cpp \ + Vtop___024root__DepSet_heccd7ead__0.cpp Vtop__Dpi.cpp Vtop__Dpi.h \ + Vtop__ConstPool_0.cpp Vtop___024root__Slow.cpp \ + Vtop___024root__DepSet_h84412442__0__Slow.cpp \ + Vtop___024root__DepSet_heccd7ead__0__Slow.cpp Vtop__Syms.cpp diff --git a/tasks/task3/sim_build/Vtop__ALL.o b/tasks/task3/sim_build/Vtop__ALL.o new file mode 100644 index 0000000000000000000000000000000000000000..f2d154040d40c17d786efbf36a4edb3f0779cc1a Binary files /dev/null and b/tasks/task3/sim_build/Vtop__ALL.o differ diff --git a/tasks/task3/sim_build/Vtop__ConstPool_0.cpp b/tasks/task3/sim_build/Vtop__ConstPool_0.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b22cbc1290d92933d69100e52ea84d533673e4df --- /dev/null +++ b/tasks/task3/sim_build/Vtop__ConstPool_0.cpp @@ -0,0 +1,20 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Constant pool +// + +#include "verilated.h" + +extern const VlUnpacked Vtop__ConstPool__TABLE_h2cd11e3b_0 = {{ + 0x00U, 0x00U, 0x03U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, + 0x01U, 0x02U, 0x01U, 0x04U, 0x02U, 0x00U, 0x00U, 0x00U +}}; + +extern const VlUnpacked Vtop__ConstPool__TABLE_hbcbc6965_0 = {{ + 0x00U, 0x00U, 0x00U, 0x00U, 0x01U, 0x00U, 0x00U, 0x00U, + 0x00U, 0x00U, 0x00U, 0x00U, 0x01U, 0x00U, 0x00U, 0x00U +}}; + +extern const VlUnpacked Vtop__ConstPool__TABLE_hee47b28f_0 = {{ + 0x03U, 0x03U, 0x03U, 0x03U, 0x03U, 0x01U, 0x01U, 0x01U, + 0x03U, 0x03U, 0x03U, 0x03U, 0x03U, 0x01U, 0x01U, 0x01U +}}; diff --git a/tasks/task3/sim_build/Vtop__Dpi.cpp b/tasks/task3/sim_build/Vtop__Dpi.cpp new file mode 100644 index 0000000000000000000000000000000000000000..acad4c5a4e766690fde1749581a4624fb11d6b27 --- /dev/null +++ b/tasks/task3/sim_build/Vtop__Dpi.cpp @@ -0,0 +1,16 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Implementation of DPI export functions. +// +// Verilator compiles this file in when DPI functions are used. +// If you have multiple Verilated designs with the same DPI exported +// function names, you will get multiple definition link errors from here. +// This is an unfortunate result of the DPI specification. +// To solve this, either +// 1. Call Vtop::{export_function} instead, +// and do not even bother to compile this file +// or 2. Compile all __Dpi.cpp files in the same compiler run, +// and #ifdefs already inserted here will sort everything out. + +#include "Vtop__Dpi.h" +#include "Vtop.h" + diff --git a/tasks/task3/sim_build/Vtop__Dpi.h b/tasks/task3/sim_build/Vtop__Dpi.h new file mode 100644 index 0000000000000000000000000000000000000000..61f34bca460693665a4035fac95b145eb4d48ac8 --- /dev/null +++ b/tasks/task3/sim_build/Vtop__Dpi.h @@ -0,0 +1,22 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Prototypes for DPI import and export functions. +// +// Verilator includes this file in all generated .cpp files that use DPI functions. +// Manually include this file where DPI .c import functions are declared to ensure +// the C functions match the expectations of the DPI imports. + +#ifndef VERILATED_VTOP__DPI_H_ +#define VERILATED_VTOP__DPI_H_ // guard + +#include "svdpi.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + +#endif // guard diff --git a/tasks/task3/sim_build/Vtop__Syms.cpp b/tasks/task3/sim_build/Vtop__Syms.cpp new file mode 100644 index 0000000000000000000000000000000000000000..534c588653e443bf1cd065eab2d97ed76728642c --- /dev/null +++ b/tasks/task3/sim_build/Vtop__Syms.cpp @@ -0,0 +1,57 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Symbol table implementation internals + +#include "Vtop__pch.h" +#include "Vtop.h" +#include "Vtop___024root.h" + +// FUNCTIONS +Vtop__Syms::~Vtop__Syms() +{ + + // Tear down scope hierarchy + __Vhier.remove(0, &__Vscope_moore_ol); + +} + +Vtop__Syms::Vtop__Syms(VerilatedContext* contextp, const char* namep, Vtop* modelp) + : VerilatedSyms{contextp} + // Setup internal state of the Syms class + , __Vm_modelp{modelp} + // Setup module instances + , TOP{this, namep} +{ + // Check resources + Verilated::stackCheck(31); + // Configure time unit / time precision + _vm_contextp__->timeunit(-9); + _vm_contextp__->timeprecision(-12); + // Setup each module's pointers to their submodules + // Setup each module's pointer back to symbol table (for public functions) + TOP.__Vconfigure(true); + // Setup scopes + __Vscope_TOP.configure(this, name(), "TOP", "TOP", "", 0, VerilatedScope::SCOPE_OTHER); + __Vscope_moore_ol.configure(this, name(), "moore_ol", "moore_ol", "moore_ol", -9, VerilatedScope::SCOPE_MODULE); + + // Set up scope hierarchy + __Vhier.add(0, &__Vscope_moore_ol); + + // Setup export functions + for (int __Vfinal = 0; __Vfinal < 2; ++__Vfinal) { + __Vscope_TOP.varInsert(__Vfinal,"clk", &(TOP.clk), false, VLVT_UINT8,VLVD_IN|VLVF_PUB_RW,0,0); + __Vscope_TOP.varInsert(__Vfinal,"inp", &(TOP.inp), false, VLVT_UINT8,VLVD_IN|VLVF_PUB_RW,0,0); + __Vscope_TOP.varInsert(__Vfinal,"out", &(TOP.out), false, VLVT_UINT8,VLVD_OUT|VLVF_PUB_RW,0,0); + __Vscope_TOP.varInsert(__Vfinal,"reset", &(TOP.reset), false, VLVT_UINT8,VLVD_IN|VLVF_PUB_RW,0,0); + __Vscope_moore_ol.varInsert(__Vfinal,"S0", const_cast(static_cast(&(TOP.moore_ol__DOT__S0))), true, VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,0,1 ,31,0); + __Vscope_moore_ol.varInsert(__Vfinal,"S1", const_cast(static_cast(&(TOP.moore_ol__DOT__S1))), true, VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,0,1 ,31,0); + __Vscope_moore_ol.varInsert(__Vfinal,"S2", const_cast(static_cast(&(TOP.moore_ol__DOT__S2))), true, VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,0,1 ,31,0); + __Vscope_moore_ol.varInsert(__Vfinal,"S3", const_cast(static_cast(&(TOP.moore_ol__DOT__S3))), true, VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,0,1 ,31,0); + __Vscope_moore_ol.varInsert(__Vfinal,"S4", const_cast(static_cast(&(TOP.moore_ol__DOT__S4))), true, VLVT_UINT32,VLVD_NODIR|VLVF_PUB_RW,0,1 ,31,0); + __Vscope_moore_ol.varInsert(__Vfinal,"clk", &(TOP.moore_ol__DOT__clk), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,0); + __Vscope_moore_ol.varInsert(__Vfinal,"inp", &(TOP.moore_ol__DOT__inp), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,0); + __Vscope_moore_ol.varInsert(__Vfinal,"next_state", &(TOP.moore_ol__DOT__next_state), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,1 ,2,0); + __Vscope_moore_ol.varInsert(__Vfinal,"out", &(TOP.moore_ol__DOT__out), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,0); + __Vscope_moore_ol.varInsert(__Vfinal,"present_state", &(TOP.moore_ol__DOT__present_state), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,1 ,2,0); + __Vscope_moore_ol.varInsert(__Vfinal,"reset", &(TOP.moore_ol__DOT__reset), false, VLVT_UINT8,VLVD_NODIR|VLVF_PUB_RW,0,0); + } +} diff --git a/tasks/task3/sim_build/Vtop__Syms.h b/tasks/task3/sim_build/Vtop__Syms.h new file mode 100644 index 0000000000000000000000000000000000000000..f6a4ecd05368898c5cd78fed789a3da86bba2686 --- /dev/null +++ b/tasks/task3/sim_build/Vtop__Syms.h @@ -0,0 +1,47 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Symbol table internal header +// +// Internal details; most calling programs do not need this header, +// unless using verilator public meta comments. + +#ifndef VERILATED_VTOP__SYMS_H_ +#define VERILATED_VTOP__SYMS_H_ // guard + +#include "verilated.h" + +// INCLUDE MODEL CLASS + +#include "Vtop.h" + +// INCLUDE MODULE CLASSES +#include "Vtop___024root.h" + +// DPI TYPES for DPI Export callbacks (Internal use) + +// SYMS CLASS (contains all model state) +class alignas(VL_CACHE_LINE_BYTES)Vtop__Syms final : public VerilatedSyms { + public: + // INTERNAL STATE + Vtop* const __Vm_modelp; + VlDeleter __Vm_deleter; + bool __Vm_didInit = false; + + // MODULE INSTANCE STATE + Vtop___024root TOP; + + // SCOPE NAMES + VerilatedScope __Vscope_TOP; + VerilatedScope __Vscope_moore_ol; + + // SCOPE HIERARCHY + VerilatedHierarchy __Vhier; + + // CONSTRUCTORS + Vtop__Syms(VerilatedContext* contextp, const char* namep, Vtop* modelp); + ~Vtop__Syms(); + + // METHODS + const char* name() { return TOP.name(); } +}; + +#endif // guard diff --git a/tasks/task3/sim_build/Vtop___024root.h b/tasks/task3/sim_build/Vtop___024root.h new file mode 100644 index 0000000000000000000000000000000000000000..6940c893eeebe9e0073d9bd763f21079a569b7aa --- /dev/null +++ b/tasks/task3/sim_build/Vtop___024root.h @@ -0,0 +1,58 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design internal header +// See Vtop.h for the primary calling header + +#ifndef VERILATED_VTOP___024ROOT_H_ +#define VERILATED_VTOP___024ROOT_H_ // guard + +#include "verilated.h" + + +class Vtop__Syms; + +class alignas(VL_CACHE_LINE_BYTES) Vtop___024root final : public VerilatedModule { + public: + + // DESIGN SPECIFIC STATE + VL_IN8(inp,0,0); + VL_IN8(clk,0,0); + VL_IN8(reset,0,0); + VL_OUT8(out,0,0); + CData/*0:0*/ moore_ol__DOT__inp; + CData/*0:0*/ moore_ol__DOT__clk; + CData/*0:0*/ moore_ol__DOT__reset; + CData/*0:0*/ moore_ol__DOT__out; + CData/*2:0*/ moore_ol__DOT__present_state; + CData/*2:0*/ moore_ol__DOT__next_state; + CData/*0:0*/ __VstlFirstIteration; + CData/*0:0*/ __VicoFirstIteration; + CData/*0:0*/ __Vtrigprevexpr___TOP__clk__0; + CData/*0:0*/ __Vtrigprevexpr___TOP__reset__0; + CData/*0:0*/ __VactContinue; + IData/*31:0*/ __VactIterCount; + VlTriggerVec<1> __VstlTriggered; + VlTriggerVec<1> __VicoTriggered; + VlTriggerVec<2> __VactTriggered; + VlTriggerVec<2> __VnbaTriggered; + + // INTERNAL VARIABLES + Vtop__Syms* const vlSymsp; + + // PARAMETERS + static constexpr IData/*31:0*/ moore_ol__DOT__S0 = 0U; + static constexpr IData/*31:0*/ moore_ol__DOT__S1 = 1U; + static constexpr IData/*31:0*/ moore_ol__DOT__S2 = 2U; + static constexpr IData/*31:0*/ moore_ol__DOT__S3 = 3U; + static constexpr IData/*31:0*/ moore_ol__DOT__S4 = 4U; + + // CONSTRUCTORS + Vtop___024root(Vtop__Syms* symsp, const char* v__name); + ~Vtop___024root(); + VL_UNCOPYABLE(Vtop___024root); + + // INTERNAL METHODS + void __Vconfigure(bool first); +}; + + +#endif // guard diff --git a/tasks/task3/sim_build/Vtop___024root__DepSet_h84412442__0.cpp b/tasks/task3/sim_build/Vtop___024root__DepSet_h84412442__0.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d9772b67a7a828d2054512ddb5ff9bcb6d3f3175 --- /dev/null +++ b/tasks/task3/sim_build/Vtop___024root__DepSet_h84412442__0.cpp @@ -0,0 +1,46 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop__Syms.h" +#include "Vtop___024root.h" + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__ico(Vtop___024root* vlSelf); +#endif // VL_DEBUG + +void Vtop___024root___eval_triggers__ico(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_triggers__ico\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelfRef.__VicoTriggered.setBit(0U, (IData)(vlSelfRef.__VicoFirstIteration)); +#ifdef VL_DEBUG + if (VL_UNLIKELY(vlSymsp->_vm_contextp__->debug())) { + Vtop___024root___dump_triggers__ico(vlSelf); + } +#endif +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__act(Vtop___024root* vlSelf); +#endif // VL_DEBUG + +void Vtop___024root___eval_triggers__act(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_triggers__act\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelfRef.__VactTriggered.setBit(0U, ((IData)(vlSelfRef.clk) + & (~ (IData)(vlSelfRef.__Vtrigprevexpr___TOP__clk__0)))); + vlSelfRef.__VactTriggered.setBit(1U, ((IData)(vlSelfRef.reset) + & (~ (IData)(vlSelfRef.__Vtrigprevexpr___TOP__reset__0)))); + vlSelfRef.__Vtrigprevexpr___TOP__clk__0 = vlSelfRef.clk; + vlSelfRef.__Vtrigprevexpr___TOP__reset__0 = vlSelfRef.reset; +#ifdef VL_DEBUG + if (VL_UNLIKELY(vlSymsp->_vm_contextp__->debug())) { + Vtop___024root___dump_triggers__act(vlSelf); + } +#endif +} diff --git a/tasks/task3/sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp b/tasks/task3/sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..62d44d41af91002af668948c5313b5d2999d24e9 --- /dev/null +++ b/tasks/task3/sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp @@ -0,0 +1,24 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop__Syms.h" +#include "Vtop___024root.h" + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__stl(Vtop___024root* vlSelf); +#endif // VL_DEBUG + +VL_ATTR_COLD void Vtop___024root___eval_triggers__stl(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_triggers__stl\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelfRef.__VstlTriggered.setBit(0U, (IData)(vlSelfRef.__VstlFirstIteration)); +#ifdef VL_DEBUG + if (VL_UNLIKELY(vlSymsp->_vm_contextp__->debug())) { + Vtop___024root___dump_triggers__stl(vlSelf); + } +#endif +} diff --git a/tasks/task3/sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp b/tasks/task3/sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0b10442d8ef5a521a12800a1fa6a6516f49aba5d --- /dev/null +++ b/tasks/task3/sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp @@ -0,0 +1,221 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop___024root.h" + +void Vtop___024root___ico_sequent__TOP__0(Vtop___024root* vlSelf); + +void Vtop___024root___eval_ico(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_ico\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1ULL & vlSelfRef.__VicoTriggered.word(0U))) { + Vtop___024root___ico_sequent__TOP__0(vlSelf); + } +} + +extern const VlUnpacked Vtop__ConstPool__TABLE_h2cd11e3b_0; +extern const VlUnpacked Vtop__ConstPool__TABLE_hee47b28f_0; +extern const VlUnpacked Vtop__ConstPool__TABLE_hbcbc6965_0; + +VL_INLINE_OPT void Vtop___024root___ico_sequent__TOP__0(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___ico_sequent__TOP__0\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + CData/*3:0*/ __Vtableidx1; + __Vtableidx1 = 0; + // Body + vlSelfRef.moore_ol__DOT__inp = vlSelfRef.inp; + vlSelfRef.moore_ol__DOT__clk = vlSelfRef.clk; + vlSelfRef.moore_ol__DOT__reset = vlSelfRef.reset; + __Vtableidx1 = (((IData)(vlSelfRef.inp) << 3U) + | (IData)(vlSelfRef.moore_ol__DOT__present_state)); + vlSelfRef.moore_ol__DOT__next_state = Vtop__ConstPool__TABLE_h2cd11e3b_0 + [__Vtableidx1]; + if ((2U & Vtop__ConstPool__TABLE_hee47b28f_0[__Vtableidx1])) { + vlSelfRef.moore_ol__DOT__out = Vtop__ConstPool__TABLE_hbcbc6965_0 + [__Vtableidx1]; + } + vlSelfRef.out = vlSelfRef.moore_ol__DOT__out; +} + +void Vtop___024root___eval_triggers__ico(Vtop___024root* vlSelf); + +bool Vtop___024root___eval_phase__ico(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_phase__ico\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + CData/*0:0*/ __VicoExecute; + // Body + Vtop___024root___eval_triggers__ico(vlSelf); + __VicoExecute = vlSelfRef.__VicoTriggered.any(); + if (__VicoExecute) { + Vtop___024root___eval_ico(vlSelf); + } + return (__VicoExecute); +} + +void Vtop___024root___eval_act(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_act\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); +} + +void Vtop___024root___nba_sequent__TOP__0(Vtop___024root* vlSelf); + +void Vtop___024root___eval_nba(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_nba\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((3ULL & vlSelfRef.__VnbaTriggered.word(0U))) { + Vtop___024root___nba_sequent__TOP__0(vlSelf); + } +} + +VL_INLINE_OPT void Vtop___024root___nba_sequent__TOP__0(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___nba_sequent__TOP__0\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + CData/*3:0*/ __Vtableidx1; + __Vtableidx1 = 0; + // Body + vlSelfRef.moore_ol__DOT__present_state = ((IData)(vlSelfRef.reset) + ? 0U + : (IData)(vlSelfRef.moore_ol__DOT__next_state)); + __Vtableidx1 = (((IData)(vlSelfRef.inp) << 3U) + | (IData)(vlSelfRef.moore_ol__DOT__present_state)); + vlSelfRef.moore_ol__DOT__next_state = Vtop__ConstPool__TABLE_h2cd11e3b_0 + [__Vtableidx1]; + if ((2U & Vtop__ConstPool__TABLE_hee47b28f_0[__Vtableidx1])) { + vlSelfRef.moore_ol__DOT__out = Vtop__ConstPool__TABLE_hbcbc6965_0 + [__Vtableidx1]; + } + vlSelfRef.out = vlSelfRef.moore_ol__DOT__out; +} + +void Vtop___024root___eval_triggers__act(Vtop___024root* vlSelf); + +bool Vtop___024root___eval_phase__act(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_phase__act\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + VlTriggerVec<2> __VpreTriggered; + CData/*0:0*/ __VactExecute; + // Body + Vtop___024root___eval_triggers__act(vlSelf); + __VactExecute = vlSelfRef.__VactTriggered.any(); + if (__VactExecute) { + __VpreTriggered.andNot(vlSelfRef.__VactTriggered, vlSelfRef.__VnbaTriggered); + vlSelfRef.__VnbaTriggered.thisOr(vlSelfRef.__VactTriggered); + Vtop___024root___eval_act(vlSelf); + } + return (__VactExecute); +} + +bool Vtop___024root___eval_phase__nba(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_phase__nba\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + CData/*0:0*/ __VnbaExecute; + // Body + __VnbaExecute = vlSelfRef.__VnbaTriggered.any(); + if (__VnbaExecute) { + Vtop___024root___eval_nba(vlSelf); + vlSelfRef.__VnbaTriggered.clear(); + } + return (__VnbaExecute); +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__ico(Vtop___024root* vlSelf); +#endif // VL_DEBUG +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__nba(Vtop___024root* vlSelf); +#endif // VL_DEBUG +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__act(Vtop___024root* vlSelf); +#endif // VL_DEBUG + +void Vtop___024root___eval(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + IData/*31:0*/ __VicoIterCount; + CData/*0:0*/ __VicoContinue; + IData/*31:0*/ __VnbaIterCount; + CData/*0:0*/ __VnbaContinue; + // Body + __VicoIterCount = 0U; + vlSelfRef.__VicoFirstIteration = 1U; + __VicoContinue = 1U; + while (__VicoContinue) { + if (VL_UNLIKELY(((0x64U < __VicoIterCount)))) { +#ifdef VL_DEBUG + Vtop___024root___dump_triggers__ico(vlSelf); +#endif + VL_FATAL_MT("design_active.v", 1, "", "Input combinational region did not converge."); + } + __VicoIterCount = ((IData)(1U) + __VicoIterCount); + __VicoContinue = 0U; + if (Vtop___024root___eval_phase__ico(vlSelf)) { + __VicoContinue = 1U; + } + vlSelfRef.__VicoFirstIteration = 0U; + } + __VnbaIterCount = 0U; + __VnbaContinue = 1U; + while (__VnbaContinue) { + if (VL_UNLIKELY(((0x64U < __VnbaIterCount)))) { +#ifdef VL_DEBUG + Vtop___024root___dump_triggers__nba(vlSelf); +#endif + VL_FATAL_MT("design_active.v", 1, "", "NBA region did not converge."); + } + __VnbaIterCount = ((IData)(1U) + __VnbaIterCount); + __VnbaContinue = 0U; + vlSelfRef.__VactIterCount = 0U; + vlSelfRef.__VactContinue = 1U; + while (vlSelfRef.__VactContinue) { + if (VL_UNLIKELY(((0x64U < vlSelfRef.__VactIterCount)))) { +#ifdef VL_DEBUG + Vtop___024root___dump_triggers__act(vlSelf); +#endif + VL_FATAL_MT("design_active.v", 1, "", "Active region did not converge."); + } + vlSelfRef.__VactIterCount = ((IData)(1U) + + vlSelfRef.__VactIterCount); + vlSelfRef.__VactContinue = 0U; + if (Vtop___024root___eval_phase__act(vlSelf)) { + vlSelfRef.__VactContinue = 1U; + } + } + if (Vtop___024root___eval_phase__nba(vlSelf)) { + __VnbaContinue = 1U; + } + } +} + +#ifdef VL_DEBUG +void Vtop___024root___eval_debug_assertions(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_debug_assertions\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if (VL_UNLIKELY(((vlSelfRef.inp & 0xfeU)))) { + Verilated::overWidthError("inp");} + if (VL_UNLIKELY(((vlSelfRef.clk & 0xfeU)))) { + Verilated::overWidthError("clk");} + if (VL_UNLIKELY(((vlSelfRef.reset & 0xfeU)))) { + Verilated::overWidthError("reset");} +} +#endif // VL_DEBUG diff --git a/tasks/task3/sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp b/tasks/task3/sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..732d7a90070de8c23b5ec217eeeb8809835717df --- /dev/null +++ b/tasks/task3/sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp @@ -0,0 +1,173 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop___024root.h" + +VL_ATTR_COLD void Vtop___024root___eval_static(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_static\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelfRef.__Vtrigprevexpr___TOP__clk__0 = vlSelfRef.clk; + vlSelfRef.__Vtrigprevexpr___TOP__reset__0 = vlSelfRef.reset; +} + +VL_ATTR_COLD void Vtop___024root___eval_initial(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_initial\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); +} + +VL_ATTR_COLD void Vtop___024root___eval_final(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_final\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__stl(Vtop___024root* vlSelf); +#endif // VL_DEBUG +VL_ATTR_COLD bool Vtop___024root___eval_phase__stl(Vtop___024root* vlSelf); + +VL_ATTR_COLD void Vtop___024root___eval_settle(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_settle\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + IData/*31:0*/ __VstlIterCount; + CData/*0:0*/ __VstlContinue; + // Body + __VstlIterCount = 0U; + vlSelfRef.__VstlFirstIteration = 1U; + __VstlContinue = 1U; + while (__VstlContinue) { + if (VL_UNLIKELY(((0x64U < __VstlIterCount)))) { +#ifdef VL_DEBUG + Vtop___024root___dump_triggers__stl(vlSelf); +#endif + VL_FATAL_MT("design_active.v", 1, "", "Settle region did not converge."); + } + __VstlIterCount = ((IData)(1U) + __VstlIterCount); + __VstlContinue = 0U; + if (Vtop___024root___eval_phase__stl(vlSelf)) { + __VstlContinue = 1U; + } + vlSelfRef.__VstlFirstIteration = 0U; + } +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__stl(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___dump_triggers__stl\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1U & (~ vlSelfRef.__VstlTriggered.any()))) { + VL_DBG_MSGF(" No triggers active\n"); + } + if ((1ULL & vlSelfRef.__VstlTriggered.word(0U))) { + VL_DBG_MSGF(" 'stl' region trigger index 0 is active: Internal 'stl' trigger - first iteration\n"); + } +} +#endif // VL_DEBUG + +void Vtop___024root___ico_sequent__TOP__0(Vtop___024root* vlSelf); + +VL_ATTR_COLD void Vtop___024root___eval_stl(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_stl\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1ULL & vlSelfRef.__VstlTriggered.word(0U))) { + Vtop___024root___ico_sequent__TOP__0(vlSelf); + } +} + +VL_ATTR_COLD void Vtop___024root___eval_triggers__stl(Vtop___024root* vlSelf); + +VL_ATTR_COLD bool Vtop___024root___eval_phase__stl(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___eval_phase__stl\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Init + CData/*0:0*/ __VstlExecute; + // Body + Vtop___024root___eval_triggers__stl(vlSelf); + __VstlExecute = vlSelfRef.__VstlTriggered.any(); + if (__VstlExecute) { + Vtop___024root___eval_stl(vlSelf); + } + return (__VstlExecute); +} + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__ico(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___dump_triggers__ico\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1U & (~ vlSelfRef.__VicoTriggered.any()))) { + VL_DBG_MSGF(" No triggers active\n"); + } + if ((1ULL & vlSelfRef.__VicoTriggered.word(0U))) { + VL_DBG_MSGF(" 'ico' region trigger index 0 is active: Internal 'ico' trigger - first iteration\n"); + } +} +#endif // VL_DEBUG + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__act(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___dump_triggers__act\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1U & (~ vlSelfRef.__VactTriggered.any()))) { + VL_DBG_MSGF(" No triggers active\n"); + } + if ((1ULL & vlSelfRef.__VactTriggered.word(0U))) { + VL_DBG_MSGF(" 'act' region trigger index 0 is active: @(posedge clk)\n"); + } + if ((2ULL & vlSelfRef.__VactTriggered.word(0U))) { + VL_DBG_MSGF(" 'act' region trigger index 1 is active: @(posedge reset)\n"); + } +} +#endif // VL_DEBUG + +#ifdef VL_DEBUG +VL_ATTR_COLD void Vtop___024root___dump_triggers__nba(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___dump_triggers__nba\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + if ((1U & (~ vlSelfRef.__VnbaTriggered.any()))) { + VL_DBG_MSGF(" No triggers active\n"); + } + if ((1ULL & vlSelfRef.__VnbaTriggered.word(0U))) { + VL_DBG_MSGF(" 'nba' region trigger index 0 is active: @(posedge clk)\n"); + } + if ((2ULL & vlSelfRef.__VnbaTriggered.word(0U))) { + VL_DBG_MSGF(" 'nba' region trigger index 1 is active: @(posedge reset)\n"); + } +} +#endif // VL_DEBUG + +VL_ATTR_COLD void Vtop___024root___ctor_var_reset(Vtop___024root* vlSelf) { + VL_DEBUG_IF(VL_DBG_MSGF("+ Vtop___024root___ctor_var_reset\n"); ); + Vtop__Syms* const __restrict vlSymsp VL_ATTR_UNUSED = vlSelf->vlSymsp; + auto& vlSelfRef = std::ref(*vlSelf).get(); + // Body + vlSelf->inp = VL_RAND_RESET_I(1); + vlSelf->clk = VL_RAND_RESET_I(1); + vlSelf->reset = VL_RAND_RESET_I(1); + vlSelf->out = VL_RAND_RESET_I(1); + vlSelf->moore_ol__DOT__inp = VL_RAND_RESET_I(1); + vlSelf->moore_ol__DOT__clk = VL_RAND_RESET_I(1); + vlSelf->moore_ol__DOT__reset = VL_RAND_RESET_I(1); + vlSelf->moore_ol__DOT__out = VL_RAND_RESET_I(1); + vlSelf->moore_ol__DOT__present_state = VL_RAND_RESET_I(3); + vlSelf->moore_ol__DOT__next_state = VL_RAND_RESET_I(3); + vlSelf->__Vtrigprevexpr___TOP__clk__0 = VL_RAND_RESET_I(1); + vlSelf->__Vtrigprevexpr___TOP__reset__0 = VL_RAND_RESET_I(1); +} diff --git a/tasks/task3/sim_build/Vtop___024root__Slow.cpp b/tasks/task3/sim_build/Vtop___024root__Slow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f84f3fb2409f4f971f322b827057e58dbe5932de --- /dev/null +++ b/tasks/task3/sim_build/Vtop___024root__Slow.cpp @@ -0,0 +1,32 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Design implementation internals +// See Vtop.h for the primary calling header + +#include "Vtop__pch.h" +#include "Vtop__Syms.h" +#include "Vtop___024root.h" + +// Parameter definitions for Vtop___024root +constexpr IData/*31:0*/ Vtop___024root::moore_ol__DOT__S0; +constexpr IData/*31:0*/ Vtop___024root::moore_ol__DOT__S1; +constexpr IData/*31:0*/ Vtop___024root::moore_ol__DOT__S2; +constexpr IData/*31:0*/ Vtop___024root::moore_ol__DOT__S3; +constexpr IData/*31:0*/ Vtop___024root::moore_ol__DOT__S4; + + +void Vtop___024root___ctor_var_reset(Vtop___024root* vlSelf); + +Vtop___024root::Vtop___024root(Vtop__Syms* symsp, const char* v__name) + : VerilatedModule{v__name} + , vlSymsp{symsp} + { + // Reset structure values + Vtop___024root___ctor_var_reset(this); +} + +void Vtop___024root::__Vconfigure(bool first) { + (void)first; // Prevent unused variable warning +} + +Vtop___024root::~Vtop___024root() { +} diff --git a/tasks/task3/sim_build/Vtop__pch.h b/tasks/task3/sim_build/Vtop__pch.h new file mode 100644 index 0000000000000000000000000000000000000000..e8a66ca476701a3366cc19b6cbb940b97e115de2 --- /dev/null +++ b/tasks/task3/sim_build/Vtop__pch.h @@ -0,0 +1,29 @@ +// Verilated -*- C++ -*- +// DESCRIPTION: Verilator output: Precompiled header +// +// Internal details; most user sources do not need this header, +// unless using verilator public meta comments. +// Suggest use Vtop.h instead. + + +#ifndef VERILATED_VTOP__PCH_H_ +#define VERILATED_VTOP__PCH_H_ // guard + +// GCC and Clang only will precompile headers (PCH) for the first header. +// So, make sure this is the one and only PCH. +// If multiple module's includes are needed, use individual includes. +#ifdef VL_PCH_INCLUDED +# error "Including multiple precompiled header files" +#endif +#define VL_PCH_INCLUDED + + +#include "verilated.h" +#include "verilated_dpi.h" + +#include "Vtop__Syms.h" +#include "Vtop.h" + +// Additional include files added using '--compiler-include' + +#endif // guard diff --git a/tasks/task3/sim_build/Vtop__ver.d b/tasks/task3/sim_build/Vtop__ver.d new file mode 100644 index 0000000000000000000000000000000000000000..c90e6fa1a6d5e4c2d9993d94f22bd7609bd6fbf8 --- /dev/null +++ b/tasks/task3/sim_build/Vtop__ver.d @@ -0,0 +1 @@ +sim_build/Vtop.cpp sim_build/Vtop.h sim_build/Vtop.mk sim_build/Vtop__ConstPool_0.cpp sim_build/Vtop__Dpi.cpp sim_build/Vtop__Dpi.h sim_build/Vtop__Syms.cpp sim_build/Vtop__Syms.h sim_build/Vtop___024root.h sim_build/Vtop___024root__DepSet_h84412442__0.cpp sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp sim_build/Vtop___024root__Slow.cpp sim_build/Vtop__pch.h sim_build/Vtop__ver.d sim_build/Vtop_classes.mk : /usr/local/bin/verilator_bin /usr/local/bin/verilator_bin /usr/local/share/verilator/include/verilated_std.sv /usr/local/share/verilator/include/verilated_std_waiver.vlt design_active.v diff --git a/tasks/task3/sim_build/Vtop__verFiles.dat b/tasks/task3/sim_build/Vtop__verFiles.dat new file mode 100644 index 0000000000000000000000000000000000000000..43f72d23e26d3a354380cd67f61fe68b704b33bb --- /dev/null +++ b/tasks/task3/sim_build/Vtop__verFiles.dat @@ -0,0 +1,24 @@ +# DESCRIPTION: Verilator output: Timestamp data for --skip-identical. Delete at will. +C "-cc --exe -Mdir sim_build --top-module moore_ol --timescale 1ns/1ps --vpi --public-flat-rw --prefix Vtop -o Vtop -LDFLAGS -Wl,-rpath,/mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/libs -L/mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/libs -lcocotbvpi_verilator design_active.v /mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/share/lib/verilator/verilator.cpp" +S 15982304 152497 1775633558 952547019 1775633558 952547019 "/usr/local/bin/verilator_bin" +S 6525 152673 1775633559 122559598 1775633559 122559598 "/usr/local/share/verilator/include/verilated_std.sv" +S 2787 152655 1775633559 112558860 1775633559 112558860 "/usr/local/share/verilator/include/verilated_std_waiver.vlt" +S 1366 28147497671156409 1775634401 268113500 1775634401 268113500 "design_active.v" +T 2992 2533274792294433 1775635229 290197400 1775635229 290197400 "sim_build/Vtop.cpp" +T 3508 2533274792294375 1775635229 289168500 1775635229 289168500 "sim_build/Vtop.h" +T 2326 1688849862164054 1775635229 323363300 1775635229 323363300 "sim_build/Vtop.mk" +T 718 2533274792294300 1775635229 286551000 1775635229 286551000 "sim_build/Vtop__ConstPool_0.cpp" +T 669 3096224745715565 1775635229 283739300 1775635229 283739300 "sim_build/Vtop__Dpi.cpp" +T 520 2814749769004801 1775635229 281618100 1775635229 281618100 "sim_build/Vtop__Dpi.h" +T 3370 5348024559400588 1775635229 275753100 1775635229 275753100 "sim_build/Vtop__Syms.cpp" +T 1113 6192449489532620 1775635229 278427500 1775635229 278427500 "sim_build/Vtop__Syms.h" +T 1691 2533274792294673 1775635229 295712800 1775635229 295712800 "sim_build/Vtop___024root.h" +T 1831 1688849862164024 1775635229 304095200 1775635229 304095200 "sim_build/Vtop___024root__DepSet_h84412442__0.cpp" +T 845 2533274792295674 1775635229 300041300 1775635229 300041300 "sim_build/Vtop___024root__DepSet_h84412442__0__Slow.cpp" +T 8594 1688849862164025 1775635229 307948300 1775635229 307948300 "sim_build/Vtop___024root__DepSet_heccd7ead__0.cpp" +T 7002 1688849862163707 1775635229 302063100 1775635229 302063100 "sim_build/Vtop___024root__DepSet_heccd7ead__0__Slow.cpp" +T 961 2533274792295670 1775635229 297389400 1775635229 297389400 "sim_build/Vtop___024root__Slow.cpp" +T 773 3096224745715874 1775635229 291687000 1775635229 291687000 "sim_build/Vtop__pch.h" +T 714 3377699722428001 1775635229 326931800 1775635229 326931800 "sim_build/Vtop__ver.d" +T 0 0 1775635229 329045800 1775635229 329045800 "sim_build/Vtop__verFiles.dat" +T 1791 1688849862164053 1775635229 310027200 1775635229 310027200 "sim_build/Vtop_classes.mk" diff --git a/tasks/task3/sim_build/Vtop_classes.mk b/tasks/task3/sim_build/Vtop_classes.mk new file mode 100644 index 0000000000000000000000000000000000000000..ae218669691103d1e04241be6f1d2ea74ac4b481 --- /dev/null +++ b/tasks/task3/sim_build/Vtop_classes.mk @@ -0,0 +1,58 @@ +# Verilated -*- Makefile -*- +# DESCRIPTION: Verilator output: Make include file with class lists +# +# This file lists generated Verilated files, for including in higher level makefiles. +# See Vtop.mk for the caller. + +### Switches... +# C11 constructs required? 0/1 (always on now) +VM_C11 = 1 +# Timing enabled? 0/1 +VM_TIMING = 0 +# Coverage output mode? 0/1 (from --coverage) +VM_COVERAGE = 0 +# Parallel builds? 0/1 (from --output-split) +VM_PARALLEL_BUILDS = 0 +# Tracing output mode? 0/1 (from --trace-fst/--trace-saif/--trace-vcd) +VM_TRACE = 0 +# Tracing output mode in FST format? 0/1 (from --trace-fst) +VM_TRACE_FST = 0 +# Tracing output mode in SAIF format? 0/1 (from --trace-saif) +VM_TRACE_SAIF = 0 +# Tracing output mode in VCD format? 0/1 (from --trace-vcd) +VM_TRACE_VCD = 0 + +### Object file lists... +# Generated module classes, fast-path, compile with highest optimization +VM_CLASSES_FAST += \ + Vtop \ + Vtop___024root__DepSet_h84412442__0 \ + Vtop___024root__DepSet_heccd7ead__0 \ + +# Generated module classes, non-fast-path, compile with low/medium optimization +VM_CLASSES_SLOW += \ + Vtop__ConstPool_0 \ + Vtop___024root__Slow \ + Vtop___024root__DepSet_h84412442__0__Slow \ + Vtop___024root__DepSet_heccd7ead__0__Slow \ + +# Generated support classes, fast-path, compile with highest optimization +VM_SUPPORT_FAST += \ + Vtop__Dpi \ + +# Generated support classes, non-fast-path, compile with low/medium optimization +VM_SUPPORT_SLOW += \ + Vtop__Syms \ + +# Global classes, need linked once per executable, fast-path, compile with highest optimization +VM_GLOBAL_FAST += \ + verilated \ + verilated_dpi \ + verilated_vpi \ + verilated_threads \ + +# Global classes, need linked once per executable, non-fast-path, compile with low/medium optimization +VM_GLOBAL_SLOW += \ + + +# Verilated -*- Makefile -*- diff --git a/tasks/task3/sim_build/sim.vvp b/tasks/task3/sim_build/sim.vvp index ef801adec86ab513ba67908e2b1d1bae38df49e9..cb93c3706e63ae52943d29339047bd404debe428 100644 --- a/tasks/task3/sim_build/sim.vvp +++ b/tasks/task3/sim_build/sim.vvp @@ -8,49 +8,49 @@ :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/v2005_math.vpi"; :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/va_math.vpi"; :vpi_module "/usr/lib/x86_64-linux-gnu/ivl/v2009.vpi"; -S_0x55abb9c154c0 .scope package, "$unit" "$unit" 2 1; +S_0x55b3570f94c0 .scope package, "$unit" "$unit" 2 1; .timescale -9 -12; -S_0x55abb9c15650 .scope module, "moore_ol" "moore_ol" 3 1; +S_0x55b3570f9650 .scope module, "moore_ol" "moore_ol" 3 1; .timescale -9 -12; .port_info 0 /INPUT 1 "inp"; .port_info 1 /INPUT 1 "clk"; .port_info 2 /INPUT 1 "reset"; .port_info 3 /OUTPUT 1 "out"; -P_0x55abb9c3dff0 .param/l "S0" 0 3 10, +C4<00000000000000000000000000000000>; -P_0x55abb9c3e030 .param/l "S1" 0 3 10, +C4<00000000000000000000000000000001>; -P_0x55abb9c3e070 .param/l "S2" 0 3 10, +C4<00000000000000000000000000000010>; -P_0x55abb9c3e0b0 .param/l "S3" 0 3 10, +C4<00000000000000000000000000000011>; -P_0x55abb9c3e0f0 .param/l "S4" 0 3 10, +C4<00000000000000000000000000000100>; -o0x7fb2a700a018 .functor BUFZ 1, C4; HiZ drive -v0x55abb9c3e450_0 .net "clk", 0 0, o0x7fb2a700a018; 0 drivers -o0x7fb2a700a048 .functor BUFZ 1, C4; HiZ drive -v0x55abb9c64400_0 .net "inp", 0 0, o0x7fb2a700a048; 0 drivers -v0x55abb9c644c0_0 .var "next_state", 2 0; -v0x55abb9c645b0_0 .var "out", 0 0; -v0x55abb9c64670_0 .var "present_state", 2 0; -o0x7fb2a700a108 .functor BUFZ 1, C4; HiZ drive -v0x55abb9c64750_0 .net "reset", 0 0, o0x7fb2a700a108; 0 drivers -E_0x55abb9c4e790 .event anyedge, v0x55abb9c64400_0, v0x55abb9c64670_0; -E_0x55abb9c4f1d0 .event posedge, v0x55abb9c64750_0, v0x55abb9c3e450_0; - .scope S_0x55abb9c15650; +P_0x55b357121ff0 .param/l "S0" 0 3 10, +C4<00000000000000000000000000000000>; +P_0x55b357122030 .param/l "S1" 0 3 10, +C4<00000000000000000000000000000001>; +P_0x55b357122070 .param/l "S2" 0 3 10, +C4<00000000000000000000000000000010>; +P_0x55b3571220b0 .param/l "S3" 0 3 10, +C4<00000000000000000000000000000011>; +P_0x55b3571220f0 .param/l "S4" 0 3 10, +C4<00000000000000000000000000000100>; +o0x7f28f2137018 .functor BUFZ 1, C4; HiZ drive +v0x55b357122450_0 .net "clk", 0 0, o0x7f28f2137018; 0 drivers +o0x7f28f2137048 .functor BUFZ 1, C4; HiZ drive +v0x55b357148400_0 .net "inp", 0 0, o0x7f28f2137048; 0 drivers +v0x55b3571484c0_0 .var "next_state", 2 0; +v0x55b3571485b0_0 .var "out", 0 0; +v0x55b357148670_0 .var "present_state", 2 0; +o0x7f28f2137108 .functor BUFZ 1, C4; HiZ drive +v0x55b357148750_0 .net "reset", 0 0, o0x7f28f2137108; 0 drivers +E_0x55b357132790 .event anyedge, v0x55b357148400_0, v0x55b357148670_0; +E_0x55b3571331d0 .event posedge, v0x55b357148750_0, v0x55b357122450_0; + .scope S_0x55b3570f9650; T_0 ; - %wait E_0x55abb9c4f1d0; - %load/vec4 v0x55abb9c64750_0; + %wait E_0x55b3571331d0; + %load/vec4 v0x55b357148750_0; %flag_set/vec4 8; %jmp/0xz T_0.0, 8; %pushi/vec4 0, 0, 3; - %assign/vec4 v0x55abb9c64670_0, 0; + %assign/vec4 v0x55b357148670_0, 0; %jmp T_0.1; T_0.0 ; - %load/vec4 v0x55abb9c644c0_0; - %assign/vec4 v0x55abb9c64670_0, 0; + %load/vec4 v0x55b3571484c0_0; + %assign/vec4 v0x55b357148670_0, 0; T_0.1 ; %jmp T_0; .thread T_0; - .scope S_0x55abb9c15650; + .scope S_0x55b3570f9650; T_1 ; - %wait E_0x55abb9c4e790; - %load/vec4 v0x55abb9c64670_0; + %wait E_0x55b357132790; + %load/vec4 v0x55b357148670_0; %dup/vec4; %pushi/vec4 0, 0, 3; %cmp/u; @@ -72,77 +72,77 @@ T_1 ; %cmp/u; %jmp/1 T_1.4, 6; %pushi/vec4 0, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; %jmp T_1.6; T_1.0 ; - %load/vec4 v0x55abb9c64400_0; + %load/vec4 v0x55b357148400_0; %flag_set/vec4 8; %jmp/0xz T_1.7, 8; %pushi/vec4 1, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; %jmp T_1.8; T_1.7 ; %pushi/vec4 0, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; T_1.8 ; %pushi/vec4 0, 0, 1; - %store/vec4 v0x55abb9c645b0_0, 0, 1; + %store/vec4 v0x55b3571485b0_0, 0, 1; %jmp T_1.6; T_1.1 ; - %load/vec4 v0x55abb9c64400_0; + %load/vec4 v0x55b357148400_0; %flag_set/vec4 8; %jmp/0xz T_1.9, 8; %pushi/vec4 2, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; %jmp T_1.10; T_1.9 ; %pushi/vec4 0, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; T_1.10 ; %pushi/vec4 0, 0, 1; - %store/vec4 v0x55abb9c645b0_0, 0, 1; + %store/vec4 v0x55b3571485b0_0, 0, 1; %jmp T_1.6; T_1.2 ; - %load/vec4 v0x55abb9c64400_0; + %load/vec4 v0x55b357148400_0; %flag_set/vec4 8; %jmp/0xz T_1.11, 8; - %pushi/vec4 2, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %pushi/vec4 3, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; %jmp T_1.12; T_1.11 ; - %pushi/vec4 3, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %pushi/vec4 0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; T_1.12 ; %pushi/vec4 0, 0, 1; - %store/vec4 v0x55abb9c645b0_0, 0, 1; + %store/vec4 v0x55b3571485b0_0, 0, 1; %jmp T_1.6; T_1.3 ; - %load/vec4 v0x55abb9c64400_0; + %load/vec4 v0x55b357148400_0; %flag_set/vec4 8; %jmp/0xz T_1.13, 8; %pushi/vec4 4, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; %jmp T_1.14; T_1.13 ; %pushi/vec4 0, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; T_1.14 ; %pushi/vec4 0, 0, 1; - %store/vec4 v0x55abb9c645b0_0, 0, 1; + %store/vec4 v0x55b3571485b0_0, 0, 1; %jmp T_1.6; T_1.4 ; - %load/vec4 v0x55abb9c64400_0; + %load/vec4 v0x55b357148400_0; %flag_set/vec4 8; %jmp/0xz T_1.15, 8; %pushi/vec4 2, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; %jmp T_1.16; T_1.15 ; %pushi/vec4 0, 0, 3; - %store/vec4 v0x55abb9c644c0_0, 0, 3; + %store/vec4 v0x55b3571484c0_0, 0, 3; T_1.16 ; %pushi/vec4 1, 0, 1; - %store/vec4 v0x55abb9c645b0_0, 0, 1; + %store/vec4 v0x55b3571485b0_0, 0, 1; %jmp T_1.6; T_1.6 ; %pop/vec4 1; diff --git a/tasks/task3/sim_build/verilated.d b/tasks/task3/sim_build/verilated.d new file mode 100644 index 0000000000000000000000000000000000000000..33b20989f85f189b4facc333c18162bde9ad1811 --- /dev/null +++ b/tasks/task3/sim_build/verilated.d @@ -0,0 +1,12 @@ +verilated.o: /usr/local/share/verilator/include/verilated.cpp \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_imp.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/verilated_syms.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/verilated_threads.h \ + /usr/local/share/verilator/include/verilated_trace.h \ + /usr/local/share/verilator/include/verilatedos_c.h diff --git a/tasks/task3/sim_build/verilated.o b/tasks/task3/sim_build/verilated.o new file mode 100644 index 0000000000000000000000000000000000000000..2d51f088859acb7158634b8b97ec313ff02938c4 --- /dev/null +++ b/tasks/task3/sim_build/verilated.o @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1d2edda4f644db03fd038b6221b9ce178237c0885957111ee515d6473fd895b7 +size 233592 diff --git a/tasks/task3/sim_build/verilated_dpi.d b/tasks/task3/sim_build/verilated_dpi.d new file mode 100644 index 0000000000000000000000000000000000000000..674a8230bf0b598187a9afb9dbaf52508a7671a4 --- /dev/null +++ b/tasks/task3/sim_build/verilated_dpi.d @@ -0,0 +1,12 @@ +verilated_dpi.o: /usr/local/share/verilator/include/verilated_dpi.cpp \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_dpi.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/vltstd/svdpi.h \ + /usr/local/share/verilator/include/verilated_imp.h \ + /usr/local/share/verilator/include/verilated_syms.h \ + /usr/local/share/verilator/include/vltstd/svdpi.h diff --git a/tasks/task3/sim_build/verilated_dpi.o b/tasks/task3/sim_build/verilated_dpi.o new file mode 100644 index 0000000000000000000000000000000000000000..648516bf4d297ff3734f4852c3b16fa860c493c7 Binary files /dev/null and b/tasks/task3/sim_build/verilated_dpi.o differ diff --git a/tasks/task3/sim_build/verilated_threads.d b/tasks/task3/sim_build/verilated_threads.d new file mode 100644 index 0000000000000000000000000000000000000000..c850804111cbe66e5214f2f6821d39b2989ef590 --- /dev/null +++ b/tasks/task3/sim_build/verilated_threads.d @@ -0,0 +1,8 @@ +verilated_threads.o: \ + /usr/local/share/verilator/include/verilated_threads.cpp \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_threads.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h diff --git a/tasks/task3/sim_build/verilated_threads.o b/tasks/task3/sim_build/verilated_threads.o new file mode 100644 index 0000000000000000000000000000000000000000..a5850df71155e74ff9918ce7455268d1669559d8 Binary files /dev/null and b/tasks/task3/sim_build/verilated_threads.o differ diff --git a/tasks/task3/sim_build/verilated_vpi.d b/tasks/task3/sim_build/verilated_vpi.d new file mode 100644 index 0000000000000000000000000000000000000000..b02da8e1f395b53313108b7846745c3c6d8dc6e4 --- /dev/null +++ b/tasks/task3/sim_build/verilated_vpi.d @@ -0,0 +1,13 @@ +verilated_vpi.o: /usr/local/share/verilator/include/verilated_vpi.cpp \ + /usr/local/share/verilator/include/verilated_vpi.h \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/verilated_syms.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/vltstd/sv_vpi_user.h \ + /usr/local/share/verilator/include/vltstd/vpi_user.h \ + /usr/local/share/verilator/include/verilated_imp.h \ + /usr/local/share/verilator/include/vltstd/vpi_user.h diff --git a/tasks/task3/sim_build/verilated_vpi.o b/tasks/task3/sim_build/verilated_vpi.o new file mode 100644 index 0000000000000000000000000000000000000000..09c51e9a569f6c3b8c15b298c5b037aec2513c63 --- /dev/null +++ b/tasks/task3/sim_build/verilated_vpi.o @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:68715e90d84a5a87f2765d14b91e0cfb3231b20adf84d426d7e0d92aa0b03e0a +size 217616 diff --git a/tasks/task3/sim_build/verilator.d b/tasks/task3/sim_build/verilator.d new file mode 100644 index 0000000000000000000000000000000000000000..13fc9d74cab9d073dd147e4418c08fc708dfcbe1 --- /dev/null +++ b/tasks/task3/sim_build/verilator.d @@ -0,0 +1,14 @@ +verilator.o: \ + /mnt/c/Users/npkas/Agentic-RL/open_venv/lib/python3.12/site-packages/cocotb/share/lib/verilator/verilator.cpp \ + Vtop.h /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilatedos.h \ + /usr/local/share/verilator/include/verilated_config.h \ + /usr/local/share/verilator/include/verilated_types.h \ + /usr/local/share/verilator/include/verilated_funcs.h \ + /usr/local/share/verilator/include/vltstd/svdpi.h \ + /usr/local/share/verilator/include/verilated_vpi.h \ + /usr/local/share/verilator/include/verilated.h \ + /usr/local/share/verilator/include/verilated_syms.h \ + /usr/local/share/verilator/include/verilated_sym_props.h \ + /usr/local/share/verilator/include/vltstd/sv_vpi_user.h \ + /usr/local/share/verilator/include/vltstd/vpi_user.h diff --git a/tasks/task3/sim_build/verilator.o b/tasks/task3/sim_build/verilator.o new file mode 100644 index 0000000000000000000000000000000000000000..d6e4de1527300e8e5db99b7652c13ad107912503 Binary files /dev/null and b/tasks/task3/sim_build/verilator.o differ diff --git a/tasks/task3/test_moore_1101.py b/tasks/task3/test_moore_1101.py index 838e8878e29c300c73f65bb5395a6769a77476f3..13ce0f0cd7b9d6c3775467acbf2a88ab27fa49b9 100644 --- a/tasks/task3/test_moore_1101.py +++ b/tasks/task3/test_moore_1101.py @@ -50,10 +50,11 @@ async def test_moore_1101(dut): dut.reset.value = 1 dut.inp.value = 0 await RisingEdge(dut.clk) - await RisingEdge(dut.clk) - dut.reset.value = 0 - test_seq = [0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0] + await Timer(1, units="ns") + + + test_seq = [0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1] # slightly extended sequence to heavily test overlaps results = [] passed = True first_error_cycle = None @@ -114,12 +115,18 @@ async def test_moore_1101(dut): # f"State {err['expected_next_state']} ({STATE_MAP.get(err['expected_next_state'])})." # ) + # Calculate new detailed grading metrics based on tracking arrays + + seq_correct = sum(1 for r in results if r["actual_output"] == r["expected_output"]) + trans_correct = sum(1 for r in results if r["transition_to"] == r["expected_next_state"]) + summary = { "passed": passed, - # "first_error_hint": error_msg, "num_tests": len(test_seq), "num_passed": sum(1 for r in results if r["pass"]), "results": results, + "sequence_correctness": seq_correct, + "transition_correctness": trans_correct, "simulation_time": get_sim_time("ns") }