]> Devi Nivas Git - sij-ddsp26.git/commitdiff
Initial commit
authorAdvaith Menon <amenon301@gatech.edu>
Thu, 5 Feb 2026 02:02:10 +0000 (21:02 -0500)
committerAdvaith Menon <amenon301@gatech.edu>
Thu, 5 Feb 2026 02:02:10 +0000 (21:02 -0500)
* Based on Fall 2025

37 files changed:
.gitignore [new file with mode: 0644]
README.md [new file with mode: 0644]
resources/calculator.drawio.png [new file with mode: 0644]
resources/cycle_count.png [new file with mode: 0644]
resources/hdlbit-roadmap.md [new file with mode: 0644]
resources/sram_addressing.drawio.png [new file with mode: 0644]
resources/suggested_fsm.drawio.png [new file with mode: 0644]
resources/timing_diagram.jpg [new file with mode: 0644]
screenshots/Add_to_wave_view.png [new file with mode: 0644]
screenshots/Change_radix.png [new file with mode: 0644]
screenshots/Initial_View.png [new file with mode: 0644]
screenshots/cycle_count.png [new file with mode: 0644]
screenshots/example_submission.png [new file with mode: 0644]
screenshots/fastxSetup1.png [new file with mode: 0644]
screenshots/fastxSetup2.png [new file with mode: 0644]
screenshots/fastxSetup3.png [new file with mode: 0644]
screenshots/simvision.png [new file with mode: 0644]
scripts/check_onboarding.py [new file with mode: 0644]
scripts/init_mem.py [new file with mode: 0644]
sim/behav/Include/calculator.include [new file with mode: 0644]
sim/behav/Makefile [new symlink]
sim/behav/link_files.py [new file with mode: 0644]
sim/behav/mismatches.txt [new file with mode: 0644]
sim/behav/simvision.svcf [new file with mode: 0644]
src/Makefiles/Makefile [new file with mode: 0644]
src/python_model/memory_post_state [new file with mode: 0644]
src/python_model/memory_pre_state [new file with mode: 0644]
src/python_model/new_dd_onboarding.ipynb [new file with mode: 0644]
src/verilog/.adder32.sv.swn [new file with mode: 0644]
src/verilog/CF_SRAM_1024x32.tt_180V_25C.v [new file with mode: 0644]
src/verilog/adder32.sv [new file with mode: 0644]
src/verilog/calculator_pkg.sv [new file with mode: 0644]
src/verilog/controller.sv [new file with mode: 0644]
src/verilog/full_adder.sv [new file with mode: 0644]
src/verilog/result_buffer.sv [new file with mode: 0644]
src/verilog/tb_calculator.sv [new file with mode: 0644]
src/verilog/top_lvl.sv [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..49f1013
--- /dev/null
@@ -0,0 +1 @@
+WORKSPACE
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..14900c8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,277 @@
+# Project Overview
+
+Welcome to the Digital Design Team of SiliconJackets!
+
+For your onboarding project, you'll design a SystemVerilog calculator that performs 64-bit unsigned integer addition by combining two 32-bit sums. This project introduces you to logic design, RTL coding, FSM-based control, and functional verification. You'll also familiarize yourself with our tools and team workflows. If you get stuck or need clarification, don’t hesitate to ask questions!
+
+---
+
+## Requirements
+
+You will build a 64-bit calculator system using these key modules:
+- **adder32.sv** – adds two 32-bit values with carry-in and out
+- **result_buffer.sv** – stores results in a 64-bit register (upper/lower controlled by a select signal)
+- **controller.sv** – manages reads, writes, adder operation, and sequencing via an FSM
+- **top_lvl.sv** - serves as the top level chip file
+- **adder32.sv** - a 32-bit adder built using 32 full adders, connected using generate statements
+- There are also other files which you **do not** need to edit, but a description can be found at the top to help you understand their function.
+- Additional descriptions of each module are provided within their respective sv files. 
+
+In general, your controller should be adding two 64-bit numbers stored in SRAM by reading the lower 32-bits of each number, adding them, storing the result in the lower half of the result buffer, then reading the upper 32-bits of each number, adding them, and storing the result in the upper half of the result buffer. Finally, the controller should write the full 64-bit result back to SRAM.
+
+As an example, the controller should add the first two addresses of SRAM (each containing 64-bit numbers) starting from `read_start_addr` and write the result to the address starting from `write_start_addr`. The controller should then move on to the third and fourth read addresses, and writing to the second write address, and so on until all additions are complete.There should be 128 64bit writes in total.
+
+Your task is to implement each module with correct input/output handling, FSM-based control, and memory-mapped behavior. There are specific //TODO: comments in the code with hints on what to do, so it is possible to complete the task without extensive modifications to the provided code.
+
+<img width="961" alt="image" src="./resources/calculator.drawio.png">
+
+## Optional Challenge
+For an additional challenge, put yourself in the perspective of an RTL designer who is latency-constrained. The provided testbench has a built in cycle counter that will print out how many cycles your design took to complete all additions. Try to minimize this number by optimizing your controller FSM and module interactions. If you choose to do this, please mention your design's cycle count during your submission or in-person check-off. Note that this is optional and will not affect your ability to get checked off. There is no target performance, just try to make it as low as possible!
+
+
+<img width="961" alt="image" src="./resources/cycle_count.png">
+
+
+--- 
+
+## Submission Disclaimers 
+- **Any submissions after 11:59pm on the deadline 2/8/2026 will not be considered under any circumstance.** Make sure your submission is correct before the deadline :) 
+- Incorrect submissions after the deadline will also not be permitted to pass onto the next stage. This is to protect the sanity of reviewing leads, ensure subsequent onboarding stages progress smoothly, and encourage starting earlier.
+- You may collaborate with friends but you can not share code. This is to ensure you develop the skills to contribute meaningfully in the club.
+- AI usage for understanding is encouraged, but using AI to write verilog is not allowed. AI is also very bad at hardware description languages, and there are a few "tells" which makes it easier to detect. Detected AI useage will not be passed onto the next phase.
+- Please do not share ECE virtual server access. This is a GT ECE policy, so request and setup ECE server access early.
+
+
+---
+
+
+## Instructions  
+### 0. Reference Materials (Optional – read as needed)
+
+- **[Verilog basics](https://nandland.com/introduction-to-verilog-for-beginners-with-code-examples/)**
+- **[SystemVerilog Basics](https://www.chipverify.com/tutorials/systemverilog)**
+- **[HDLBits Verilog Lessons](https://hdlbits.01xz.net/wiki/Problem_sets)**  
+  > Note: HDLBits uses Verilog (`wire`, `reg`). In SystemVerilog, use `logic` instead.
+- **SystemVerilog vs. Verilog:** SystemVerilog uses `logic` (a unified type) instead of Verilog’s `wire` and `reg`.
+- **[SystemVerilog Spec (Advanced/Optional)](https://rfsoc.mit.edu/6S965/_static/F24/documentation/1800-2017.pdf)**
+- **[ChipDev.io Practices (Optional)](http://chipdev.io/question-list)**
+  
+  Reference resources/hdlbit-roadmap.md for a suggested learning path.
+
+---
+
+
+### 1. Adder Module (adder32.sv)  
+Build a 32-bit addition module. Requirements:
+- Compute sum of two 32-bit unsigned integers
+- Output the 32-bit result
+- Use the generate function to create 32 1-bit adders
+- Reference: https://www.chipverify.com/verilog/verilog-generate-block 
+
+---
+
+### 2. Result Buffer (result_buffer.sv)
+Create a buffer module that:
+- Stores a 64-bit result
+- Accepts a 32-bit result input
+- Uses a 1-bit control signal to place the 32-bit input in either the upper or lower half of the 64-bit buffer
+- Resets synchronously
+
+---
+
+### 3. FSM Diagram
+Create a finite state machine (FSM) diagram for your **controller** module. This is the suggested outline of states and transitions:  
+<img width="961" alt="image" src="./resources/suggested_fsm.drawio.png">
+
+---
+
+### 4. Controller Module (controller.sv)
+Implement a finite state machine (FSM) that:
+- Begins computation on reset release
+- Sequences through read, process, and write operations
+- Pulses output signals when results are ready
+- Your controller should read/write data on the SRAM module as shown on the functional block diagram 
+
+This module manages all coordination among memory, the adder, and the result buffer.  
+
+---
+
+### 5. Chip Top (top_lvl.sv)
+- The purpose of this file is to connect everything together. Your task is to use your understanding of surrounding declarations to "fill in the blank" 
+- Your task is to connect the SRAM to the file itself. The wireframe already exists, but you should connect it to your logic in the top_lvl.sv file. 
+- Optional: To understand how the SRAM macro pins works, use this link
+- https://chipfoundry.io/commercial-sram-macro
+- Here is a timing diagram to help you understand how the SRAM works:  
+<img width="961" alt="image" src="./resources/timing_diagram.jpg">
+Please note that we are using a functional model of the SRAM, so you can safely ignore timing-related details like setup/hold times. You can transition signals on clock edges without worrying about timing violations. Focus on the logical sequence of operations instead. You will deal with timing more when you work on real modules for the club.
+---  
+
+### 6. Coding Guidelines
+- Use `always_comb` and `always_ff` appropriately
+- Use **blocking (`=`)** for combinational logic and **non-blocking (`<=`)** for sequential logic
+- Avoid `%` or other expensive arithmetic unless explicitly allowed
+
+---
+
+### 7. (Optional) Testbench Enhancement
+Add more test cases to your testbench to strengthen verification.
+
+---
+
+### 8. Results Report For Online Submission (PDF)
+We offer the option to submit your onboarding and get checked off in-person instead of online, but if you choose to submit online, please attach a PDF report including the following:
+- Waveform screenshot(s) showing module behavior and outputs
+- 1–2 paragraph explanation of the waveform behavior and why it's correct
+
+---
+
+### 9. Final Check-in (Optional)
+Check briefly with team leads before the onboarding deadline to conduct a quick review of your RTL for synthesizability. Synthesizability will be checked when you submit your final onboarding, and you will not pass if your design is not synthesizable. We recommend checking in early to avoid last-minute issues. Common synthesizability issues include:
+- Using unsupported constructs (e.g., `initial` blocks, delays)
+- Dollar sign system tasks (e.e., $log2) used in functional signals
+- Unbounded while loops
+
+---
+
+## Getting Started
+
+1. Sign the EULA agreement for Cadence tools (https://eulas.ece.gatech.edu/Cadence/)
+    - Under Primary GT Affiliation -> Select "Researcher or Staff"
+    - Your Title: "Student"
+    - ECE Faculty Advisor / Professor Name : "Visvesh S Sathe"
+    - ECE Faculty Advisor / Professor Email: "sathe@gatech.edu"
+    - Software needed for -> "Research"
+    - Research Project Name : "SiliconJackets"
+    - Agree to Cadence agreement
+2. Download Georgia Tech VPN (https://vpn.gatech.edu/global-protect/getsoftwarepage.esp)
+3. Log into the GlobalProtect VPN once downloaded(portal: vpn.gatech.edu)  
+    - use your school username and password
+    - 'push1' sends a push to DUO, 'phone1' gives you an automated phone call
+4. Download FastX or MobaXterm (or your preferred remote Terminal Emulator)
+    - FastX (https://www.starnet.com/download-fastx-client/)
+    - MobaXterm (https://mobaxterm.mobatek.net/download-home-edition.html)
+5. Log in remotely to ECE Research server
+    - The setup will be similar but different depending on the terminal emulator you choose
+    - The following instructions work for FastX, but ask if you need help setting up with MobaXterm
+    - Ensure you are connected to GT VPN
+    - Open FastX Client
+    - File->Connections. Click the plus sign to add a connection.
+    - Host:  ece-rschsrv.ece.gatech.edu
+    - Username: <your_GT_username>
+    - Port: 22
+    - Name: Whatever you want to call the connection
+    - Here is an example of what your screen should look like:
+    - ![image](./screenshots/fastxSetup1.png)
+    - Connect to the session and type in your GT password at the prompt
+    - Click the plus sign and then "xterm"
+    - ![image](./screenshots/fastxSetup2.png)
+    - You should now be remotely connected to the Research server Linux terminal 
+    - ![image](./screenshots/fastxSetup3.png)
+  
+6. run the tcsh command to switch to c-shell. This command needs to be run every time you log into the server.
+7. Add the following line to your ~/.my-cshrc file: source /tools/software/cadence/setup.csh. This will allow you to run the commands for cadence tools if you have gotten your EULA approved. (your ~/.my-cshrc file might be empty up until now, so just make this the first line). This is how you can do this: return to your home directory by running "cd ~". Then, do "nano ~/.my-cshrc" to enter the config file. Copy the line provided into it, then hit ctrl + the letter "o", then hit enter to save. Then hit ctrl + x to quit. To apply the changes, type "source ~/.my-cshrc". Now, typing xrun should not show an error. 
+8. Clone this repo into the linux server. This is done using git clone url <--replace url with github-provided url. You might be prompted to input your username and password for git. 
+9.  At this point, you can write your code in the files within the src folder. 
+10. To see your waveforms, change directory into sim/behav and run the command __make link__ . If you are unfamiliar with the linux terminal, read this [article](https://www.hostinger.com/tutorials/linux-commands?utm_campaign=Generic-Tutorials-DSA|NT:SE|LO:USA&utm_medium=ppc&gad_source=1&gad_campaignid=20027522868&gbraid=0AAAAADMy-hYjLhKiHPvplnMB_BIAldozR&gclid=Cj0KCQjwzaXFBhDlARIsAFPv-u-bnckMRN43R_4lbPDlpdZdL66msX8hXGlCMpWa6KpdSEYULiDg-bcaAh0mEALw_wcB). You probably only need mkdir, ls, cd. 
+11. Run the command "make xrun". This might take a second. 
+12. Run the command "make simulation".
+13. Once the GUI has popped up, you should be able to drag the module into variable section, whereby the signals will appear on the right.
+
+---
+
+## DELIVERABLES, More Succinctly
+
+**a.** A working adder, buffer, and controller module (all pass simulation and testbench)
+
+**b.** A write-up if you are submitting online(.docx or preferably .pdf) showing:
+- Simulation passing screenshots
+- Waveforms
+- An explanation of correctness
+
+**c.** FSM diagram for your controller
+
+---
+
+## Directory Overview
+
+Here's what's going on in this onboarding project's directory:
+
+### `scripts/`
+Python scripts for generating test vectors.
+
+### `src/`
+Your Verilog source files
+
+#### `src/verilog/`
+Write your modules here (adder, controller, result buffer)
+
+##### `sim/behav/include/calculator.include`
+Tells Xcelium which files to compile
+
+##### `src/verilog/tb_*.sv`
+Testbenches for your modules
+
+### `sim/behav/`
+Behavioral simulation (run `make` here to simulate your design)
+
+### `resources/`
+Diagrams and images to help you understand the design
+
+---
+
+## Makefile Commands
+
+The following make commands are available in the `sim/behav/` directory:
+
+**`make help`**  
+Display the help message showing all available make commands and their descriptions.
+
+**`make clean`**  
+Remove the WORKSPACE directory and all generated files. Use this to start fresh before running new simulations.
+
+**`make link`**  
+Generate symbolic links in WORKSPACE/sym_links/ directory. This creates links to source files based on the include file (default: calculator.include). Links are managed by the link_files.py Python script.
+
+**`make xrun`**  
+Compile and simulate the design using Cadence Xcelium simulator. 
+
+**`make simvision`**  
+Open SimVision waveform viewer to view the waves.shm waveform database generated by the simulation. 
+
+**`make run_and_view`** *(Default target)*  
+Convenience command that sequentially runs both `xrun` and `simvision`. Compiles, simulates, and immediately opens the waveform viewer.
+
+**`make coverage`**  
+Open IMC (Incisive Metrics Center) to view code coverage results from the simulation. Loads the coverage database from cov_work/scope/test.
+
+**`make verify_onboarding`** *(Digital Design Onboarding Only)*  
+Complete verification flow that checks project correctness. 
+
+
+
+
+---
+
+## Tips for Waveform viewers
+<img width="961" alt="image" src="./screenshots/simvision.png">
+
+1. Navigate hierarchy by clicking on the + sign next to module names (Yellow Box)
+2. Add Signal by clicking on a module, then clicking on the signal in the signal panel (Blue Box)
+3. Use the seek bar at the bottom of the waveform viewer to navigate through time and zoom.
+4. Right-click a signal to "Set Radix" (e.g., binary, hex, decimal)
+5. Right click on the signal window and use Save/Load to save a waveform setup so you don't have to re-add signals every time
+   1. When saving, put the file outside of the WORKSPACE directory to avoid overwriting during `make clean`
+
+## Code Linting Guide
+[Verilator Linting Guide](https://gtvault.sharepoint.com/:w:/s/SiliconJackets/EW0qm5W59tdKj9TpwMpdu2YBIAYuL4C1B1nUTCNmcCsSIw?e=c1aNhq)
+
+## An RTL/Verilog Textbook
+[RTL Modeling with SystemVerilog for Simulation and Synthesis using SystemVerilog for ASIC and FPGA design](https://gtvault.sharepoint.com/:b:/s/SiliconJackets/EbxCET5NlPtMu3aUb6LRpQ8BvPQVkJjA3sXMsZEofq5taQ?e=7JvuNE)
+
+
+## Onboarding Policy:
+- Submissions must be made individually. Your work should not be copied from others. Collboration is allowed but submissions too similar will not be checked off.
+- AI use is allowed but you must show adequate understanding of the code you submit. We may ask you to explain any part of your code as a follow-up to your submission.
+- Use your own account and linux credentials for submission. Do not run your code on someone else's crediantials. This is against GT policy and ECE IT rules.
+- There is strictly no extensions for onboarding deadlines. We do not have enough leads to accomodate extensions.
+- Non-working submissions will not be checked off. Make sure your code runs and passes all checks before submission. We will provide feedbacks on all submissions but we do not guarantee timely feedback unless you submit at least 24 hours before the deadline.
diff --git a/resources/calculator.drawio.png b/resources/calculator.drawio.png
new file mode 100644 (file)
index 0000000..4149bf9
Binary files /dev/null and b/resources/calculator.drawio.png differ
diff --git a/resources/cycle_count.png b/resources/cycle_count.png
new file mode 100644 (file)
index 0000000..34b2016
Binary files /dev/null and b/resources/cycle_count.png differ
diff --git a/resources/hdlbit-roadmap.md b/resources/hdlbit-roadmap.md
new file mode 100644 (file)
index 0000000..53b19df
--- /dev/null
@@ -0,0 +1,132 @@
+
+# 0. Preface
+* Here is our roadmap for HDLBits exercises to help you get started with Verilog/SystemVerilog. Some modules are marked optional as we think they are relevant but not required to complete the onboarding. You can skip the rest for the purpose of this onboarding but I recommend you go through them later for your own learning.
+---
+
+# 1. Getting Started
+
+* Getting Started
+* Output Zero
+
+---
+
+# 2. Verilog Language
+
+## 2.1 Basics
+
+* Simple wire
+* Four wires
+    > HDLBits uses Verilog (`wire`, `reg`). In SystemVerilog, use `logic` instead.
+* Inverter
+* AND gate
+* Declaring wires
+
+## 2.2 Vectors
+
+* Vectors
+* Vector part select
+* Bitwise operators
+* Vector concatenation operator
+
+## 2.3 Modules: Hierarchy
+
+* Modules
+* Connecting ports by position
+* Connecting ports by name
+* Three modules
+* Modules and vectors
+* Adder 1
+
+## 2.4 Procedures
+
+* Always blocks (combinational)
+    > In SystemVerilog, use `always_comb` instead of `always` for combinational logic to improve readability and reduce errors.
+* Always blocks (clocked)
+    > In SystemVerilog, use `always_ff` instead of `always` for sequential logic to enhance clarity and prevent mistakes.
+* If statement
+* If statement latches
+* Case statement
+* Avoiding latches
+    > Latches aren't always bad, but be cautious when inferring them    unintentionally. Consider using `always_comb` in SystemVerilog to help     avoid accidental latches.
+
+## 2.5 More Verilog Features
+
+* Conditional ternary operator
+* Generate for-loop: 100-bit binary adder 2
+
+---
+
+# 3. Circuits
+
+## 3.1 Combinational Logic
+
+### 3.1.1 Basic Gates
+
+* Wire
+    > HDLBits uses Verilog (`wire`, `reg`). In SystemVerilog, use `logic` instead.
+* GND
+* Simple Circuit B
+### 3.1.2 Multiplexers
+
+* 2-to-1 multiplexer
+* 2-to-1 bus multiplexer
+
+### 3.1.3 Arithmetic Circuits
+
+* Half adder
+* Full adder
+* 3-bit binary adder
+* Adder
+* Signed addition overflow
+
+### 3.1.4 Karnaugh Map to Circuit
+
+    > You can skip this section for the purpose of the onboarding.
+
+---
+
+## 3.2 Sequential Logic
+
+### 3.2.1 Latches and Flip-Flops
+
+* D flip-flop
+* D flip-flops
+* DFF with reset 
+* DFF with reset value (Optional)
+* DFF with asynchronous reset (Optional)
+* D latch (Optional)
+* DFF + gate (Optional)
+* Mux and DFF (Optional)
+* Dual-edge triggered flip-flop (Optional)
+
+### 3.2.2 Counters
+
+    > You can skip this section for the purpose of the onboarding.
+
+
+### 3.2.3 Shift Registers
+
+    > You can skip this section for the purpose of the onboarding.
+
+
+### 3.2.4 More Circuits
+
+    > You can skip this section for the purpose of the onboarding.
+
+### 3.2.5 Finite State Machines
+
+* Simple FSM 1 (asynchronous reset)
+* Simple FSM 1 (synchronous reset)
+* Simple state transitions 3
+* Design a Moore FSM
+* Q8: Design a Mealy FSM
+
+---
+
+## 3.3 Building Larger Circuits
+
+    > You can skip this section for the purpose of the onboarding.
+
+
+---
+
diff --git a/resources/sram_addressing.drawio.png b/resources/sram_addressing.drawio.png
new file mode 100644 (file)
index 0000000..da57b37
Binary files /dev/null and b/resources/sram_addressing.drawio.png differ
diff --git a/resources/suggested_fsm.drawio.png b/resources/suggested_fsm.drawio.png
new file mode 100644 (file)
index 0000000..fb1d9cf
Binary files /dev/null and b/resources/suggested_fsm.drawio.png differ
diff --git a/resources/timing_diagram.jpg b/resources/timing_diagram.jpg
new file mode 100644 (file)
index 0000000..d7d40b1
Binary files /dev/null and b/resources/timing_diagram.jpg differ
diff --git a/screenshots/Add_to_wave_view.png b/screenshots/Add_to_wave_view.png
new file mode 100644 (file)
index 0000000..9749164
Binary files /dev/null and b/screenshots/Add_to_wave_view.png differ
diff --git a/screenshots/Change_radix.png b/screenshots/Change_radix.png
new file mode 100644 (file)
index 0000000..27fab9e
Binary files /dev/null and b/screenshots/Change_radix.png differ
diff --git a/screenshots/Initial_View.png b/screenshots/Initial_View.png
new file mode 100644 (file)
index 0000000..898cd3c
Binary files /dev/null and b/screenshots/Initial_View.png differ
diff --git a/screenshots/cycle_count.png b/screenshots/cycle_count.png
new file mode 100644 (file)
index 0000000..34b2016
Binary files /dev/null and b/screenshots/cycle_count.png differ
diff --git a/screenshots/example_submission.png b/screenshots/example_submission.png
new file mode 100644 (file)
index 0000000..6fcfe34
Binary files /dev/null and b/screenshots/example_submission.png differ
diff --git a/screenshots/fastxSetup1.png b/screenshots/fastxSetup1.png
new file mode 100644 (file)
index 0000000..e045d51
Binary files /dev/null and b/screenshots/fastxSetup1.png differ
diff --git a/screenshots/fastxSetup2.png b/screenshots/fastxSetup2.png
new file mode 100644 (file)
index 0000000..33c1f6f
Binary files /dev/null and b/screenshots/fastxSetup2.png differ
diff --git a/screenshots/fastxSetup3.png b/screenshots/fastxSetup3.png
new file mode 100644 (file)
index 0000000..bac278c
Binary files /dev/null and b/screenshots/fastxSetup3.png differ
diff --git a/screenshots/simvision.png b/screenshots/simvision.png
new file mode 100644 (file)
index 0000000..0fa2c76
Binary files /dev/null and b/screenshots/simvision.png differ
diff --git a/scripts/check_onboarding.py b/scripts/check_onboarding.py
new file mode 100644 (file)
index 0000000..64324ae
--- /dev/null
@@ -0,0 +1,69 @@
+import sys
+from itertools import zip_longest
+import os
+
+def normalize_line(line):
+    """Normalize a line by treating blank lines and all-x lines as equivalent (uninitialized)."""
+    stripped = line.strip()
+    # Check if line is all x's (32 x's for 32-bit values)
+    if stripped and all(c == 'x' for c in stripped):
+        return ''  # Treat as empty
+    return stripped
+
+def compare_files(expected_output_path, sim_output_path):
+    mismatches = []
+    mismatch_file = "mismatches.txt"
+    
+    try:
+        with open(expected_output_path, 'r', encoding='utf-8') as f1, \
+             open(sim_output_path, 'r', encoding='utf-8') as f2:
+            
+            for line_num, (line1, line2) in enumerate(zip_longest(f1, f2, fillvalue=''), 1):
+                # Normalize both lines (treat blank and all-x as equivalent)
+                norm_line1 = normalize_line(line1)
+                norm_line2 = normalize_line(line2)
+                
+                if norm_line1 != norm_line2:
+                    mismatches.append(f"Mismatch at line {line_num}:\n"
+                                      f"  Expected: {line1.strip()!r}\n"
+                                      f"  Sim output: {line2.strip()!r}\n")
+        
+        if not mismatches:
+            print(f"PASSED: RTL simulation output matches expected results.")
+            # Remove mismatch file if it exists from previous runs
+            if os.path.exists(mismatch_file):
+                os.remove(mismatch_file)
+        else:
+            print(f"FAILED: Mismatches found in {sim_output_path}")
+            print(f"Writing mismatches to {mismatch_file}")
+            
+            # Write mismatches to file
+            with open(mismatch_file, 'w', encoding='utf-8') as f_out:
+                f_out.write(f"Comparison Results\n")
+                f_out.write(f"Expected file: {expected_output_path}\n")
+                f_out.write(f"Simulation file: {sim_output_path}\n")
+                f_out.write(f"Total mismatches: {len(mismatches)}\n")
+                f_out.write("="*70 + "\n\n")
+                for mismatch in mismatches:
+                    f_out.write(mismatch + "\n")
+            
+            # Print to console
+            for mismatch in mismatches:
+                print(mismatch)
+
+    except FileNotFoundError:
+        print(f"Error: One or both files not found. Please check paths:")
+        print(f"  File 1: {expected_output_path}")
+        print(f"  File 2: {sim_output_path}")
+    except Exception as e:
+        print(f"An unexpected error occurred: {e}")
+
+if __name__ == "__main__":
+    if len(sys.argv) != 3:
+        print("Usage: python check_onboarding.py <expected_output_path> <sim_output_path>")
+        sys.exit(1) # Exit with an error code
+
+    file1 = sys.argv[1]
+    file2 = sys.argv[2]
+    
+    compare_files(file1, file2)
\ No newline at end of file
diff --git a/scripts/init_mem.py b/scripts/init_mem.py
new file mode 100644 (file)
index 0000000..ce11f34
--- /dev/null
@@ -0,0 +1,140 @@
+import random 
+import argparse
+import os
+
+def gen():
+    """Generates a random 64-bit integer using Python's built-in random."""
+    # getrandbits(k) returns an integer with k random bits.
+    value = random.getrandbits(64)
+    return value
+
+def main(output_directory, debug=False):
+    """
+    Simulates a memory pre-state generation and an addition operation,
+    saving results to specified output files within the given directory.
+    """
+    # Ensure the output directory exists
+    os.makedirs(output_directory, exist_ok=True)
+
+    # Define file paths within the output directory
+    pre_state_upper_file = os.path.join(output_directory, "memory_pre_state_upper.txt")
+    pre_state_lower_file = os.path.join(output_directory, "memory_pre_state_lower.txt")
+    post_state_upper_file = os.path.join(output_directory, "memory_post_state_upper.txt")
+    post_state_lower_file = os.path.join(output_directory, "memory_post_state_lower.txt")
+    
+    # Debug file paths for combined binary+decimal output
+    if debug:
+        pre_state_dbg = os.path.join(output_directory, "memory_pre_state_dbg.txt")
+        post_state_dbg = os.path.join(output_directory, "memory_post_state_dbg.txt")
+
+    # read_start_addr = 0
+    # read_end_addr = 255 
+    # write_start_addr = 384
+    # write_end_addr = 511 
+
+    # Generate and write pre-state memory
+    with open(pre_state_upper_file, "w") as u, open(pre_state_lower_file, "w") as l:
+        # Open debug file if needed
+        if debug:
+            dbg = open(pre_state_dbg, "w")
+        
+        # Generate 256 random 64-bit values and split them into upper/lower 32-bit binary strings
+        for i in range(256):
+            value = gen()
+            # Extract upper 32 bits
+            upper = ((value >> 32) & 0xFFFFFFFF)
+            # Extract lower 32 bits
+            lower = (value & 0xFFFFFFFF)
+            
+            u.write(format(upper, '032b') + "\n") # Format as 32-bit binary string
+            l.write(format(lower, '032b') + "\n") # Format as 32-bit binary string
+            
+            if debug:
+                # Combine upper (MSB) and lower (LSB) into 64-bit value
+                full_value = (upper << 32) | lower
+                binary_64 = format(upper, '032b') + format(lower, '032b')
+                dbg.write(f"{binary_64} ({full_value})\n")
+
+        # Append another 256 lines of zeros to both files
+        for i in range(256):
+            u.write(format(0, '032b') + "\n")
+            l.write(format(0, '032b') + "\n")
+            if debug:
+                dbg.write("0000000000000000000000000000000000000000000000000000000000000000 (0)\n")
+        
+        if debug:
+            dbg.close()
+
+    # Open output files for writing the post-state
+    with open(post_state_upper_file, "w") as u_out, \
+         open(post_state_lower_file, "w") as l_out:
+        
+        # Open pre-state files for reading
+        with open(pre_state_upper_file, "r") as u_in, \
+             open(pre_state_lower_file, "r") as l_in:
+            
+            # Read all lines from pre-state files into lists
+            upper_lines = u_in.readlines()
+            lower_lines = l_in.readlines()
+
+        # Initialize write address to 384 where results are written
+        write_addr = 384
+
+        # Perform 128 addition operations: add (0+1), (2+3), (4+5), ..., (254+255)
+        for i in range(128):
+            read_addr = i * 2  # Read from addresses 0, 2, 4, ..., 254
+            
+            # Read first operand (address n)
+            src1_upper = int(upper_lines[read_addr].strip(), 2)
+            src1_lower = int(lower_lines[read_addr].strip(), 2)
+            
+            # Read second operand (address n+1)
+            src2_upper = int(upper_lines[read_addr + 1].strip(), 2)
+            src2_lower = int(lower_lines[read_addr + 1].strip(), 2)
+
+            # Combine upper and lower 32-bits into full 64-bit values
+            src1 = (src1_upper << 32) | src1_lower
+            src2 = (src2_upper << 32) | src2_lower
+            
+            # Add the two 64-bit values
+            result = (src1 + src2) & 0xFFFFFFFFFFFFFFFF  # Mask to ensure 64-bit wrap-around
+
+            # Split result back into upper and lower 32-bits
+            res_upper = (result >> 32) & 0xFFFFFFFF
+            res_lower = result & 0xFFFFFFFF
+
+            # Write result to addresses starting from 384
+            upper_lines[write_addr] = format(res_upper, '032b') + "\n"
+            lower_lines[write_addr] = format(res_lower, '032b') + "\n"
+            
+            write_addr += 1  # Increment write address for the next result
+
+        # Write the modified 'upper_lines' and 'lower_lines' to the post-state files
+        u_out.writelines(upper_lines)
+        l_out.writelines(lower_lines)
+    
+    # Write debug version of post-state file with combined binary and decimal
+    if debug:
+        with open(post_state_dbg, "w") as dbg:
+            with open(post_state_upper_file, "r") as u_in, open(post_state_lower_file, "r") as l_in:
+                for upper_line, lower_line in zip(u_in, l_in):
+                    upper_bin = upper_line.strip()
+                    lower_bin = lower_line.strip()
+                    upper_dec = int(upper_bin, 2)
+                    lower_dec = int(lower_bin, 2)
+                    # Combine upper (MSB) and lower (LSB) into 64-bit value
+                    full_value = (upper_dec << 32) | lower_dec
+                    binary_64 = upper_bin + lower_bin
+                    dbg.write(f"{binary_64} ({full_value})\n")
+
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(description="Generate pre- and post-state memory contents.")
+    parser.add_argument("output_directory", type=str,
+                        help="The directory where output files will be saved.")
+    parser.add_argument("--debug", action="store_true",
+                        help="Generate additional debug files.")
+    
+    args = parser.parse_args()
+    
+    main(args.output_directory, debug=args.debug)
\ No newline at end of file
diff --git a/sim/behav/Include/calculator.include b/sim/behav/Include/calculator.include
new file mode 100644 (file)
index 0000000..941a488
--- /dev/null
@@ -0,0 +1,16 @@
+../../src/verilog/calculator_pkg.sv
+../../src/verilog/adder32.sv
+../../src/verilog/controller.sv
+../../src/verilog/full_adder.sv
+../../src/verilog/result_buffer.sv
+../../src/verilog/CF_SRAM_1024x32.tt_180V_25C.v
+../../src/verilog/top_lvl.sv
+../../src/verilog/tb_calculator.sv
+// ../../src/verilog/tb_sram_dump.sv
+// ../../src/verilog/tb_cf_sram.sv
+
+// Add additional testbench(es) using this format
+// ../../src/verilog/tb_name_of_test.sv
+// Warning: If your added testbench create a text file, 
+// please make sure it is commented out when you run verify_onboarding
+// as 2 testbench cannot write to text files at the same time
diff --git a/sim/behav/Makefile b/sim/behav/Makefile
new file mode 120000 (symlink)
index 0000000..e542ee9
--- /dev/null
@@ -0,0 +1 @@
+../../src/Makefiles/Makefile
\ No newline at end of file
diff --git a/sim/behav/link_files.py b/sim/behav/link_files.py
new file mode 100644 (file)
index 0000000..cccc07f
--- /dev/null
@@ -0,0 +1,57 @@
+import os
+import re
+import sys
+
+if len(sys.argv) != 2:
+    print("Usage: python3 link_files.py <include_file_location>")
+    sys.exit(1)
+
+# Input and output file names
+input_file = "Include/" + sys.argv[1]
+print("looking in file " + input_file)
+
+# Ensure WORKSPACE and sym_links directories exist
+workspace_dir = "WORKSPACE"
+sym_links_dir = os.path.join(workspace_dir, "sym_links")
+os.makedirs(sym_links_dir, exist_ok=True)
+
+# Output file path in WORKSPACE
+output_file = os.path.join(sym_links_dir, "sim_no_path.include")
+
+# Open input file for reading
+with open(input_file, 'r') as input_fp:
+    # Open output file for writing
+    with open(output_file, 'w') as output_fp:
+        # Iterate through each line in the input file
+        for line in input_fp:
+            # Remove leading and trailing whitespaces
+            line = line.strip()
+
+            # Check if the line is a comment or empty
+            if not line or line.startswith('//'):
+                # If it's a comment or empty line, write it directly to the output file
+                output_fp.write(line + '\n')
+            else:
+                # Extract the file path using regex
+                match = re.match(r'^\s*(\S+)\s*$', line)
+                if match:
+                    file_path = match.group(1)
+
+                    # Check if the file exists
+                    if os.path.exists(file_path):
+                        # Create symbolic link in WORKSPACE
+                        link_path = os.path.join(sym_links_dir, os.path.basename(file_path))
+                        try:
+                            os.symlink(os.path.abspath(file_path), link_path)
+                        except FileExistsError as e:
+                            print("Tried to symlink an already existing file: \n", e)
+                            print("Continuing")
+                            
+                        # Write only the filename to the output file
+                        output_fp.write(f"sym_links/{os.path.basename(file_path)}\n")
+                    else:
+                        print(f"Error: File '{file_path}' does not exist. Aborting process.")
+                        break
+                else:
+                    print(f"Error: Invalid file path format in line '{line}'. Aborting process.")
+                    break
diff --git a/sim/behav/mismatches.txt b/sim/behav/mismatches.txt
new file mode 100644 (file)
index 0000000..5452dbb
--- /dev/null
@@ -0,0 +1,518 @@
+Comparison Results
+Expected file: /nethome/amenon301/Documents/siliconj_NEW/Spring26-DD-Onboarding-main/sim/behav/WORKSPACE/memory_post_state_upper.txt
+Simulation file: /nethome/amenon301/Documents/siliconj_NEW/Spring26-DD-Onboarding-main/sim/behav/WORKSPACE/sim_memory_post_state_upper.txt
+Total mismatches: 128
+======================================================================
+
+Mismatch at line 385:
+  Expected: '11011011000010110111001001011111'
+  Sim output: '01011100000100001001100010110011'
+
+Mismatch at line 386:
+  Expected: '11010100011110010101001101101001'
+  Sim output: '11001101000111110110001110110001'
+
+Mismatch at line 387:
+  Expected: '01010111101101110101101011101001'
+  Sim output: '01101001111100100010110100000110'
+
+Mismatch at line 388:
+  Expected: '01010000100100111111110100011010'
+  Sim output: '11110011011111100010101011011101'
+
+Mismatch at line 389:
+  Expected: '00010010010111110100001101100111'
+  Sim output: '01010001000010001101011010111001'
+
+Mismatch at line 390:
+  Expected: '11110100101010101011000010101000'
+  Sim output: '00000111001011001010000101011100'
+
+Mismatch at line 391:
+  Expected: '10011011000010010100000001000100'
+  Sim output: '11011100111111000000001000011011'
+
+Mismatch at line 392:
+  Expected: '00110110011100110100000011011010'
+  Sim output: '00001110111010101001010011101000'
+
+Mismatch at line 393:
+  Expected: '00011011100100111010011001010111'
+  Sim output: '11011110001000000111001100100001'
+
+Mismatch at line 394:
+  Expected: '00110100100110101010100111001100'
+  Sim output: '01000100011011100000011111010100'
+
+Mismatch at line 395:
+  Expected: '11101101100111001101111001000100'
+  Sim output: '00101010001110101100001111111101'
+
+Mismatch at line 396:
+  Expected: '01010110000011000111100011011000'
+  Sim output: '00111011000111001011011100010110'
+
+Mismatch at line 397:
+  Expected: '00011111010101000000000100010110'
+  Sim output: '01001100010100010000011111110010'
+
+Mismatch at line 398:
+  Expected: '10110010010111101000001001101000'
+  Sim output: '10110001100101101110001111001010'
+
+Mismatch at line 399:
+  Expected: '01111000111111000011000011101100'
+  Sim output: '10000100010011111000101001011100'
+
+Mismatch at line 400:
+  Expected: '00111000000000100010011010000101'
+  Sim output: '01101111010010001011000001001000'
+
+Mismatch at line 401:
+  Expected: '00011111011011101110110110111100'
+  Sim output: '00111100111000100111010110100010'
+
+Mismatch at line 402:
+  Expected: '01111001101000111010101011011000'
+  Sim output: '00010001000110111101010011111001'
+
+Mismatch at line 403:
+  Expected: '11110111101111011101001010000110'
+  Sim output: '01101011001101110010111000011001'
+
+Mismatch at line 404:
+  Expected: '01000001000101100101111010101000'
+  Sim output: '11111010111100001110100101001110'
+
+Mismatch at line 405:
+  Expected: '10010010000011111110010010001010'
+  Sim output: '01100000101001101101110010111010'
+
+Mismatch at line 406:
+  Expected: '10111111100010100001000001001010'
+  Sim output: '10001110111100000011100110111101'
+
+Mismatch at line 407:
+  Expected: '00111011110010101010000000011100'
+  Sim output: '01100001101110101011100110111101'
+
+Mismatch at line 408:
+  Expected: '10101101101110000100101101011111'
+  Sim output: '00010001011110000001101101110100'
+
+Mismatch at line 409:
+  Expected: '11001010100000101001101011000101'
+  Sim output: '01111100010110101111011111110110'
+
+Mismatch at line 410:
+  Expected: '10001010011101101001110101001110'
+  Sim output: '11100010011010111110011100100001'
+
+Mismatch at line 411:
+  Expected: '10010111010000000011101001110011'
+  Sim output: '11011011100111010010111001011101'
+
+Mismatch at line 412:
+  Expected: '01011010101101000100011101110100'
+  Sim output: '01000100110110000101101111010010'
+
+Mismatch at line 413:
+  Expected: '10010001010000011110110100110110'
+  Sim output: '00001011010111101111111010110111'
+
+Mismatch at line 414:
+  Expected: '11000001100100000101111010111011'
+  Sim output: '10100110101110110100000001110110'
+
+Mismatch at line 415:
+  Expected: '00110101111000010000110000001010'
+  Sim output: '11010010000001111011001001111000'
+
+Mismatch at line 416:
+  Expected: '11101001001111000011100100000101'
+  Sim output: '11101110110010111110010001010111'
+
+Mismatch at line 417:
+  Expected: '01110001011000001101100100000110'
+  Sim output: '00100110101100001011110110010000'
+
+Mismatch at line 418:
+  Expected: '01000000001101010000010111001110'
+  Sim output: '11010111011001100100001111111110'
+
+Mismatch at line 419:
+  Expected: '10011111011111001001111100010110'
+  Sim output: '11100001110001101100111100101111'
+
+Mismatch at line 420:
+  Expected: '10000110101111011111111011000011'
+  Sim output: '11101110010111101111011001100110'
+
+Mismatch at line 421:
+  Expected: '01011100010100101000001001001011'
+  Sim output: '01100101010010100000110110010001'
+
+Mismatch at line 422:
+  Expected: '00011111000000110010011010100001'
+  Sim output: '11101001011010011110011110101011'
+
+Mismatch at line 423:
+  Expected: '10101001000010001011001110101001'
+  Sim output: '11010111100000010011101100101000'
+
+Mismatch at line 424:
+  Expected: '01011000101100101011011010110100'
+  Sim output: '10010000001010110011001101110100'
+
+Mismatch at line 425:
+  Expected: '01010101000011000011111010101101'
+  Sim output: '11010110100100000011010011101110'
+
+Mismatch at line 426:
+  Expected: '01111000000010000111001011010100'
+  Sim output: '11100111000011111110101110011010'
+
+Mismatch at line 427:
+  Expected: '10101011010001000001010000011110'
+  Sim output: '11000001111101001101100000110110'
+
+Mismatch at line 428:
+  Expected: '10000101100000001111011111000010'
+  Sim output: '11010011000101010001100111110110'
+
+Mismatch at line 429:
+  Expected: '11001110100101110010101001110110'
+  Sim output: '00011111110010011110111110101010'
+
+Mismatch at line 430:
+  Expected: '00111101111001000100011100101000'
+  Sim output: '00101001010101110101011100000100'
+
+Mismatch at line 431:
+  Expected: '11010101010100101010000000001111'
+  Sim output: '10100111011101110111111100001011'
+
+Mismatch at line 432:
+  Expected: '00110101100110011010010101001100'
+  Sim output: '10010110110011111101110111001100'
+
+Mismatch at line 433:
+  Expected: '01001001111000100001001011100000'
+  Sim output: '00001110111000111000100100001000'
+
+Mismatch at line 434:
+  Expected: '01000010100011110111001101110001'
+  Sim output: '00111001111111010010001111111111'
+
+Mismatch at line 435:
+  Expected: '11011100001000101110000001100011'
+  Sim output: '10001001000001000000101000010100'
+
+Mismatch at line 436:
+  Expected: '01100001110000010001111011111000'
+  Sim output: '00011111011011010110011001010111'
+
+Mismatch at line 437:
+  Expected: '00111001001000111011011110001010'
+  Sim output: '10101011111010100001000000110110'
+
+Mismatch at line 438:
+  Expected: '01101110110011000000011010010001'
+  Sim output: '01001100011000100010011100111001'
+
+Mismatch at line 439:
+  Expected: '00001100100000011111010111111101'
+  Sim output: '00001000110111010000001100010101'
+
+Mismatch at line 440:
+  Expected: '01011110010110000111101100101000'
+  Sim output: '00001110001100010100101001101110'
+
+Mismatch at line 441:
+  Expected: '00100100011111110000000001011111'
+  Sim output: '00111011010010111011000100011001'
+
+Mismatch at line 442:
+  Expected: '01001001001000101001011111010000'
+  Sim output: '11101001111000000011001001011011'
+
+Mismatch at line 443:
+  Expected: '01001001110001011100111101101011'
+  Sim output: '00110110110101111011110001100100'
+
+Mismatch at line 444:
+  Expected: '10011100110001110100100111000001'
+  Sim output: '00111101001110000111111110000010'
+
+Mismatch at line 445:
+  Expected: '01011000010101111000011111011100'
+  Sim output: '00010101011100000100100000010010'
+
+Mismatch at line 446:
+  Expected: '10110000111101100110101011111110'
+  Sim output: '10011011100101111110101000001111'
+
+Mismatch at line 447:
+  Expected: '00111001001011101011110101110100'
+  Sim output: '01000010101111100111011111001001'
+
+Mismatch at line 448:
+  Expected: '11010101000010110110011010000101'
+  Sim output: '10111100010010100010000000001000'
+
+Mismatch at line 449:
+  Expected: '00001100111001011011001110000010'
+  Sim output: '01011100100011000111010111101111'
+
+Mismatch at line 450:
+  Expected: '01101001001010110110000001101001'
+  Sim output: '00111001011100010101100111100011'
+
+Mismatch at line 451:
+  Expected: '00001010010010011101111111100001'
+  Sim output: '01110000111010001111110100110101'
+
+Mismatch at line 452:
+  Expected: '01011100101110110010111100000111'
+  Sim output: '11000011110111011100000001100001'
+
+Mismatch at line 453:
+  Expected: '11100110011001000010000001001100'
+  Sim output: '11110001011100110011100101101001'
+
+Mismatch at line 454:
+  Expected: '10100111101001010111101000011101'
+  Sim output: '01011101110101001101110100001101'
+
+Mismatch at line 455:
+  Expected: '11111101000011100000001001110111'
+  Sim output: '01010100011000001101000100000100'
+
+Mismatch at line 456:
+  Expected: '01111011101110000011011111100100'
+  Sim output: '11000000100100001111011100011100'
+
+Mismatch at line 457:
+  Expected: '01000111111001110111110001110010'
+  Sim output: '00110001010001110100011101101000'
+
+Mismatch at line 458:
+  Expected: '01100100010001001110111100111110'
+  Sim output: '11000110011101001101000101001010'
+
+Mismatch at line 459:
+  Expected: '01001010011000011111110001110110'
+  Sim output: '11101011001000100010111100101001'
+
+Mismatch at line 460:
+  Expected: '00011011011100111100110100000111'
+  Sim output: '11111000010110011000100000010101'
+
+Mismatch at line 461:
+  Expected: '01111000100000011011111110001011'
+  Sim output: '11000100001101110101001001110100'
+
+Mismatch at line 462:
+  Expected: '10110011111010100111100000000110'
+  Sim output: '00011100001100000000001010001000'
+
+Mismatch at line 463:
+  Expected: '00111001110101010110111011101010'
+  Sim output: '10101101101100101111000110010010'
+
+Mismatch at line 464:
+  Expected: '10111001011000111101110110011101'
+  Sim output: '10100101110010111001111100001101'
+
+Mismatch at line 465:
+  Expected: '11010101110101110000110111010010'
+  Sim output: '11111001001001000000111010010100'
+
+Mismatch at line 466:
+  Expected: '01010011000101001010110100010010'
+  Sim output: '00010010110111011111001011001100'
+
+Mismatch at line 467:
+  Expected: '10001010101000000010000100101010'
+  Sim output: '00000011010001111010000010101010'
+
+Mismatch at line 468:
+  Expected: '00001101000000110001100000001001'
+  Sim output: '10101011011111001101110000111110'
+
+Mismatch at line 469:
+  Expected: '00001010100000111100100000100111'
+  Sim output: '11110011110001100110000010011100'
+
+Mismatch at line 470:
+  Expected: '01101000010100111010111001010000'
+  Sim output: '00001101011100101100110000010001'
+
+Mismatch at line 471:
+  Expected: '10001011011100010100010111101110'
+  Sim output: '01001001001100011110110010111111'
+
+Mismatch at line 472:
+  Expected: '10000010011110000000101001100011'
+  Sim output: '10011010100011101111101001101101'
+
+Mismatch at line 473:
+  Expected: '00111111001000001111100011001110'
+  Sim output: '11100000100000000101000010100101'
+
+Mismatch at line 474:
+  Expected: '01101110101100011111101100011011'
+  Sim output: '10010110011111010011110000111100'
+
+Mismatch at line 475:
+  Expected: '01000111101110101111111011011001'
+  Sim output: '10010001001101111010010100010011'
+
+Mismatch at line 476:
+  Expected: '00001011111001111000100000000100'
+  Sim output: '01010010001001110001010001111100'
+
+Mismatch at line 477:
+  Expected: '01000101111001100011100101010001'
+  Sim output: '11010011110000110111101011111010'
+
+Mismatch at line 478:
+  Expected: '00011100101001000000100010011111'
+  Sim output: '01001100100111110001000011101001'
+
+Mismatch at line 479:
+  Expected: '00100011010000000010110001001011'
+  Sim output: '00010110001111001111001010011100'
+
+Mismatch at line 480:
+  Expected: '11111010100101111011110101010111'
+  Sim output: '10111111000010111000001000111011'
+
+Mismatch at line 481:
+  Expected: '00010000011110100010011001000111'
+  Sim output: '11101111011011010100010011101111'
+
+Mismatch at line 482:
+  Expected: '01010101111011000010000101100010'
+  Sim output: '01001100011000000001110011111011'
+
+Mismatch at line 483:
+  Expected: '01011101100010001111110001100110'
+  Sim output: '01000010011010100111000000101111'
+
+Mismatch at line 484:
+  Expected: '01000010101111111100100111010100'
+  Sim output: '00110011110010100010011100101100'
+
+Mismatch at line 485:
+  Expected: '00011010011110011011010000010001'
+  Sim output: '01011001110100011101101000100001'
+
+Mismatch at line 486:
+  Expected: '10011110010010010111100001000110'
+  Sim output: '11010011100101111100011011011010'
+
+Mismatch at line 487:
+  Expected: '00000010111000001111101001001110'
+  Sim output: '11010000010011011011100010011001'
+
+Mismatch at line 488:
+  Expected: '01010011110011100001100101000111'
+  Sim output: '00011111011010000110001010111101'
+
+Mismatch at line 489:
+  Expected: '00110011111111001100000101111111'
+  Sim output: '11101001001001111011010101000111'
+
+Mismatch at line 490:
+  Expected: '10001110100011110101100110011111'
+  Sim output: '10001010000101111011011001100111'
+
+Mismatch at line 491:
+  Expected: '11000110100010010011010111001011'
+  Sim output: '00010100000111110011110111000001'
+
+Mismatch at line 492:
+  Expected: '10100010011111011001100010011000'
+  Sim output: '01111001001100100000000110111001'
+
+Mismatch at line 493:
+  Expected: '11110110110010011000111110110010'
+  Sim output: '00010101011000001100010001111111'
+
+Mismatch at line 494:
+  Expected: '01000100011000010101110011010000'
+  Sim output: '11101000110100101100011000111100'
+
+Mismatch at line 495:
+  Expected: '00100111011001101111001100100110'
+  Sim output: '11000011011111011011001101100001'
+
+Mismatch at line 496:
+  Expected: '01111101011011110010111110011000'
+  Sim output: '01101110011111010011111111011100'
+
+Mismatch at line 497:
+  Expected: '10000000011001100100000011101001'
+  Sim output: '00010101001011100101001100001011'
+
+Mismatch at line 498:
+  Expected: '00111111001010110111111101111011'
+  Sim output: '10011000011001000110100110011100'
+
+Mismatch at line 499:
+  Expected: '01110001100101000110111011100001'
+  Sim output: '11101011110000110111000110111011'
+
+Mismatch at line 500:
+  Expected: '11101101001111000011111010011111'
+  Sim output: '10000110101001000101101010001110'
+
+Mismatch at line 501:
+  Expected: '11110000001101011101111101000110'
+  Sim output: '11100111000110010101101111011101'
+
+Mismatch at line 502:
+  Expected: '00000110000101001110000000010110'
+  Sim output: '11101111101111101010110010101011'
+
+Mismatch at line 503:
+  Expected: '00011001000111010001011011001100'
+  Sim output: '01101111100111111111100101111110'
+
+Mismatch at line 504:
+  Expected: '00110011100001001101110000100001'
+  Sim output: '01100001001100111000010111110010'
+
+Mismatch at line 505:
+  Expected: '11111001100001011110110001001111'
+  Sim output: '10100111101000000010111001111110'
+
+Mismatch at line 506:
+  Expected: '01110010011100001000001000011011'
+  Sim output: '11111000011100100010100111110010'
+
+Mismatch at line 507:
+  Expected: '11110000001100011100001011111000'
+  Sim output: '11011001001111100101110000000111'
+
+Mismatch at line 508:
+  Expected: '01110100110101100000011100001011'
+  Sim output: '01000111111100010110110111000101'
+
+Mismatch at line 509:
+  Expected: '01101001110110010101100110000000'
+  Sim output: '10101000101011110000110101010100'
+
+Mismatch at line 510:
+  Expected: '11110110110110110000111000000010'
+  Sim output: '11101010000101000100100011111011'
+
+Mismatch at line 511:
+  Expected: '01011000100010010000001101110100'
+  Sim output: '01111100011110001100011000111010'
+
+Mismatch at line 512:
+  Expected: '11100111111010110001111110101111'
+  Sim output: '00111111011100010011001000000110'
+
diff --git a/sim/behav/simvision.svcf b/sim/behav/simvision.svcf
new file mode 100644 (file)
index 0000000..63a9ffb
--- /dev/null
@@ -0,0 +1,102 @@
+
+#
+# Preferences
+#
+preferences set plugin-enable-svdatabrowser-new 1
+preferences set plugin-enable-groupscope 0
+preferences set plugin-enable-interleaveandcompare 0
+preferences set plugin-enable-waveformfrequencyplot 0
+preferences set savedlg-simulator ppe
+
+#
+# Databases
+#
+database require waves -search {
+       ./waves.shm/waves.trn
+       /nethome/amenon301/Documents/siliconj_NEW/Spring26-DD-Onboarding-main/sim/behav/WORKSPACE/waves.shm/waves.trn
+}
+
+#
+# Conditions
+#
+set expression {waves::tb_calculator.DUT.sram_B.DI[31:0]}
+if {[catch {condition new -name  di_lower -expr $expression}] != ""} {
+    condition set -using di_lower -expr $expression
+}
+set expression {waves::tb_calculator.DUT.sram_A.DI[31:0]}
+if {[catch {condition new -name  di_upper -expr $expression}] != ""} {
+    condition set -using di_upper -expr $expression
+}
+set expression {waves::tb_calculator.DUT.sram_B.DO[31:0]}
+if {[catch {condition new -name  do_lower -expr $expression}] != ""} {
+    condition set -using do_lower -expr $expression
+}
+set expression {waves::tb_calculator.DUT.sram_A.DO[31:0]}
+if {[catch {condition new -name  do_upper -expr $expression}] != ""} {
+    condition set -using do_upper -expr $expression
+}
+
+#
+# Mnemonic Maps
+#
+mmap new  -reuse -name {Boolean as Logic} -radix %b -contents {{%c=FALSE -edgepriority 1 -shape low}
+{%c=TRUE -edgepriority 1 -shape high}}
+mmap new  -reuse -name {Example Map} -radix %x -contents {{%b=11???? -bgcolor orange -label REG:%x -linecolor yellow -shape bus}
+{%x=1F -bgcolor red -label ERROR -linecolor white -shape EVENT}
+{%x=2C -bgcolor red -label ERROR -linecolor white -shape EVENT}
+{%x=* -label %x -linecolor gray -shape bus}}
+
+#
+# Waveform windows
+#
+if {[catch {window new WaveWindow -name "Waveform 1" -geometry 1704x996+0+32}] != ""} {
+    window geometry "Waveform 1" 1704x996+0+32
+}
+window target "Waveform 1" on
+waveform using {Waveform 1}
+waveform sidebar select designbrowser
+waveform set \
+    -primarycursor TimeA \
+    -signalnames name \
+    -signalwidth 175 \
+    -units ns \
+    -valuewidth 75
+waveform baseline set -time 0
+
+set id [waveform add -signals  {
+       waves::tb_calculator.DUT.clk
+       } ]
+set id [waveform add -signals  {
+       {di_upper[31:0]}
+       } ]
+set id [waveform add -signals  {
+       {di_lower[31:0]}
+       } ]
+set id [waveform add -signals  {
+       {waves::tb_calculator.DUT.sram_B.AD[9:0]}
+       } ]
+set id [waveform add -signals  {
+       {do_upper[31:0]}
+       } ]
+set id [waveform add -signals  {
+       {do_lower[31:0]}
+       } ]
+set id [waveform add -signals  {
+       {waves::tb_calculator.DUT.u_ctrl.state[2:0]}
+       } ]
+
+waveform xview limits 0 500ns
+
+#
+# Waveform Window Links
+#
+
+#
+# Console windows
+#
+console set -windowname Console
+window geometry Console 600x250+0+0
+
+#
+# Layout selection
+#
diff --git a/src/Makefiles/Makefile b/src/Makefiles/Makefile
new file mode 100644 (file)
index 0000000..5f777bb
--- /dev/null
@@ -0,0 +1,99 @@
+#--------------------------------------------------------------------\r
+# Cadence‑only Makefile (Xcelium / SimVision / IMC)\r
+#--------------------------------------------------------------------\r
+\r
+#--------------------------------------------------------------------\r
+# Add the following to the testbench\r
+# initial begin\r
+#     $shm_open("waves.shm");\r
+#     $shm_probe("AC");\r
+# end\r
+#--------------------------------------------------------------------\r
+\r
+# ===== User‑configurable variables =================================\r
+INCLUDE_FILE_NAME ?= calculator.include\r
+\r
+# ===== Paths =======================================================\r
+CURRENT_DIR := $(shell pwd)\r
+WORKSPACE   := $(CURRENT_DIR)/WORKSPACE\r
+SCRIPT_DIR  := ../../scripts\r
+PYTHON      := python3.12\r
+\r
+# ===== Dynamic macro definitions ===================================\r
+VERILOG_DEFINES := SIM=1 INST_FILE=\"$(INST_FILE)\"\r
+ifeq ($(INIT_DATA),1)\r
+  VERILOG_DEFINES += INIT_DATA=1\r
+  VERILOG_DEFINES += DATA_FILE=\"$(DATA_FILE)\"\r
+endif\r
+DEFINE_FLAGS := $(foreach def,$(VERILOG_DEFINES),+define+$(def))\r
+\r
+# ===== Help Message ================================================\r
+.PHONY: help\r
+help:\r
+       @echo "----------------------------------------------------------------"\r
+       @echo "Administrative targets:"\r
+       @echo "  help               - this message"\r
+       @echo "  clean              - remove WORKSPACE directory"\r
+       @echo\r
+       @echo "Compilation targets:"\r
+       @echo "  link               - generate WORKSPACE/sym_links/"\r
+       @echo "  xrun               - compile & simulate using Cadence Xcelium"\r
+       @echo "  simvision          - view waveform database"\r
+       @echo "  run_and_view       - xrun + simvision"\r
+       @echo "  coverage           - open coverage in IMC"\r
+       @echo\r
+       @echo "  verify_onboarding  - (DIGITAL DESIGN ONBOARDING ONLY) check your project for correctness"\r
+       @echo "----------------------------------------------------------------"\r
+\r
+# ===== Administrative Targets ======================================\r
+.PHONY: clean link\r
+clean:\r
+       @rm -rf $(WORKSPACE)\r
+\r
+link:\r
+       @mkdir -p $(WORKSPACE)/sym_links\r
+       @rm -rf $(WORKSPACE)/sym_links/*\r
+       @python3.12 link_files.py $(INCLUDE_FILE_NAME)\r
+#   @ln -s $(CURRENT_DIR)/../../src/python_model/*.txt WORKSPACE/sym_links/.\r
+\r
+# ===== Simulation Targets ==========================================\r
+.PHONY: xrun simvision run_and_view coverage\r
+\r
+XRUN_FLAGS = -64bit -sv -linedebug -access +rwc \\r
+             -timescale 1ns/10ps \\r
+             $(DEFINE_FLAGS) \\r
+             +testname=$(TESTNAME) \\r
+             +incdir+sym_links \\r
+             -coverage all \\r
+             -licqueue \\r
+             -covoverwrite\r
+\r
+xrun: link\r
+       cd $(WORKSPACE) && \\r
+       xrun $(XRUN_FLAGS) -f sym_links/sim_no_path.include \\r
+            -logfile simulation.log\r
+\r
+simvision:\r
+       cd $(WORKSPACE) && simvision waves.shm &\r
+\r
+run_and_view: xrun simvision\r
+\r
+# Need to change IMC path...\r
+coverage:\r
+       cd $(WORKSPACE) && /tools/software/cadence/vmanager/latest/tools.lnx86/vmgr/bin/imc -load cov_work/scope/test &\r
+\r
+# Generate memory pre and post state files but do not verify correctness\r
+gen_mem:\r
+       $(MAKE) clean\r
+       $(PYTHON) $(SCRIPT_DIR)/init_mem.py $(WORKSPACE)\r
+       $(MAKE) xrun\r
+\r
+verify_onboarding:\r
+       $(MAKE) clean\r
+       $(PYTHON) $(SCRIPT_DIR)/init_mem.py $(WORKSPACE)\r
+       $(MAKE) xrun\r
+       $(PYTHON) $(SCRIPT_DIR)/check_onboarding.py $(WORKSPACE)/memory_post_state_lower.txt $(WORKSPACE)/sim_memory_post_state_lower.txt\r
+       $(PYTHON) $(SCRIPT_DIR)/check_onboarding.py $(WORKSPACE)/memory_post_state_upper.txt $(WORKSPACE)/sim_memory_post_state_upper.txt\r
+\r
+# ===== Default Target ==============================================\r
+.DEFAULT_GOAL := run_and_view\r
diff --git a/src/python_model/memory_post_state b/src/python_model/memory_post_state
new file mode 100644 (file)
index 0000000..8f9f871
--- /dev/null
@@ -0,0 +1,128 @@
+0: 1100011110100111011000110111010110001010010110101110111011100011
+8: 1010100111011010001101001101110001001010010001100011110110000010
+16: 0111000110000001100110000101000111010100101000010010110001100101
+24: 1001011010011100010001110110100111101111100101010101111101111111
+32: 1011011001111011101111101100101101011010010000001011010001010100
+40: 0100110100011000000001100011010101001001110101100001001111010011
+48: 1101000011100000110000010111111101001011011001011010001010011000
+56: 0010111000000011010111001011011101010010011000001111001110000010
+64: 1111111011100100000111100011011010011101110001101001011000011010
+72: 0000000000000000000000000000000000000000000000000000000000000000
+80: 0000000000000000000000000000000000000000000000000000000000000000
+88: 0000000000000000000000000000000000000000000000000000000000000000
+96: 0000000000000000000000000000000000000000000000000000000000000000
+104: 0000000000000000000000000000000000000000000000000000000000000000
+112: 0000000000000000000000000000000000000000000000000000000000000000
+120: 0000000000000000000000000000000000000000000000000000000000000000
+128: 0000000000000000000000000000000000000000000000000000000000000000
+136: 0000000000000000000000000000000000000000000000000000000000000000
+144: 0000000000000000000000000000000000000000000000000000000000000000
+152: 0000000000000000000000000000000000000000000000000000000000000000
+160: 0000000000000000000000000000000000000000000000000000000000000000
+168: 0000000000000000000000000000000000000000000000000000000000000000
+176: 0000000000000000000000000000000000000000000000000000000000000000
+184: 0000000000000000000000000000000000000000000000000000000000000000
+192: 0000000000000000000000000000000000000000000000000000000000000000
+200: 0000000000000000000000000000000000000000000000000000000000000000
+208: 0000000000000000000000000000000000000000000000000000000000000000
+216: 0000000000000000000000000000000000000000000000000000000000000000
+224: 0000000000000000000000000000000000000000000000000000000000000000
+232: 0000000000000000000000000000000000000000000000000000000000000000
+240: 0000000000000000000000000000000000000000000000000000000000000000
+248: 0000000000000000000000000000000000000000000000000000000000000000
+256: 0000000000000000000000000000000000000000000000000000000000000000
+264: 0000000000000000000000000000000000000000000000000000000000000000
+272: 0000000000000000000000000000000000000000000000000000000000000000
+280: 0000000000000000000000000000000000000000000000000000000000000000
+288: 0000000000000000000000000000000000000000000000000000000000000000
+296: 0000000000000000000000000000000000000000000000000000000000000000
+304: 0000000000000000000000000000000000000000000000000000000000000000
+312: 0000000000000000000000000000000000000000000000000000000000000000
+320: 0000000000000000000000000000000000000000000000000000000000000000
+328: 0000000000000000000000000000000000000000000000000000000000000000
+336: 0000000000000000000000000000000000000000000000000000000000000000
+344: 0000000000000000000000000000000000000000000000000000000000000000
+352: 0000000000000000000000000000000000000000000000000000000000000000
+360: 0000000000000000000000000000000000000000000000000000000000000000
+368: 0000000000000000000000000000000000000000000000000000000000000000
+376: 0000000000000000000000000000000000000000000000000000000000000000
+384: 0000000000000000000000000000000000000000000000000000000000000000
+392: 0000000000000000000000000000000000000000000000000000000000000000
+400: 0000000000000000000000000000000000000000000000000000000000000000
+408: 0000000000000000000000000000000000000000000000000000000000000000
+416: 0000000000000000000000000000000000000000000000000000000000000000
+424: 0000000000000000000000000000000000000000000000000000000000000000
+432: 0000000000000000000000000000000000000000000000000000000000000000
+440: 0000000000000000000000000000000000000000000000000000000000000000
+448: 0000000000000000000000000000000000000000000000000000000000000000
+456: 0000000000000000000000000000000000000000000000000000000000000000
+464: 0000000000000000000000000000000000000000000000000000000000000000
+472: 0000000000000000000000000000000000000000000000000000000000000000
+480: 0000000000000000000000000000000000000000000000000000000000000000
+488: 0000000000000000000000000000000000000000000000000000000000000000
+496: 0000000000000000000000000000000000000000000000000000000000000000
+504: 0000000000000000000000000000000000000000000000000000000000000000
+512: 0000000000000000000000000000000000000000000000000000000000000000
+520: 0000000000000000000000000000000000000000000000000000000000000000
+528: 0000000000000000000000000000000000000000000000000000000000000000
+536: 0000000000000000000000000000000000000000000000000000000000000000
+544: 0000000000000000000000000000000000000000000000000000000000000000
+552: 0000000000000000000000000000000000000000000000000000000000000000
+560: 0000000000000000000000000000000000000000000000000000000000000000
+568: 0000000000000000000000000000000000000000000000000000000000000000
+576: 0000000000000000000000000000000000000000000000000000000000000000
+584: 0000000000000000000000000000000000000000000000000000000000000000
+592: 0000000000000000000000000000000000000000000000000000000000000000
+600: 0000000000000000000000000000000000000000000000000000000000000000
+608: 0000000000000000000000000000000000000000000000000000000000000000
+616: 0000000000000000000000000000000000000000000000000000000000000000
+624: 0000000000000000000000000000000000000000000000000000000000000000
+632: 0000000000000000000000000000000000000000000000000000000000000000
+640: 0000000000000000000000000000000000000000000000000000000000000000
+648: 0000000000000000000000000000000000000000000000000000000000000000
+656: 0000000000000000000000000000000000000000000000000000000000000000
+664: 0000000000000000000000000000000000000000000000000000000000000000
+672: 0000000000000000000000000000000000000000000000000000000000000000
+680: 0000000000000000000000000000000000000000000000000000000000000000
+688: 0000000000000000000000000000000000000000000000000000000000000000
+696: 0000000000000000000000000000000000000000000000000000000000000000
+704: 0000000000000000000000000000000000000000000000000000000000000000
+712: 0000000000000000000000000000000000000000000000000000000000000000
+720: 0000000000000000000000000000000000000000000000000000000000000000
+728: 0000000000000000000000000000000000000000000000000000000000000000
+736: 0000000000000000000000000000000000000000000000000000000000000000
+744: 0000000000000000000000000000000000000000000000000000000000000000
+752: 0000000000000000000000000000000000000000000000000000000000000000
+760: 0000000000000000000000000000000000000000000000000000000000000000
+768: 0000000000000000000000000000000000000000000000000000000000000000
+776: 0000000000000000000000000000000000000000000000000000000000000000
+784: 0000000000000000000000000000000000000000000000000000000000000000
+792: 0000000000000000000000000000000000000000000000000000000000000000
+800: 0000000000000000000000000000000000000000000000000000000000000000
+808: 0000000000000000000000000000000000000000000000000000000000000000
+816: 0000000000000000000000000000000000000000000000000000000000000000
+824: 0000000000000000000000000000000000000000000000000000000000000000
+832: 0000000000000000000000000000000000000000000000000000000000000000
+840: 0000000000000000000000000000000000000000000000000000000000000000
+848: 0000000000000000000000000000000000000000000000000000000000000000
+856: 0000000000000000000000000000000000000000000000000000000000000000
+864: 0000000000000000000000000000000000000000000000000000000000000000
+872: 0000000000000000000000000000000000000000000000000000000000000000
+880: 0000000000000000000000000000000000000000000000000000000000000000
+888: 0000000000000000000000000000000000000000000000000000000000000000
+896: 0000000000000000000000000000000000000000000000000000000000000000
+904: 0000000000000000000000000000000000000000000000000000000000000000
+912: 0000000000000000000000000000000000000000000000000000000000000000
+920: 0000000000000000000000000000000000000000000000000000000000000000
+928: 0000000000000000000000000000000000000000000000000000000000000000
+936: 0000000000000000000000000000000000000000000000000000000000000000
+944: 0000000000000000000000000000000000000000000000000000000000000000
+952: 0000000000000000000000000000000000000000000000000000000000000000
+960: 0000000000000000000000000000000000000000000000000000000000000000
+968: 0000000000000000000000000000000000000000000000000000000000000000
+976: 0000000000000000000000000000000000000000000000000000000000000000
+984: 0000000000000000000000000000000000000000000000000000000000000000
+992: 0000000000000000000000000000000000000000000000000000000000000000
+1000: 0000000000000000000000000000000000000000000000000000000000000000
+1008: 0000000000000000000000000000000000000000000000000000000000000000
+1016: 0000000000000000000000000000000000000000000000000000000000000000
diff --git a/src/python_model/memory_pre_state b/src/python_model/memory_pre_state
new file mode 100644 (file)
index 0000000..21289f9
--- /dev/null
@@ -0,0 +1,128 @@
+0: 1100011110100111011000110111010110001010010110101110111011100011
+8: 1010100111011010001101001101110001001010010001100011110110000010
+16: 0000000000000000000000000000000000000000000000000000000000000000
+24: 1001011010011100010001110110100111101111100101010101111101111111
+32: 1011011001111011101111101100101101011010010000001011010001010100
+40: 0000000000000000000000000000000000000000000000000000000000000000
+48: 1101000011100000110000010111111101001011011001011010001010011000
+56: 0010111000000011010111001011011101010010011000001111001110000010
+64: 0000000000000000000000000000000000000000000000000000000000000000
+72: 0000000000000000000000000000000000000000000000000000000000000000
+80: 0000000000000000000000000000000000000000000000000000000000000000
+88: 0000000000000000000000000000000000000000000000000000000000000000
+96: 0000000000000000000000000000000000000000000000000000000000000000
+104: 0000000000000000000000000000000000000000000000000000000000000000
+112: 0000000000000000000000000000000000000000000000000000000000000000
+120: 0000000000000000000000000000000000000000000000000000000000000000
+128: 0000000000000000000000000000000000000000000000000000000000000000
+136: 0000000000000000000000000000000000000000000000000000000000000000
+144: 0000000000000000000000000000000000000000000000000000000000000000
+152: 0000000000000000000000000000000000000000000000000000000000000000
+160: 0000000000000000000000000000000000000000000000000000000000000000
+168: 0000000000000000000000000000000000000000000000000000000000000000
+176: 0000000000000000000000000000000000000000000000000000000000000000
+184: 0000000000000000000000000000000000000000000000000000000000000000
+192: 0000000000000000000000000000000000000000000000000000000000000000
+200: 0000000000000000000000000000000000000000000000000000000000000000
+208: 0000000000000000000000000000000000000000000000000000000000000000
+216: 0000000000000000000000000000000000000000000000000000000000000000
+224: 0000000000000000000000000000000000000000000000000000000000000000
+232: 0000000000000000000000000000000000000000000000000000000000000000
+240: 0000000000000000000000000000000000000000000000000000000000000000
+248: 0000000000000000000000000000000000000000000000000000000000000000
+256: 0000000000000000000000000000000000000000000000000000000000000000
+264: 0000000000000000000000000000000000000000000000000000000000000000
+272: 0000000000000000000000000000000000000000000000000000000000000000
+280: 0000000000000000000000000000000000000000000000000000000000000000
+288: 0000000000000000000000000000000000000000000000000000000000000000
+296: 0000000000000000000000000000000000000000000000000000000000000000
+304: 0000000000000000000000000000000000000000000000000000000000000000
+312: 0000000000000000000000000000000000000000000000000000000000000000
+320: 0000000000000000000000000000000000000000000000000000000000000000
+328: 0000000000000000000000000000000000000000000000000000000000000000
+336: 0000000000000000000000000000000000000000000000000000000000000000
+344: 0000000000000000000000000000000000000000000000000000000000000000
+352: 0000000000000000000000000000000000000000000000000000000000000000
+360: 0000000000000000000000000000000000000000000000000000000000000000
+368: 0000000000000000000000000000000000000000000000000000000000000000
+376: 0000000000000000000000000000000000000000000000000000000000000000
+384: 0000000000000000000000000000000000000000000000000000000000000000
+392: 0000000000000000000000000000000000000000000000000000000000000000
+400: 0000000000000000000000000000000000000000000000000000000000000000
+408: 0000000000000000000000000000000000000000000000000000000000000000
+416: 0000000000000000000000000000000000000000000000000000000000000000
+424: 0000000000000000000000000000000000000000000000000000000000000000
+432: 0000000000000000000000000000000000000000000000000000000000000000
+440: 0000000000000000000000000000000000000000000000000000000000000000
+448: 0000000000000000000000000000000000000000000000000000000000000000
+456: 0000000000000000000000000000000000000000000000000000000000000000
+464: 0000000000000000000000000000000000000000000000000000000000000000
+472: 0000000000000000000000000000000000000000000000000000000000000000
+480: 0000000000000000000000000000000000000000000000000000000000000000
+488: 0000000000000000000000000000000000000000000000000000000000000000
+496: 0000000000000000000000000000000000000000000000000000000000000000
+504: 0000000000000000000000000000000000000000000000000000000000000000
+512: 0000000000000000000000000000000000000000000000000000000000000000
+520: 0000000000000000000000000000000000000000000000000000000000000000
+528: 0000000000000000000000000000000000000000000000000000000000000000
+536: 0000000000000000000000000000000000000000000000000000000000000000
+544: 0000000000000000000000000000000000000000000000000000000000000000
+552: 0000000000000000000000000000000000000000000000000000000000000000
+560: 0000000000000000000000000000000000000000000000000000000000000000
+568: 0000000000000000000000000000000000000000000000000000000000000000
+576: 0000000000000000000000000000000000000000000000000000000000000000
+584: 0000000000000000000000000000000000000000000000000000000000000000
+592: 0000000000000000000000000000000000000000000000000000000000000000
+600: 0000000000000000000000000000000000000000000000000000000000000000
+608: 0000000000000000000000000000000000000000000000000000000000000000
+616: 0000000000000000000000000000000000000000000000000000000000000000
+624: 0000000000000000000000000000000000000000000000000000000000000000
+632: 0000000000000000000000000000000000000000000000000000000000000000
+640: 0000000000000000000000000000000000000000000000000000000000000000
+648: 0000000000000000000000000000000000000000000000000000000000000000
+656: 0000000000000000000000000000000000000000000000000000000000000000
+664: 0000000000000000000000000000000000000000000000000000000000000000
+672: 0000000000000000000000000000000000000000000000000000000000000000
+680: 0000000000000000000000000000000000000000000000000000000000000000
+688: 0000000000000000000000000000000000000000000000000000000000000000
+696: 0000000000000000000000000000000000000000000000000000000000000000
+704: 0000000000000000000000000000000000000000000000000000000000000000
+712: 0000000000000000000000000000000000000000000000000000000000000000
+720: 0000000000000000000000000000000000000000000000000000000000000000
+728: 0000000000000000000000000000000000000000000000000000000000000000
+736: 0000000000000000000000000000000000000000000000000000000000000000
+744: 0000000000000000000000000000000000000000000000000000000000000000
+752: 0000000000000000000000000000000000000000000000000000000000000000
+760: 0000000000000000000000000000000000000000000000000000000000000000
+768: 0000000000000000000000000000000000000000000000000000000000000000
+776: 0000000000000000000000000000000000000000000000000000000000000000
+784: 0000000000000000000000000000000000000000000000000000000000000000
+792: 0000000000000000000000000000000000000000000000000000000000000000
+800: 0000000000000000000000000000000000000000000000000000000000000000
+808: 0000000000000000000000000000000000000000000000000000000000000000
+816: 0000000000000000000000000000000000000000000000000000000000000000
+824: 0000000000000000000000000000000000000000000000000000000000000000
+832: 0000000000000000000000000000000000000000000000000000000000000000
+840: 0000000000000000000000000000000000000000000000000000000000000000
+848: 0000000000000000000000000000000000000000000000000000000000000000
+856: 0000000000000000000000000000000000000000000000000000000000000000
+864: 0000000000000000000000000000000000000000000000000000000000000000
+872: 0000000000000000000000000000000000000000000000000000000000000000
+880: 0000000000000000000000000000000000000000000000000000000000000000
+888: 0000000000000000000000000000000000000000000000000000000000000000
+896: 0000000000000000000000000000000000000000000000000000000000000000
+904: 0000000000000000000000000000000000000000000000000000000000000000
+912: 0000000000000000000000000000000000000000000000000000000000000000
+920: 0000000000000000000000000000000000000000000000000000000000000000
+928: 0000000000000000000000000000000000000000000000000000000000000000
+936: 0000000000000000000000000000000000000000000000000000000000000000
+944: 0000000000000000000000000000000000000000000000000000000000000000
+952: 0000000000000000000000000000000000000000000000000000000000000000
+960: 0000000000000000000000000000000000000000000000000000000000000000
+968: 0000000000000000000000000000000000000000000000000000000000000000
+976: 0000000000000000000000000000000000000000000000000000000000000000
+984: 0000000000000000000000000000000000000000000000000000000000000000
+992: 0000000000000000000000000000000000000000000000000000000000000000
+1000: 0000000000000000000000000000000000000000000000000000000000000000
+1008: 0000000000000000000000000000000000000000000000000000000000000000
+1016: 0000000000000000000000000000000000000000000000000000000000000000
diff --git a/src/python_model/new_dd_onboarding.ipynb b/src/python_model/new_dd_onboarding.ipynb
new file mode 100644 (file)
index 0000000..78593c3
--- /dev/null
@@ -0,0 +1,240 @@
+{
+ "cells": [
+  {
+   "cell_type": "markdown",
+   "id": "ff5a4c84",
+   "metadata": {},
+   "source": [
+    "# New Digital Design Onboarding Assignment \n",
+    "\n",
+    "The first cell generates two numbers and computes the result. \n",
+    "\n",
+    "The second cell repeats the first cell 128 times and writes the answers to a text file. \n",
+    "\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "id": "fa63148b",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "64-bit binary number: 1000110001110010000011111100100000101001001110011100110001110100\n",
+      "First 32-bit number: 0b101001001110011100110001110100\n",
+      "First 32-bit number: 0b10001100011100100000111111001000\n",
+      "64-bit binary number: 0000000100011110001111111011001101110101110011000100111001001100\n",
+      "Result of addition in binary: 0111011011101010100011011111111110110101101010111101110000111100\n"
+     ]
+    }
+   ],
+   "source": [
+    "\n",
+    "import numpy as np \n",
+    "\n",
+    "'''\n",
+    "Assumptions: \n",
+    "1. The code generates two 64-bit unsigned integers.\n",
+    "2. Each 64-bit integer is formed by combining strictly two 32-bit integers.\n",
+    "3. Overflow is not handled\n",
+    "'''\n",
+    "\n",
+    "mem_value1 = np.random.randint(0, 2**64, size=1, dtype=np.uint64) \n",
+    "print(\"64-bit binary number: \" + format(mem_value1.item(), '064b'))\n",
+    "\n",
+    "# Extract lower 32 bits\n",
+    "lower = mem_value1.item() & 0xFFFFFFFF\n",
+    "print(\"First 32-bit number: \" + bin(lower))\n",
+    "\n",
+    "# Extract upper 32 bits\n",
+    "upper = (mem_value1.item() >> 32) & 0xFFFFFFFF\n",
+    "print(\"First 32-bit number: \" + bin(upper))\n",
+    "\n",
+    "result1 = lower + upper\n",
+    "\n",
+    "mem_value2 = np.random.randint(0, 2**64, size=1, dtype=np.uint64) \n",
+    "print(\"64-bit binary number: \" + format(mem_value2.item(), '064b'))\n",
+    "\n",
+    "# Extract lower 32 bits\n",
+    "lower = mem_value2.item() & 0xFFFFFFFF\n",
+    "\n",
+    "# Extract upper 32 bits\n",
+    "upper = (mem_value2.item() >> 32) & 0xFFFFFFFF\n",
+    "\n",
+    "result2 = lower + upper\n",
+    "\n",
+    "result = result1 + (result2 << 32)\n",
+    "\n",
+    "result_binary = format(result, '064b')\n",
+    "print(\"Result of addition in binary: \" + result_binary)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
+   "id": "4054ba9f",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Results saved in 'output_128_results.txt'\n"
+     ]
+    }
+   ],
+   "source": [
+    "import numpy as np\n",
+    "\n",
+    "\n",
+    "\n",
+    "with open(\"output_128_results.txt\", \"w\") as f:\n",
+    "    for i in range(128):\n",
+    "        # Generate first 64-bit integer\n",
+    "        value1 = np.random.randint(0, 2**32, size=1, dtype=np.uint64)\n",
+    "        value1 = value1 << 32\n",
+    "        value1 = value1 | np.random.randint(0, 2**32, size=1, dtype=np.uint64)  \n",
+    "        combined_binary1 = format(value1.item(), '064b')\n",
+    "\n",
+    "        # Generate second 64-bit integer\n",
+    "        value2 = np.random.randint(0, 2**32, size=1, dtype=np.uint64)\n",
+    "        value2 = value2 << 32\n",
+    "        value2 = value2 | np.random.randint(0, 2**32, size=1, dtype=np.uint64)  \n",
+    "        combined_binary2 = format(value2.item(), '064b')\n",
+    "\n",
+    "        # Add the two 64-bit values\n",
+    "        result = value1 + value2\n",
+    "        result_binary = format(result.item(), '064b')\n",
+    "\n",
+    "        # Write the results to the file with an iteration header\n",
+    "        #f.write(f\"{i+1}: \" + combined_binary1 + \" \" + combined_binary2 + \" \" + result_binary + \"\\n\")\n",
+    "        f.write(combined_binary1 + \" \" + combined_binary2 + \" \" + result_binary + \"\\n\")\n",
+    "\n",
+    "\n",
+    "print(\"Results saved in 'output_128_results.txt'\")\n"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "id": "64c062ba",
+   "metadata": {},
+   "source": [
+    "## Memory sim test script\n",
+    "\n",
+    "- To customize, edit the #TODO: below and the instructions.txt for assembly. \n",
+    "- Since the program only needs to handle addition, instructions.txt does not have a \"add\" opcode. Instructions are in the format M1 S1 S2, where M1 = S1+S2. "
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "id": "f5ce66c2",
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "Results saved in 'memory_pre_state_upper.txt' and 'memory_pre_state_lower.txt'\n",
+      "Post-state memory written to 'memory_post_state_upper.txt' and 'memory_post_state_lower.txt'\n"
+     ]
+    }
+   ],
+   "source": [
+    "\n",
+    "import numpy as np\n",
+    "\n",
+    "read_start_addr = 0\n",
+    "read_end_addr = 255\n",
+    "write_start_addr = 384\n",
+    "write_end_addr = 511\n",
+    "\n",
+    "def gen():\n",
+    "    \"\"\"Generates a 64-bit unsigned integer.\"\"\"\n",
+    "    value = np.random.randint(0, 2**64, size=1, dtype=np.uint64) \n",
+    "    return value\n",
+    "\n",
+    "# Generate and write pre-state memory\n",
+    "with open(\"memory_pre_state_upper.txt\", \"w\") as u, open(\"memory_pre_state_lower.txt\", \"w\") as l:\n",
+    "    for i in range(256):\n",
+    "        value = gen()\n",
+    "        upper = ((value.item() >> 32) & 0xFFFFFFFF)\n",
+    "        lower = (value.item() & 0xFFFFFFFF)\n",
+    "        u.write(format(upper, '032b') + \"\\n\")\n",
+    "        l.write(format(lower, '032b') + \"\\n\")\n",
+    "    for i in range(256):\n",
+    "        u.write(format(0, '032b') + \"\\n\")\n",
+    "        l.write(format(0, '032b') + \"\\n\")\n",
+    "\n",
+    "print(\"Results saved in 'memory_pre_state_upper.txt' and 'memory_pre_state_lower.txt'\")\n",
+    "\n",
+    "# Simulate addition\n",
+    "with open(\"memory_post_state_upper.txt\", \"w\") as u_out, open(\"memory_post_state_lower.txt\", \"w\") as l_out:\n",
+    "    with open(\"memory_pre_state_upper.txt\", \"r\") as u_in, open(\"memory_pre_state_lower.txt\", \"r\") as l_in:\n",
+    "        # Read all pre-state lines\n",
+    "        upper_lines = u_in.readlines()\n",
+    "        lower_lines = l_in.readlines()\n",
+    "\n",
+    "        read_addr = read_start_addr\n",
+    "        write_addr = write_start_addr\n",
+    "        for i in range(128):\n",
+    "            # Convert binary strings to integers\n",
+    "            src1_upper = int(upper_lines[read_addr].strip(), 2)\n",
+    "            src1_lower = int(lower_lines[read_addr].strip(), 2)\n",
+    "            \n",
+    "            read_addr += 1\n",
+    "\n",
+    "            src2_upper = int(upper_lines[read_addr].strip(), 2)\n",
+    "            src2_lower = int(lower_lines[read_addr].strip(), 2)\n",
+    "            \n",
+    "            read_addr += 1\n",
+    "\n",
+    "            src1 = (src1_upper + src1_lower) & 0xFFFFFFFF\n",
+    "            src2 = (src2_upper + src2_lower) & 0xFFFFFFFF\n",
+    "\n",
+    "            print(\"src1: \" + bin(src1))\n",
+    "            print(\"src2: \" + bin(src2))\n",
+    "            result = (src2 << 32) | src1\n",
+    "            print(\"result: \" + bin(result))\n",
+    "            res_upper = (result >> 32) & 0xFFFFFFFF\n",
+    "            res_lower = result & 0xFFFFFFFF\n",
+    "\n",
+    "            # Save result in memory at the correct index\n",
+    "            upper_lines[write_addr] = format(res_upper, '032b') + \"\\n\"\n",
+    "            lower_lines[write_addr] = format(res_lower, '032b') + \"\\n\"\n",
+    "\n",
+    "            write_addr += 1\n",
+    "\n",
+    "        # Write post-state memory\n",
+    "        u_out.writelines(upper_lines)\n",
+    "        l_out.writelines(lower_lines)\n",
+    "\n",
+    "print(\"Post-state memory written to 'memory_post_state_upper.txt' and 'memory_post_state_lower.txt'\")\n"
+   ]
+  }
+ ],
+ "metadata": {
+  "kernelspec": {
+   "display_name": "venv (3.12.11)",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.12.11"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}
diff --git a/src/verilog/.adder32.sv.swn b/src/verilog/.adder32.sv.swn
new file mode 100644 (file)
index 0000000..ff20935
Binary files /dev/null and b/src/verilog/.adder32.sv.swn differ
diff --git a/src/verilog/CF_SRAM_1024x32.tt_180V_25C.v b/src/verilog/CF_SRAM_1024x32.tt_180V_25C.v
new file mode 100644 (file)
index 0000000..e92983f
--- /dev/null
@@ -0,0 +1,1530 @@
+
+// ===============================================
+// Copyright 2025, Umbralogic Technologies, LLC.
+//
+
+`timescale 1 ns / 1 ps
+
+`celldefine
+
+module CF_SRAM_1024x32_macro
+(DO, ScanOutCC, AD, BEN, CLKin, DI, EN, R_WB, ScanInCC, ScanInDL, ScanInDR, SM, TM, WLBI, WLOFF,
+`ifdef USE_PG_PIN
+vgnd, vnb, vpb, vpwra,
+`endif
+vpwrac,
+`ifdef USE_PG_PIN
+vpwrm,
+vpwrp,
+`endif
+vpwrpc
+);
+    parameter NB = 32;  // Number of Data Bits
+    parameter NA = 10;  // Number of Address Bits
+    parameter NW = 1024;  // Number of WORDS
+    parameter SEED = 0 ;    // User can define SEED at memory instantiation by .SEED(<Some_Seed_value>)
+
+    output [(NB - 1) : 0] DO;
+    output ScanOutCC;
+
+    input [(NB - 1) : 0] DI;
+    input [(NB - 1) : 0] BEN;
+    input [(NA - 1) : 0] AD;
+    input EN;
+    input R_WB;
+    input CLKin;
+    input WLBI;
+    input WLOFF;
+    input TM;
+    input SM;
+    input ScanInCC;
+    input ScanInDL;
+    input ScanInDR;
+    input vpwrac;
+    input vpwrpc;
+`ifdef USE_PG_PIN
+    input vgnd;
+    input vpwrm;
+
+`ifdef CF_SRAM_PA_SIM
+  inout vpwra;
+`else
+  input vpwra;
+`endif
+
+
+`ifdef CF_SRAM_PA_SIM
+  inout vpwrp;
+`else
+  input vpwrp;
+`endif
+
+    input vnb;
+    input vpb;
+`else
+    supply0 vgnd;
+    supply0 vnb;
+    supply1 vpwra;
+    supply1 vpwrm;
+    supply1 vpwrp;
+    supply1 vpb;
+`endif
+
+    reg [(NB - 1) : 0] memory [0: (NW - 1)];
+
+    wire undefined_mode ; 
+    wire normal_mode ;
+    wire test_mode ; 
+    wire sleep_mode ; 
+    wire pwroff_mode ;
+    wire periphery_x_mode ;
+    wire mem_x, write_mem_x ; 
+    wire pg_cond ;
+
+//Clock & Access Time Notify Registers
+    reg notify_tCYC;
+    reg notify_tCHI;
+    reg notify_tCLO;
+    reg notify_tRD;
+    reg notify_tWR;
+
+//Setup Time Notify Registers
+    reg notify_tSDI;
+    reg notify_tSA;
+    reg notify_tSRWB;
+    reg notify_tSBEN;
+    reg notify_tSEN;
+    reg notify_tSScanInCC;
+    reg notify_tSScanInDL;
+    reg notify_tSScanInDR;
+    reg notify_tSSM;
+    reg notify_tSTM;
+    reg tsu_th_notifier_cond;
+    reg tsu_th_notifier_cond_1;
+    wire notifier_en;
+
+// The variables below only used to initialize memory at zero time with random data
+//-----------------------------------------------------------------------------------
+    integer i, l ;
+    reg [NA - 1 : 0] adr ;
+    reg [NB - 1 : 0] din ;
+    reg [NB:0] data_range;
+//-----------------------------------------------------------------------------------
+    reg EN_m ;  // State of the EN signal is saved when internal clock is 
+    wire clki ;  // Internal clock signal 
+    wire clki_tm ;  // Internal clock signal
+
+    wire [(NB - 1) : 0] DO_temp ;
+    wire ScanOutCC_temp ;
+    wire tm_and_not_sm;
+
+// The variables below are used for undefined state and write mem x messages.
+    reg   msg_undef_is_pending       = 1'b0;
+    reg   msg_undef_last_value       = 1'b0;
+    time  msg_undef_pend_time;
+    event msg_undef_pend_event;
+    event msg_undef_process_event;
+    reg   msg_write_x_is_pending     = 1'b0;
+    reg   msg_write_x_last_value     = 1'b0;
+    time  msg_write_x_pend_time;
+    event msg_write_x_pend_event;
+    event msg_write_x_process_event;
+
+reg dis_err_msgs;
+initial
+begin
+dis_err_msgs = 1'b1;
+`ifdef CF_SRAM_DIS_ERR_MSGS
+`else
+#1;
+dis_err_msgs = 1'b0;
+`endif
+end
+
+    initial
+    begin
+    notify_tSDI= 1'b0;
+    notify_tSA= 1'b0;
+    notify_tSRWB= 1'b0;
+    notify_tSBEN= 1'b0;
+    notify_tSEN= 1'b0;
+    notify_tSScanInCC= 1'b0;
+    notify_tSScanInDL= 1'b0;
+    notify_tSScanInDR= 1'b0;
+    notify_tSSM= 1'b0;
+    notify_tSTM= 1'b0;
+    tsu_th_notifier_cond= 1'b0;
+    tsu_th_notifier_cond_1= 1'b0;
+    
+   end
+// determine when :
+// (1) any input is 'z' or 'x' 
+// (2) when there is any tsu/th violation on any of the inputs dlz   09/17/2011
+// wire inputs_x = ^{AD, BEN, CLKin, EN, R_WB, ScanInCC, ScanInDL, ScanInDR, SM, TM, WLOFF};
+
+   wire inputs_x = (WLOFF === 1) ?          1'b0 :
+                (TM    === 1) ? ^{                 SM,                CLKin} :
+                (EN    === 1) ? ^{WLOFF, TM, SM,     R_WB, BEN, CLKin} :
+                (EN    === 0) ? ^{WLOFF, TM, SM,                CLKin} :
+                                1'bx;
+  wire scan_inputs_x = ^{ScanInCC, ScanInDL, ScanInDR};
+
+
+    reg inputs_x_reg;
+    wire scan_inputs_x_cond; 
+
+
+// determine when :
+// (1) any input is 'z' or 'x' 
+// (2) when there is any tsu/th violation on any of the inputs dlz   09/17/2011
+
+
+assign DO =( periphery_x_mode || tsu_th_notifier_cond ) ? {NB{1'bx}} : DO_temp ;
+
+assign ScanOutCC = periphery_x_mode ? 1'bx : ScanOutCC_temp ;
+
+
+// Following block determines if the control signals together
+// presents an undefined condition. The logic for undefined 
+// is given below.
+// Warning message is thrown if undefiend condition is found.
+// 
+assign pg_cond= ((vpb===1'b1) && (vnb===1'b0) && (vgnd===1'b0)) ; 
+
+
+
+   always @ (posedge CLKin) begin
+     if (inputs_x === 1'bx) begin
+         inputs_x_reg = 1'b1;
+     end
+     else begin
+         inputs_x_reg = 1'b0;
+    
+     end
+   end
+
+
+// determine when 
+// (1) any input is 'z' or 'x' 
+// (2) when there is any tsu/th violation on any of the inputs dlz   09/17/2011
+
+   assign scan_inputs_x_cond = (ScanInCC === 1'bz)||( ScanInDL === 1'bz)||(ScanInDR === 1'bz) ;
+
+
+assign normal_mode=(vpwra===1 && vpwrp===1 && pg_cond && TM===0 && SM===0 && WLOFF===0 && tsu_th_notifier_cond===0);
+
+assign test_mode  =(vpwrp===1 && pg_cond && TM===1 && tsu_th_notifier_cond===0);
+
+assign sleep_mode =(vpwra===1 && pg_cond && WLOFF===1); 
+// Deep sleep mode or Power Down 
+
+assign undefined_mode = !(normal_mode || test_mode || sleep_mode || pwroff_mode) ;
+
+assign pwroff_mode = (vpwra !== 1 && vpwrp !== 1 && pg_cond);
+assign periphery_x_mode = (vpwrp !== 1);       
+// Overlapped with poweroff mode/sleep mode conditions     
+
+assign mem_x = ((vpwra !== 1) || (WLOFF=== 0 && vpwrp !== 1)) ;         
+
+assign write_mem_x = (pwroff_mode || mem_x || undefined_mode || tsu_th_notifier_cond ) ;
+
+always @ (notify_tSDI or notify_tSA or notify_tSRWB or notify_tSBEN or notify_tSEN) begin
+  if (normal_mode || test_mode )
+   begin
+    disable TSU_TH_NOTIFIER_COND_CLEAR;
+    tsu_th_notifier_cond = 1'b1;
+   end
+ end
+always @ (posedge CLKin) begin: TSU_TH_NOTIFIER_COND_CLEAR
+ #1 tsu_th_notifier_cond = 1'b0;
+end
+
+
+
+always @(notify_tSScanInCC) begin
+  #1;
+  memory_mode_inst.ADreg[11] <= 1'bx;
+  memory_mode_inst.ADreg_scan[11] <= 'bx;
+end
+
+always @(notify_tSScanInDL) begin
+  #1;
+  memory_mode_inst.DIreg[0] <= 1'bx;
+end
+
+always @(notify_tSScanInDR) begin
+  #1;
+  memory_mode_inst.DIreg[NB/2] <= 1'bx;
+end
+
+always @(notify_tSA) begin
+  #1;
+  memory_mode_inst.ADreg <= 'bx;
+  memory_mode_inst.ADreg_scan <= 'bx;
+end
+
+always @(notify_tSDI) begin
+  #1;
+  memory_mode_inst.DIreg <= 'bx;
+end
+
+always @(notify_tSRWB) begin
+  #1;
+  memory_mode_inst.R_WBreg_scan <= 'bx;
+  memory_mode_inst.R_WBreg <= 'bx;
+end
+
+always @(notify_tSBEN) begin
+  #1;
+  memory_mode_inst.BENreg <= 'bx;
+end
+
+always @(notify_tSEN) begin
+  #1;
+  memory_mode_inst.ENreg <= 'bx;
+  memory_mode_inst.ENreg_scan <= 'bx;
+end
+
+always @(notify_tSTM or notify_tSSM) begin
+  #1;
+  memory_mode_inst.DIreg <= 'bx;
+  memory_mode_inst.ADreg <= 'bx;
+  memory_mode_inst.ADreg_scan <= 'bx;
+  memory_mode_inst.R_WBreg_scan <= 'bx;
+  memory_mode_inst.R_WBreg <= 'bx;
+  memory_mode_inst.BENreg <= 'bx;
+  memory_mode_inst.ENreg <= 'bx;
+  memory_mode_inst.ENreg_scan <= 'bx;
+end
+
+// Delay undefined state processing so that the final value of
+// undefined mode from the originating time tick is available.
+always @(msg_undef_pend_event) begin
+    #1;
+    -> msg_undef_process_event;
+end
+
+// Handle undefined state error queuing and processing.
+always @(undefined_mode, msg_undef_process_event) begin
+  #0.1;  
+
+
+  // Display any pending undefined state errors from previous time ticks.
+  // This must happen before processing signals from the current time tick.
+
+  if (msg_undef_is_pending) begin
+    if (msg_undef_pend_time != $time) begin
+      msg_undef_is_pending = 1'b0;
+      if (!dis_err_msgs) begin
+        $display("===NOTE=== (efsram) : Undefined state in CF_SRAM_00128x032_008_18: vpwra= %b vpwrp=%b TM=%b SM=%b WLOFF=%b in instance %m at time=%t", vpwrac, vpwrpc, TM, SM, WLOFF, $time) ;
+      end
+    end
+  end
+
+  // Process signals in the current time tick.
+  // This code may be executed more than once per time tick.
+  if (undefined_mode) begin
+    // Only queue an error message on a change in undefined_mode
+    if (msg_undef_last_value == 1'b0) begin
+      msg_undef_is_pending = 1'b1;
+      msg_undef_pend_time = $time;
+      -> msg_undef_pend_event;
+    end
+  end
+  else begin
+    // Clear any pending undefined mode error messages.
+    msg_undef_is_pending = 1'b0;
+  end
+
+  msg_undef_last_value = undefined_mode;
+end
+
+// Delay write mem x processing so that the final value of
+// write mem x from the originating time tick is available.
+always @(msg_write_x_pend_event) begin
+    #1;
+    -> msg_write_x_process_event;
+end
+
+// Handle write_mem_x action queuing and processing.
+always @(write_mem_x, dis_err_msgs, msg_write_x_process_event) begin
+
+  // Handle any pending write mem Xs from previous time ticks.
+  // This must happen before processing signals from the current time tick.
+  if (msg_write_x_is_pending) begin
+    if (msg_write_x_pend_time != $time) begin
+      msg_write_x_is_pending = 1'b0;
+      #0.1;
+      if(write_mem_x) begin
+        write_x_in_whole_memory;
+        if (!dis_err_msgs) begin
+          $display("===INFO=== (cftssc) : Writing X to whole memory:pwroff_mode=%b mem_x=%b undefined_mode=%b in instance %m at %t",pwroff_mode, mem_x, undefined_mode, $time) ;
+        end
+      end
+      #0.1;
+    end
+  end
+
+  // Process signals in the current time tick.
+  // This code may be executed more than once per time tick.
+  if (write_mem_x) begin
+    // Only queue an error message on a change in write_mem_x
+    if (msg_write_x_last_value == 1'b0) begin
+      msg_write_x_is_pending = 1'b1;
+      msg_write_x_pend_time = $time;
+      -> msg_write_x_pend_event;
+    end
+  end
+  else begin
+    // Clear any pending write mem x actions.
+    msg_write_x_is_pending = 1'b0;
+  end
+  msg_write_x_last_value = write_mem_x;
+end
+
+assign notifier_en = (EN===1'b1) && (sleep_mode !== 1'b1) && (pwroff_mode !== 1'b1) && (periphery_x_mode !== 1'b1) && (mem_x !== 1'b1) && (undefined_mode !== 1'b1) ;
+
+
+//===================================================================================
+//  Clock Gating functionality:
+//    When the macro is deselected with EN = 0, internal clock gating 
+//    doesn't affect the external operations of the macro.
+//    When EN = 0 and macro is not in test mode i.e. SM = TM = 0 
+//    the clock path of the macro is forced to an inactive state i.e. clki = 0  
+//===================================================================================
+
+    always @(*) begin
+        #0.1;
+        if (CLKin == 0)
+            EN_m = EN;
+    end  
+
+    assign clki = CLKin && (EN_m || TM || SM); // Clock Gating logic
+    assign clki_tm = CLKin && (TM || SM); // Clocking logic for test mode
+
+
+    //WorkAround provided by MGC -BOH 
+    and i1 (tm_and_not_sm, TM, !SM);
+
+   wire not_tm_and_notifier_en = TM===1'b0 && notifier_en===1'b1;
+   wire tm_and_not_sm_and_notifier_en = tm_and_not_sm && notifier_en===1'b1;
+   wire not_sm_and_notifier_en = SM===1'b0 && notifier_en===1'b1;
+   wire sm_and_notifier_en = SM===1'b1 && notifier_en===1'b1;
+   wire notifier_en_a = notifier_en===1'b1; 
+
+
+// dlz compute signals for the timing notifiers CDT 108028 
+
+// This block to initialize the memory array with random data at zero time. 
+// If the input SEED is zero then default memory contents is 'x'.
+// To initialize with random 1/0 user need to 
+initial begin
+    rand_init_whole_memory ;
+end
+
+`ifndef functional
+
+specify
+    specparam
+
+    tCYC = 8.0000,
+    tCHI = 4.0000,
+    tCLO = 4.0000,
+    tRD = 2.4412,
+    tWR = 2.0412,
+    tTD = 1.6212,
+    tTM = 1.7481,
+    tSSM = 6.5000,
+    tHSM = 1.0000,
+    tSTM = 6.5000,
+    tHTM = 1.0000,
+    tSADCTL = 0.8000,
+    tHADCTL = 0.5500,
+    tSASSC = 0.5500,
+    tDASSC = 1.0000,
+    tSA0 = 0.5000,  
+    tHA0 = 0.3300,  
+    tSA1 = 0.5000,  
+    tHA1 = 0.3300,  
+    tSA2 = 0.5000,  
+    tHA2 = 0.3300,  
+    tSA3 = 0.5000,  
+    tHA3 = 0.3300,  
+    tSA4 = 0.5000,  
+    tHA4 = 0.3300,  
+    tSA5 = 0.5000,  
+    tHA5 = 0.3300,  
+    tSA6 = 0.5000,  
+    tHA6 = 0.3300,  
+    tSA7 = 0.5000,  
+    tHA7 = 0.3300,  
+    tSA8 = 0.5000,  
+    tHA8 = 0.3300,  
+    tSA9 = 0.5000,  
+    tHA9 = 0.3300,  
+    tSDI0 = 0.7000,  
+    tHDI0 = 0.5400, 
+    tSDI1 = 0.7000,  
+    tHDI1 = 0.5400, 
+    tSDI2 = 0.7000,  
+    tHDI2 = 0.5400, 
+    tSDI3 = 0.7000,  
+    tHDI3 = 0.5400, 
+    tSDI4 = 0.7000,  
+    tHDI4 = 0.5400, 
+    tSDI5 = 0.7000,  
+    tHDI5 = 0.5400, 
+    tSDI6 = 0.7000,  
+    tHDI6 = 0.5400, 
+    tSDI7 = 0.7000,  
+    tHDI7 = 0.5400, 
+    tSDI8 = 0.7000,  
+    tHDI8 = 0.5400, 
+    tSDI9 = 0.7000,  
+    tHDI9 = 0.5400, 
+    tSDI10 = 0.7000,  
+    tHDI10 = 0.5400, 
+    tSDI11 = 0.7000,  
+    tHDI11 = 0.5400, 
+    tSDI12 = 0.7000,  
+    tHDI12 = 0.5400, 
+    tSDI13 = 0.7000,  
+    tHDI13 = 0.5400, 
+    tSDI14 = 0.7000,  
+    tHDI14 = 0.5400, 
+    tSDI15 = 0.7000,  
+    tHDI15 = 0.5400, 
+    tSDI16 = 0.7000,  
+    tHDI16 = 0.5400, 
+    tSDI17 = 0.7000,  
+    tHDI17 = 0.5400, 
+    tSDI18 = 0.7000,  
+    tHDI18 = 0.5400, 
+    tSDI19 = 0.7000,  
+    tHDI19 = 0.5400, 
+    tSDI20 = 0.7000,  
+    tHDI20 = 0.5400, 
+    tSDI21 = 0.7000,  
+    tHDI21 = 0.5400, 
+    tSDI22 = 0.7000,  
+    tHDI22 = 0.5400, 
+    tSDI23 = 0.7000,  
+    tHDI23 = 0.5400, 
+    tSDI24 = 0.7000,  
+    tHDI24 = 0.5400, 
+    tSDI25 = 0.7000,  
+    tHDI25 = 0.5400, 
+    tSDI26 = 0.7000,  
+    tHDI26 = 0.5400, 
+    tSDI27 = 0.7000,  
+    tHDI27 = 0.5400, 
+    tSDI28 = 0.7000,  
+    tHDI28 = 0.5400, 
+    tSDI29 = 0.7000,  
+    tHDI29 = 0.5400, 
+    tSDI30 = 0.7000,  
+    tHDI30 = 0.5400, 
+    tSDI31 = 0.7000,  
+    tHDI31 = 0.5400, 
+    tSBEN = 0.7000,  
+    tHBEN = 0.5400,  
+    tSEN = 1.3000,  
+    tHEN = 0.4300,  
+    tSRWB = 0.5000,  
+    tHRWB = 0.3300; 
+
+
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[0]:DI[0])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[1]:DI[1])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[2]:DI[2])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[3]:DI[3])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[4]:DI[4])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[5]:DI[5])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[6]:DI[6])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[7]:DI[7])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[8]:DI[8])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[9]:DI[9])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[10]:DI[10])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[11]:DI[11])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[12]:DI[12])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[13]:DI[13])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[14]:DI[14])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[15]:DI[15])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[16]:DI[16])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[17]:DI[17])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[18]:DI[18])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[19]:DI[19])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[20]:DI[20])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[21]:DI[21])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[22]:DI[22])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[23]:DI[23])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[24]:DI[24])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[25]:DI[25])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[26]:DI[26])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[27]:DI[27])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[28]:DI[28])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[29]:DI[29])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[30]:DI[30])) = (tWR,0); 
+    if(((EN & (!R_WB)) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[31]:DI[31])) = (tWR,0); 
+
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[0]:DI[0])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[1]:DI[1])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[2]:DI[2])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[3]:DI[3])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[4]:DI[4])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[5]:DI[5])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[6]:DI[6])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[7]:DI[7])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[8]:DI[8])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[9]:DI[9])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[10]:DI[10])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[11]:DI[11])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[12]:DI[12])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[13]:DI[13])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[14]:DI[14])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[15]:DI[15])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[16]:DI[16])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[17]:DI[17])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[18]:DI[18])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[19]:DI[19])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[20]:DI[20])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[21]:DI[21])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[22]:DI[22])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[23]:DI[23])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[24]:DI[24])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[25]:DI[25])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[26]:DI[26])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[27]:DI[27])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[28]:DI[28])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[29]:DI[29])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[30]:DI[30])) = (tRD,0); 
+    if(((EN & R_WB) & (!WLOFF)) & (!TM)) (posedge CLKin *> (DO[31]:DI[31])) = (tRD,0); 
+
+    if(TM)
+       (posedge CLKin => (ScanOutCC:ScanInCC)) = (tTM,0); 
+
+
+    if (TM) (posedge CLKin *> (DO[0]:DI[0])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[1]:DI[1])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[2]:DI[2])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[3]:DI[3])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[4]:DI[4])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[5]:DI[5])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[6]:DI[6])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[7]:DI[7])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[8]:DI[8])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[9]:DI[9])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[10]:DI[10])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[11]:DI[11])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[12]:DI[12])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[13]:DI[13])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[14]:DI[14])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[15]:DI[15])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[16]:DI[16])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[17]:DI[17])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[18]:DI[18])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[19]:DI[19])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[20]:DI[20])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[21]:DI[21])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[22]:DI[22])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[23]:DI[23])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[24]:DI[24])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[25]:DI[25])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[26]:DI[26])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[27]:DI[27])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[28]:DI[28])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[29]:DI[29])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[30]:DI[30])) = (tTD,0); 
+    if (TM) (posedge CLKin *> (DO[31]:DI[31])) = (tTD,0); 
+
+    $width( posedge CLKin, tCHI, 0, notify_tCHI);
+    $width( negedge CLKin, tCLO, 0, notify_tCLO);
+    $period( posedge CLKin, tCYC, notify_tCYC);
+
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[0], tSA0, tHA0, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[0], tSA0, tHA0, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[0],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[0],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[1], tSA1, tHA1, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[1], tSA1, tHA1, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[1],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[1],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[2], tSA2, tHA2, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[2], tSA2, tHA2, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[2],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[2],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[3], tSA3, tHA3, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[3], tSA3, tHA3, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[3],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[3],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[4], tSA4, tHA4, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[4], tSA4, tHA4, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[4],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[4],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[5], tSA5, tHA5, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[5], tSA5, tHA5, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[5],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[5],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[6], tSA6, tHA6, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[6], tSA6, tHA6, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[6],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[6],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[7], tSA7, tHA7, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[7], tSA7, tHA7, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[7],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[7],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[8], tSA8, tHA8, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[8], tSA8, tHA8, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[8],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[8],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge AD[9], tSA9, tHA9, notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge AD[9], tSA9, tHA9, notify_tSA,,,,); 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge AD[9],tSADCTL,tHADCTL,notify_tSA,,,,); 
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge AD[9],tSADCTL,tHADCTL,notify_tSA,,,,); 
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[0], tSDI0, tHDI0, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[0], tSDI0, tHDI0, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[1], tSDI1, tHDI1, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[1], tSDI1, tHDI1, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[2], tSDI2, tHDI2, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[2], tSDI2, tHDI2, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[3], tSDI3, tHDI3, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[3], tSDI3, tHDI3, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[4], tSDI4, tHDI4, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[4], tSDI4, tHDI4, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[5], tSDI5, tHDI5, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[5], tSDI5, tHDI5, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[6], tSDI6, tHDI6, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[6], tSDI6, tHDI6, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[7], tSDI7, tHDI7, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[7], tSDI7, tHDI7, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[8], tSDI8, tHDI8, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[8], tSDI8, tHDI8, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[9], tSDI9, tHDI9, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[9], tSDI9, tHDI9, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[10], tSDI10, tHDI10, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[10], tSDI10, tHDI10, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[11], tSDI11, tHDI11, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[11], tSDI11, tHDI11, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[12], tSDI12, tHDI12, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[12], tSDI12, tHDI12, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[13], tSDI13, tHDI13, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[13], tSDI13, tHDI13, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[14], tSDI14, tHDI14, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[14], tSDI14, tHDI14, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[15], tSDI15, tHDI15, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[15], tSDI15, tHDI15, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[16], tSDI16, tHDI16, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[16], tSDI16, tHDI16, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[17], tSDI17, tHDI17, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[17], tSDI17, tHDI17, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[18], tSDI18, tHDI18, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[18], tSDI18, tHDI18, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[19], tSDI19, tHDI19, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[19], tSDI19, tHDI19, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[20], tSDI20, tHDI20, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[20], tSDI20, tHDI20, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[21], tSDI21, tHDI21, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[21], tSDI21, tHDI21, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[22], tSDI22, tHDI22, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[22], tSDI22, tHDI22, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[23], tSDI23, tHDI23, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[23], tSDI23, tHDI23, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[24], tSDI24, tHDI24, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[24], tSDI24, tHDI24, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[25], tSDI25, tHDI25, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[25], tSDI25, tHDI25, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[26], tSDI26, tHDI26, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[26], tSDI26, tHDI26, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[27], tSDI27, tHDI27, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[27], tSDI27, tHDI27, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[28], tSDI28, tHDI28, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[28], tSDI28, tHDI28, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[29], tSDI29, tHDI29, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[29], tSDI29, tHDI29, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[30], tSDI30, tHDI30, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[30], tSDI30, tHDI30, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, posedge DI[31], tSDI31, tHDI31, notify_tSDI,,,,); 
+$setuphold(posedge CLKin &&& not_sm_and_notifier_en, negedge DI[31], tSDI31, tHDI31, notify_tSDI,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[0], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[0], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[0],tSDI0,tHDI0,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[0],tSDI0,tHDI0,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[1], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[1], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[1],tSDI1,tHDI1,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[1],tSDI1,tHDI1,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[2], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[2], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[2],tSDI2,tHDI2,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[2],tSDI2,tHDI2,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[3], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[3], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[3],tSDI3,tHDI3,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[3],tSDI3,tHDI3,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[4], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[4], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[4],tSDI4,tHDI4,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[4],tSDI4,tHDI4,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[5], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[5], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[5],tSDI5,tHDI5,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[5],tSDI5,tHDI5,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[6], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[6], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[6],tSDI6,tHDI6,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[6],tSDI6,tHDI6,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[7], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[7], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[7],tSDI7,tHDI7,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[7],tSDI7,tHDI7,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[8], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[8], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[8],tSDI8,tHDI8,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[8],tSDI8,tHDI8,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[9], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[9], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[9],tSDI9,tHDI9,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[9],tSDI9,tHDI9,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[10], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[10], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[10],tSDI10,tHDI10,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[10],tSDI10,tHDI10,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[11], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[11], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[11],tSDI11,tHDI11,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[11],tSDI11,tHDI11,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[12], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[12], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[12],tSDI12,tHDI12,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[12],tSDI12,tHDI12,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[13], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[13], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[13],tSDI13,tHDI13,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[13],tSDI13,tHDI13,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[14], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[14], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[14],tSDI14,tHDI14,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[14],tSDI14,tHDI14,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[15], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[15], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[15],tSDI15,tHDI15,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[15],tSDI15,tHDI15,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[16], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[16], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[16],tSDI16,tHDI16,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[16],tSDI16,tHDI16,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[17], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[17], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[17],tSDI17,tHDI17,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[17],tSDI17,tHDI17,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[18], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[18], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[18],tSDI18,tHDI18,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[18],tSDI18,tHDI18,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[19], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[19], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[19],tSDI19,tHDI19,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[19],tSDI19,tHDI19,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[20], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[20], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[20],tSDI20,tHDI20,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[20],tSDI20,tHDI20,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[21], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[21], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[21],tSDI21,tHDI21,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[21],tSDI21,tHDI21,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[22], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[22], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[22],tSDI22,tHDI22,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[22],tSDI22,tHDI22,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[23], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[23], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[23],tSDI23,tHDI23,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[23],tSDI23,tHDI23,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[24], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[24], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[24],tSDI24,tHDI24,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[24],tSDI24,tHDI24,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[25], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[25], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[25],tSDI25,tHDI25,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[25],tSDI25,tHDI25,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[26], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[26], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[26],tSDI26,tHDI26,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[26],tSDI26,tHDI26,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[27], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[27], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[27],tSDI27,tHDI27,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[27],tSDI27,tHDI27,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[28], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[28], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[28],tSDI28,tHDI28,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[28],tSDI28,tHDI28,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[29], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[29], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[29],tSDI29,tHDI29,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[29],tSDI29,tHDI29,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[30], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[30], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[30],tSDI30,tHDI30,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[30],tSDI30,tHDI30,notify_tSBEN,,,,);
+
+
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge BEN[31], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+$setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge BEN[31], tSBEN, tHBEN, notify_tSBEN,,,,) ; 
+
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge BEN[31],tSDI31,tHDI31,notify_tSBEN,,,,);
+$setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge BEN[31],tSDI31,tHDI31,notify_tSBEN,,,,);
+
+
+    $setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge EN, tSEN, tHEN, notify_tSEN,,,,) ; 
+    $setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge EN, tSEN, tHEN, notify_tSEN,,,,) ; 
+
+    $setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge EN, tSADCTL, tHADCTL, notify_tSEN,,,,) ;
+    $setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge EN, tSADCTL, tHADCTL, notify_tSEN,,,,) ;
+
+    $setuphold(posedge CLKin &&& notifier_en_a, posedge SM, tSSM, tHSM, notify_tSSM,,,,) ; 
+    $setuphold(posedge CLKin &&& notifier_en_a, negedge SM, tSSM, tHSM, notify_tSSM,,,,) ;
+
+    $setuphold(posedge CLKin &&& notifier_en_a, posedge TM, tSTM, tHTM, notify_tSTM,,,,) ; 
+    $setuphold(posedge CLKin &&& notifier_en_a, negedge TM, tSTM, tHTM, notify_tSTM,,,,) ;
+
+    $setuphold(posedge CLKin &&& not_tm_and_notifier_en, posedge R_WB, tSRWB, tHRWB, notify_tSRWB,,,,) ; 
+    $setuphold(posedge CLKin &&& not_tm_and_notifier_en, negedge R_WB, tSRWB, tHRWB, notify_tSRWB,,,,) ; 
+
+    $setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, posedge R_WB, tSADCTL, tHADCTL, notify_tSRWB,,,,) ;
+    $setuphold(posedge CLKin &&& tm_and_not_sm_and_notifier_en, negedge R_WB, tSADCTL, tHADCTL, notify_tSRWB,,,,) ;
+
+    $setuphold(posedge CLKin &&& sm_and_notifier_en, posedge ScanInCC, tSADCTL, tHADCTL, notify_tSScanInCC,,,,) ; 
+    $setuphold(posedge CLKin &&& sm_and_notifier_en, negedge ScanInCC, tSADCTL, tHADCTL, notify_tSScanInCC,,,,) ;
+
+    $setuphold(posedge CLKin &&& sm_and_notifier_en, posedge ScanInDL, tSASSC, tDASSC, notify_tSScanInDL,,,,) ; 
+    $setuphold(posedge CLKin &&& sm_and_notifier_en, negedge ScanInDL, tSASSC, tDASSC, notify_tSScanInDL,,,,) ;
+
+    $setuphold(posedge CLKin &&& sm_and_notifier_en, posedge ScanInDR, tSASSC, tDASSC, notify_tSScanInDR,,,,) ; 
+    $setuphold(posedge CLKin &&& sm_and_notifier_en, negedge ScanInDR, tSASSC, tDASSC, notify_tSScanInDR,,,,) ;
+
+
+endspecify
+
+`endif
+
+
+    // Property of Control signals: vpwrac, vpwrpc
+    bufif0 (vpwra, vpwrm, vpwrac) ; // if vpwrac is low, signal vpwra is connected to vpwrm 
+    bufif0 (vpwrp, vpwrm, vpwrpc) ; // if vpwrpc is low, signal vpwrp is connected to vpwrm
+
+
+CF_SRAM_1024x32_memory_mode memory_mode_inst(DO_temp, ScanOutCC_temp, normal_mode, test_mode, periphery_x_mode, clki, clki_tm,
+AD, BEN, DI, EN, EN_m, R_WB, SM, ScanInCC, ScanInDL, ScanInDR, WLOFF, vgnd, dis_err_msgs, inputs_x_reg);
+
+task write_x_in_whole_memory;
+integer k;
+begin
+    for (k = 0; k < NW; k = k + 1)
+        memory_mode_inst.memory[k] = 32'bx;
+end
+endtask
+
+task rand_init_whole_memory;
+integer l ;
+begin
+    l = SEED ;
+    if (l > 0) begin 
+        for (i = 0; i < NB; i = i + 1) 
+            data_range[i] = 1'b0;
+        data_range[NB] = 1'b1;
+        for( i = 0 ; i < NW ; i = i + 1) begin
+            adr = {i} % NW;
+            din = ($random(l)+1) % data_range ;
+            memory_mode_inst.memory[adr] = din ;
+        end
+    end 
+end
+endtask
+
+
+endmodule
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// This module is for normal memory mode operations Read/Write
+// A 2D memory array 'memory' is defined in this module.
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+module CF_SRAM_1024x32_memory_mode (DO, ScanOutCC, normal_mode, test_mode, periphery_x_mode, clki, clki_tm,
+                                   AD, BEN, DI, EN, EN_m, R_WB, SM, ScanInCC, ScanInDL, ScanInDR, WLOFF, vgnd, dis_err_msgs, inputs_x_reg); // dlz added dis_err_msgs BMRB request
+    parameter NB = 32;         // Number of Data Bits
+    parameter NA = 10;         // Number of Address Bits
+    parameter NW = 1024;         // Number of WORDS
+
+    parameter tRD = 2.4412;  // Read access time for the memory (i.e. delay for DI to DO change in Read)
+    parameter tWR = 2.0412;  //Write access time for the memory (i.e. delay for DI to DO change in Write)
+
+    parameter tWRDL = 0.1 ;
+    // delay the Write to avoid simulataneous switching of R_WBreg from Write to Read opeartion
+    parameter BEHAV_DELAY = 0.1;
+
+    output [(NB - 1) : 0] DO;
+    output ScanOutCC ;
+    input normal_mode ;
+    input test_mode ;
+    input periphery_x_mode ;
+    input dis_err_msgs;
+    input clki;             // Gated Clock
+    input clki_tm;          // Gated Clock for test mode
+                                    
+    input [(NA - 1) : 0] AD;
+    input [(NB - 1) : 0] BEN;
+    input [(NB - 1) : 0] DI;
+    input EN;
+    input EN_m;
+    input R_WB;
+    input SM ; 
+    input ScanInCC;
+    input ScanInDL;
+    input ScanInDR;
+    input WLOFF ;
+    input vgnd;
+    input inputs_x_reg;
+
+    reg [12 - 1: 0] ADreg;          // ADreg bits holds AD bits in synchronously
+    reg [12 - 1: 0] ADreg_scan;     // ADreg_scan bits holds AD bits in scan mode
+    reg [12 - 1: 0] ADreg_scan_1;   // ADreg_scan bits holds AD bits in scan mode // dlz 09/09/2011
+    reg [NB - 1: 0] DIreg;          // DIreg bits holds DI bits in synchronously
+    reg [NB - 1: 0] DOreg;          // Sense Amplifier output
+    reg [NB - 1: 0] DI_BENreg ;     // This register contains DI data after masking by BEN bits
+    reg [NB - 1: 0] BENreg;         // BENreg holds BEN data synchronously
+    
+    reg  [(NB - 1) : 0] memory [0: (NW - 1)];
+
+    reg WL_Enable;                  // reg for Word Line enable signal. 
+    reg ENreg;                      // reg for Chip Enable 
+    reg R_WBreg ;                   // reg for Read/Write Enable signal
+    reg WLOFFreg ;                  // reg to hold value of WLOFF in Scan chain
+
+    reg ENreg_scan ;                // reg for Chip Enable 
+    reg R_WBreg_scan ;              // reg for Read/Write Enable signal
+    reg WLOFFreg_scan ;             // reg to hold value of WLOFF in Scan chain
+
+                                    // Functional Mode: 
+                                    //    DO is DOreg when R_WBreg is Read state and persists
+                                    //    DO is DIreg when R_WBreg is Write state and persists  
+    reg [NB - 1: 0] DO_delay ;
+
+// Scan mode/Test mode related registers
+    wire ScanOutA ;
+    wire [NB - 1:0] DImux1 ; 
+    wire [12 - 1:0] ADmux ;  
+    wire [NB - 1:0] DImux2 ; 
+    wire R_WBmux ;  
+    wire WLOFFmux ;  
+    wire ENmux ; 
+
+    assign DO = normal_mode ? DO_delay : (test_mode? DIreg : 32'bx) ;
+
+    assign ScanOutCC = normal_mode ? 1'b1 : (test_mode? !(ENreg_scan): 1'bx) ;
+
+    integer k, flag ;
+
+//-----------------------------------------------------------------------------------
+// The following block implements the DFT - scan chain for SRAM memory
+// The Address scan chain is of length 15.
+// Address scan chain is given below:
+//  ScanInCC-->ADmux[11]-->ADreg_scan[11]-->ADmux[10]-->ADreg_scan[10]-->ADmux[9]-->ADreg_scan[9] 
+//          -->ADmux[8]-->ADreg_scan[8] ...... -->ADmux[0]-->ADreg_scan[0]-->R_WBmux-->R_WBreg
+//          -->WLOFFmux-->WLOFFreg-->ENmux-->ENreg-->ScanOutCC
+//-----------------------------------------------------------------------------------
+
+    assign #(BEHAV_DELAY) ADmux[0] = (SM) ? ADreg_scan[1] : AD[0] ;
+    assign #(BEHAV_DELAY) ADmux[1] = (SM) ? ADreg_scan[2] : AD[1] ;
+    assign #(BEHAV_DELAY) ADmux[2] = (SM) ? ADreg_scan[3] : AD[2] ;
+    assign #(BEHAV_DELAY) ADmux[3] = (SM) ? ADreg_scan[4] : vgnd ;
+    assign #(BEHAV_DELAY) ADmux[4] = (SM) ? ADreg_scan[5] : vgnd ;
+    assign #(BEHAV_DELAY) ADmux[5] = (SM) ? ADreg_scan[6] : AD[4] ;
+    assign #(BEHAV_DELAY) ADmux[6] = (SM) ? ADreg_scan[7] : AD[5] ;
+    assign #(BEHAV_DELAY) ADmux[7] = (SM) ? ADreg_scan[8] : AD[6] ;
+    assign #(BEHAV_DELAY) ADmux[8] = (SM) ? ADreg_scan[9] : AD[7] ;
+    assign #(BEHAV_DELAY) ADmux[9] = (SM) ? ADreg_scan[10] : AD[8] ;
+    assign #(BEHAV_DELAY) ADmux[10] = (SM) ? ADreg_scan[11] : AD[9] ;
+
+
+assign #(BEHAV_DELAY) ADmux[11] = (SM) ? ((ScanInCC===1'bz)?1'bx:ScanInCC) : AD[3];
+
+    assign #(BEHAV_DELAY) R_WBmux = (SM) ? ADreg_scan[0] : R_WB ;
+    assign #(BEHAV_DELAY) WLOFFmux = (SM) ? R_WBreg_scan : WLOFF ; 
+    assign #(BEHAV_DELAY) ENmux = (SM) ? WLOFFreg_scan : EN ; 
+   
+    // Depending on ScanOutA DI or BEN is used in Data Scan chains
+    assign ScanOutA = test_mode ? !(ADreg_scan[0]) : 1'b1 ;
+
+    // This block defines the two Data scan chains:-
+    // Left Data Scan chain: entry is ScanInDL, size is 32/2  
+    // Right Data Scan chain: entry is ScanInDR, size is (NB - 32/2) 
+    assign #(BEHAV_DELAY) DImux1 = ScanOutA ? DI: BEN ;
+
+
+assign #(BEHAV_DELAY) DImux2[0] = (SM) ? ((ScanInDL===1'bz)?1'bx:ScanInDL) : DImux1[0] ;   
+
+    assign DImux2[1] = (SM) ? DIreg[0] : DImux1[1] ;
+    assign DImux2[2] = (SM) ? DIreg[1] : DImux1[2] ;
+    assign DImux2[3] = (SM) ? DIreg[2] : DImux1[3] ;
+    assign DImux2[4] = (SM) ? DIreg[3] : DImux1[4] ;
+    assign DImux2[5] = (SM) ? DIreg[4] : DImux1[5] ;
+    assign DImux2[6] = (SM) ? DIreg[5] : DImux1[6] ;
+    assign DImux2[7] = (SM) ? DIreg[6] : DImux1[7] ;
+    assign DImux2[8] = (SM) ? DIreg[7] : DImux1[8] ;
+    assign DImux2[9] = (SM) ? DIreg[8] : DImux1[9] ;
+    assign DImux2[10] = (SM) ? DIreg[9] : DImux1[10] ;
+    assign DImux2[11] = (SM) ? DIreg[10] : DImux1[11] ;
+    assign DImux2[12] = (SM) ? DIreg[11] : DImux1[12] ;
+    assign DImux2[13] = (SM) ? DIreg[12] : DImux1[13] ;
+    assign DImux2[14] = (SM) ? DIreg[13] : DImux1[14] ;
+    assign DImux2[15] = (SM) ? DIreg[14] : DImux1[15] ;
+
+
+assign #(BEHAV_DELAY) DImux2[16] = (SM) ? ((ScanInDR===1'bz)?1'bx:ScanInDR) : DImux1[16] ;  
+
+    assign DImux2[17] = (SM) ? DIreg[16] : DImux1[17] ;
+    assign DImux2[18] = (SM) ? DIreg[17] : DImux1[18] ;
+    assign DImux2[19] = (SM) ? DIreg[18] : DImux1[19] ;
+    assign DImux2[20] = (SM) ? DIreg[19] : DImux1[20] ;
+    assign DImux2[21] = (SM) ? DIreg[20] : DImux1[21] ;
+    assign DImux2[22] = (SM) ? DIreg[21] : DImux1[22] ;
+    assign DImux2[23] = (SM) ? DIreg[22] : DImux1[23] ;
+    assign DImux2[24] = (SM) ? DIreg[23] : DImux1[24] ;
+    assign DImux2[25] = (SM) ? DIreg[24] : DImux1[25] ;
+    assign DImux2[26] = (SM) ? DIreg[25] : DImux1[26] ;
+    assign DImux2[27] = (SM) ? DIreg[26] : DImux1[27] ;
+    assign DImux2[28] = (SM) ? DIreg[27] : DImux1[28] ;
+    assign DImux2[29] = (SM) ? DIreg[28] : DImux1[29] ;
+    assign DImux2[30] = (SM) ? DIreg[29] : DImux1[30] ;
+    assign DImux2[31] = (SM) ? DIreg[30] : DImux1[31] ;
+
+   // In behavioral mode output DO signal to be delayed 
+   // by (tRD/tWR) when in Read/Write mode
+   // DO_delay is the delayed output to be set to DO.
+    always @(normal_mode or DOreg or R_WBreg or WL_Enable) begin
+        if (normal_mode && WL_Enable) begin 
+`ifdef functional
+            DO_delay <= DOreg;
+`else
+            DO_delay <= #((R_WBreg == 1) ? tRD: tWR) DOreg; 
+            // Signal delayed for behavioral mode
+`endif
+        end
+    end
+ // At every positive edge of the clock the Synchronous input 
+ // signals are saved into the corresponding register variable
+ // All ADreg is of range [12 : 0], all ADreg signal is not 
+ // assigned by AD. Depending upon memory configuration some
+ // ADreg bit will be grounded. The index for grounded ADreg
+ // bits are obtained following a scheme (memo PAI-046) 
+
+    always @ (posedge clki) begin
+        if (!periphery_x_mode && !test_mode) begin 
+            DIreg <= DImux2 ;
+            ADreg <= ADmux ;
+
+            ADreg_scan_1 <= ADmux ;
+            ADreg_scan <= ADreg_scan_1;
+
+            ENreg <= ENmux ;
+            WL_Enable <= EN_m ;
+            R_WBreg <= R_WBmux ;
+            WLOFFreg <= WLOFFmux;
+            BENreg <= BEN ; 
+            is_Floating_Signal(ENreg, DIreg, BENreg, ADreg) ;
+        end
+   end
+
+   // During periphery_x_mode:  clki is gated
+   always @ (periphery_x_mode) begin
+        #0.1;
+        if (periphery_x_mode == 1) begin 
+            DIreg <= 32'bx ;
+            ADreg <= 12'bx ;
+            ADreg_scan <= 12'bx ;
+            ENreg <= 1'bx ;
+            R_WBreg <= 1'bx ;
+            WLOFFreg <= 1'bx;
+            ENreg_scan <= 1'bx ;
+            R_WBreg_scan <= 1'bx ;
+            WLOFFreg_scan <= 1'bx;
+            BENreg <= 32'bx ; 
+            DOreg  <= 32'bx ;
+            WL_Enable <= 1'bx ;
+        end
+    end
+
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Test mode clocking is different than normal mode
+//
+    always @ (posedge clki_tm) begin
+        if (test_mode) begin 
+            DIreg <= DImux2 ;
+            ADreg_scan <= ADmux ;   
+            ENreg_scan <= ENmux ;
+            R_WBreg_scan <= R_WBmux ;
+            WLOFFreg_scan <= WLOFFmux;
+            BENreg <= BEN ; 
+            is_Floating_Signal(ENreg_scan, DIreg, BENreg, ADreg_scan) ;
+        end
+    end
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// This block does the following in Write mode:
+//    (1) Write into memory array at Address ADreg
+//    (2) Updates DOreg with DIreg value (flow-through)
+//    (3) Check if the address AD is valid address
+// The Bit enable signals can be used to write into individual bit of a memory word. 
+// If not Bit enable signal is high, memory contents and DO doesn't change    
+/////////////////////////////////////////////////////////////////////////////////////////
+
+always @ (normal_mode or DIreg or R_WBreg or WL_Enable or ADreg or BENreg or WLOFFreg or dis_err_msgs or inputs_x_reg)
+ begin: write_data_block
+  if(normal_mode && WL_Enable && (!R_WBreg) && (!WLOFFreg)) begin
+    #(tWRDL) ; 
+         if (is_AD_x(getAD(ADreg)) == 1) begin
+
+      write_x_in_whole_memory;
+    end 
+    else if (is_AD_within_range(getAD(ADreg)) == 0) begin
+      if (!dis_err_msgs) begin
+                   $display("===ERROR=== (cftssc) : Write AD=%h OutOfRange in memory S8TSSC_01024x032_008_18 in instance %m at time=%t\n", ADreg, $time);
+      end
+    end
+    else if (inputs_x_reg === 1'b1) begin
+      DOreg = {NB{1'bx}};
+    end
+    else begin
+      flag = 0 ;
+      DI_BENreg = memory[getAD(ADreg)];
+      for (k = 0 ; k < NB ; k = k + 1) begin
+        if(BENreg[k] == 1) begin 
+          if (DIreg[k] === 1'bz) begin  
+            DI_BENreg[k] = 1'bx ;
+            DOreg[k] = 1'bx ; 
+          end                           
+          else begin
+            DI_BENreg[k] = DIreg[k] ;
+            DOreg[k] = DIreg[k] ; 
+            flag = 1 ;
+          end
+        end
+        else if (BENreg[k] === 1'bx) begin 
+          DI_BENreg[k] = 1'bx;
+          DOreg[k] = 1'bx;
+          flag = 1 ;  
+        end
+      end
+      if (flag == 1) begin
+        memory[getAD(ADreg)] = DI_BENreg ;
+      end
+    end
+  end
+end
+
+ // This block does the following in Read mode:
+ //    (1) Read memory array at Address ADreg
+ //    (2) Updates DOreg with output from memory array
+ //    (3) Check if the address AD is valid address
+
+always @ (normal_mode or R_WBreg or WL_Enable or ADreg or dis_err_msgs or inputs_x_reg)
+begin: read_data_block
+  if(normal_mode && WL_Enable && R_WBreg == 1) begin
+    if (is_AD_x(getAD(ADreg)) == 1) begin
+    DOreg  <= {NB{1'bx}} ;
+    end 
+    else if (is_AD_within_range(getAD(ADreg)) == 0) begin
+      if (!dis_err_msgs) begin
+        $display("===ERROR=== (cftssc) : Read AD=%h Out Of Range in memory S8TSSC_01024x032_008_18 in instance %m at time=%t\n", ADreg, $time);
+      end  
+    end
+    else if (inputs_x_reg === 1'b1) begin
+      DOreg <= {NB{1'bx}} ;
+    end 
+    else begin
+      DOreg <= memory[getAD(ADreg)];
+         end
+  end
+  else ;
+end
+
+task is_Floating_Signal;
+input ENreg ;
+input [(NB - 1) : 0] DIreg;
+input [(NB - 1) : 0] BENreg;
+input [(NA - 1) : 0] ADreg;
+integer k;
+integer flag;
+begin
+    flag = 0 ;
+    if (ENreg === 1'bz || R_WBreg === 1'bz || vgnd === 1'bz) 
+        flag = 1 ;  
+    for (k = 0 ; k < NA ; k = k + 1) begin
+        if (ADreg[k] === 1'bz) begin
+            flag = 1 ;
+            k = NA ;
+        end
+    end
+    for (k = 0 ; k < NB ; k = k + 1) begin
+        if (DIreg[k] === 1'bz || BENreg[k] === 1'bz) begin
+            flag = 1 ;
+            k = NB ;
+        end
+    end
+
+  if (flag == 1)
+    if (!dis_err_msgs) begin
+      $display("===ERROR=== (cftssc) : Floating signal found in test mode: EN= %b R_WB=%b vgnd= %b AD= %b DI= %b BEN= %b in instance %m at time=%d", ENreg, R_WBreg, vgnd, ADreg, DIreg, BENreg, $time) ;
+    end
+    else begin
+    end
+    else begin
+    end
+  end
+endtask
+
+function is_AD_x;
+  input [(NA - 1) : 0] ADreg;
+  integer k;
+  begin
+    is_AD_x = 0;
+    for (k = 0; k < NA; k = k + 1)
+      if (ADreg[k] === 1'bx) begin
+        is_AD_x = 1;
+        k = NA ; 
+      end
+    end
+endfunction
+
+function is_AD_within_range;
+  input [(NA - 1) : 0] ADreg;
+  begin
+    is_AD_within_range = ((ADreg >= 0) && (ADreg < NW)) ? 1 : 0 ;
+  end
+endfunction 
+
+//========================================================================
+// Following function gets the address bits from ADreg array.
+// The mapping getAD <-- ADreg ommits the grounded bits.
+//
+function [(NA - 1) : 0] getAD;
+  input [(12 - 1) : 0] ADreg;
+  begin
+                                            getAD[0] = ADreg[0] ;
+                                                getAD[1] = ADreg[1] ;
+                                                getAD[2] = ADreg[2] ;
+                                                              getAD[3] = ADreg[11] ;
+                                                  getAD[4] = ADreg[5] ;
+                                                  getAD[5] = ADreg[6] ;
+                                                  getAD[6] = ADreg[7] ;
+                                                  getAD[7] = ADreg[8] ;
+                                                  getAD[8] = ADreg[9] ;
+                                                  getAD[9] = ADreg[10] ;
+                                              end
+endfunction
+
+task write_x_in_whole_memory;
+  integer k;
+  begin
+    for (k = 0; k < NW; k = k + 1)
+      memory_mode_inst.memory[k] = 32'bx;
+    end
+endtask
+
+endmodule
+
+`endcelldefine
diff --git a/src/verilog/adder32.sv b/src/verilog/adder32.sv
new file mode 100644 (file)
index 0000000..a521c45
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+* Module describing a 32-bit ripple carry adder, with no carry output or input.
+*
+* You can and should modify this file but do NOT change the interface.
+*/
+module adder32 import calculator_pkg::*; (
+    // DO NOT MODIFY THE PORTs
+    input logic [DATA_W - 1 : 0]    a_i, // First operand
+    input logic [DATA_W - 1 : 0]    b_i, // Second operand
+    input logic                     c_i, // Carry input
+    output logic                    c_o, // Carry output
+    output logic [DATA_W - 1 : 0]   sum_o // Sum output
+);
+    // You can modify anything below this line. You are required to use
+    // full_adder.sv to build this module.
+    
+    //TODO: Declare any internal signals you need here.
+    // Hint: You need an intermediary signal to handle the carry bits between adders.
+
+    logic [DATA_W : 0] carry_s; //s = signal
+
+    always_comb begin
+        carry_s[0] = c_i;
+        c_o = carry_s[DATA_W];
+    end
+
+    // TODO: use a generate block to chain together 32 full adders. 
+    // generate block for building the large adder out of smaller, full adders
+    generate
+        genvar i_gv;
+        // Hint: Think about looping w/ a module declaration
+    for (i_gv = 0; i_gv < DATA_W; i_gv = i_gv + 1) begin
+        full_adder u_inst (
+            .a(a_i[i_gv]),
+            .b(b_i[i_gv]),
+            .cin(carry_s[i_gv]),
+            .s(sum_o[i_gv]),
+            .cout(carry_s[i_gv + 1]));
+    end
+    endgenerate
+endmodule
diff --git a/src/verilog/calculator_pkg.sv b/src/verilog/calculator_pkg.sv
new file mode 100644 (file)
index 0000000..1abd131
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * This package defines common parameters used across various modules in the design to ensure consistency and ease of maintenance. 
+ * It includes parameters for data width, memory word size, and address width (defined by size of SRAM).
+ *
+ * You can and should modify this file to add additional states as needed.
+ */
+`define functional
+package calculator_pkg;
+    //parameter for size of data (adder size)
+    parameter DATA_W = 32;
+
+    //parameter for size of memory word
+    parameter MEM_WORD_SIZE = 64;
+
+    parameter ADDR_W = 10   ;
+
+    // TODO: Declare additional state(s) as needed
+    // DO NOT REMOVE S_IDLE AND S_END STATES
+    typedef enum logic [2:0] {S_IDLE,S_READ,S_RD2,S_ADD,S_WRITE,S_WT2,S_END} state_t;
+    typedef enum logic {LOWER, UPPER} buffer_loc_t;
+
+endpackage
diff --git a/src/verilog/controller.sv b/src/verilog/controller.sv
new file mode 100644 (file)
index 0000000..50da3a2
--- /dev/null
@@ -0,0 +1,185 @@
+/* \r
+ *     Controller module for DD onboarding.\r
+ *     Manages reading from memory, performing additions, and writing results back to memory.\r
+ *\r
+ *     This module can and should be modified but do not change the interface.\r
+*/\r
+module controller import calculator_pkg::*;(\r
+       // DO NOT MODIFY THESE PORTS\r
+       input  logic              clk_i,\r
+    input  logic              rst_i,\r
+  \r
+       // Memory Access\r
+    input  logic [ADDR_W-1:0] read_start_addr,\r
+    input  logic [ADDR_W-1:0] read_end_addr,\r
+    input  logic [ADDR_W-1:0] write_start_addr,\r
+    input  logic [ADDR_W-1:0] write_end_addr,\r
+  \r
+       // Memory Controls\r
+    output logic                                               write,\r
+       output logic                                            read,\r
+    output logic [ADDR_W-1:0]                  w_addr,\r
+    output logic [MEM_WORD_SIZE-1:0]   w_data,\r
+    output logic [ADDR_W-1:0]                  r_addr,\r
+    input  logic [MEM_WORD_SIZE-1:0]   r_data,\r
+\r
+       // Buffer Control (1 = upper, 0, = lower)\r
+    output logic buffer_control,\r
+  \r
+       // These go into adder\r
+       output logic [DATA_W-1:0] op_a,\r
+    output logic [DATA_W-1:0] op_b,\r
+\r
+       // Carry input for adder\r
+       output logic carry_in,  // Carry input to adder\r
+       input  logic carry_out, // Carry output from adder\r
+       \r
+       // What is being stored in the buffer\r
+    input  logic [MEM_WORD_SIZE-1:0] buff_result\r
+  \r
+); \r
+\r
+       // DO NOT MODIFY THIS BLOCK: Count how many cycles the controller has been active\r
+       logic [31:0] cycle_count;\r
+       always_ff @(posedge clk_i) begin\r
+               if (rst_i)\r
+                       cycle_count <= 32'd0;\r
+               else\r
+                       cycle_count <= cycle_count + 1'b1;\r
+       end\r
+       //=========================================================================\r
+       // You can change anything below this line. There is a skeleton but feel\r
+       // free to modify as much as you want.\r
+       //=========================================================================\r
+\r
+       // Declare state machine states\r
+    typedef enum logic [2:0] {S_IDLE,S_READ,S_RD2,S_ADD,S_WRITE,S_WT2,S_END} state_t;\r
+    typedef enum logic {LOWER, UPPER} buffer_loc_t;\r
+    state_t state, next;\r
+       // buffer_loc_t buffer_loc;\r
+\r
+    logic [ADDR_W-1:0] curr_addr_s;\r
+    logic [ADDR_W-1:0] curr_addr_ff;\r
+    logic [ADDR_W-1:0] curr_waddr_s;\r
+    logic [ADDR_W-1:0] curr_waddr_ff;\r
+    logic curr_half_s;\r
+    logic curr_half_ff;\r
+\r
+    logic addr_ci_s;\r
+    logic addr_ci_ff;\r
+    logic addr_co_s;\r
+    logic addr_co_ff;\r
+\r
+       // Registers to hold read data for current and next reads\r
+       // logic [ADDR_W-1:0] r_ptr, w_ptr;\r
+       \r
+\r
+       \r
+       \r
+    //State reg, other registers as needed\r
+    always_ff @(posedge clk_i) begin\r
+        if (rst_i) begin\r
+            state <= S_IDLE;\r
+            curr_addr_ff <= 8'h0;\r
+            curr_waddr_ff <= 8'h0;\r
+            curr_half_ff <= 1'b0;\r
+            addr_ci_ff <= 1'b0;\r
+        end else begin\r
+            state <= next;\r
+            curr_addr_ff <= curr_addr_s;\r
+            curr_waddr_ff <= curr_waddr_s;\r
+            curr_half_ff <= curr_half_s;\r
+            addr_ci_ff <= addr_ci_s;\r
+        end\r
+    end\r
+\r
+/* Next state logic, outputs */\r
+always_comb begin\r
+    buffer_control = curr_half_ff;\r
+    read = 1'b0;\r
+    write = 1'b0;\r
+    r_addr = curr_addr_ff;\r
+    w_addr = curr_waddr_ff;\r
+    w_data = 'b0;\r
+    carry_in = addr_ci_ff;\r
+\r
+    curr_addr_s = curr_addr_ff;\r
+    curr_waddr_s = curr_waddr_ff;\r
+    curr_half_s = curr_half_ff;\r
+    addr_ci_s = addr_ci_ff;\r
+\r
+    case (state)\r
+        S_IDLE: begin\r
+            /* set the current address to the lowest address */\r
+            curr_addr_s = read_start_addr;\r
+            curr_waddr_s = write_start_addr;\r
+            read = 1'b0;\r
+            write = 1'b0;\r
+            curr_half_s = 0;\r
+            /* set input carry to 0 */\r
+            addr_ci_s = 1'b0;\r
+            /* switch to read state */\r
+            next = S_READ;\r
+        end\r
+        S_READ: begin\r
+            /* read memory */\r
+            read = 1'b1;\r
+            write = 1'b0;\r
+            r_addr = curr_addr_ff;\r
+            /* move next */\r
+            //next = S_RD2; // timing\r
+            next = S_ADD;\r
+            curr_half_s = curr_half_ff;\r
+        end\r
+        S_RD2: begin //ign\r
+            next = S_ADD;\r
+        end\r
+        S_ADD: begin\r
+            /* a = our address from memory bank (64 bit word) */\r
+            op_a = r_data[MEM_WORD_SIZE-1:DATA_W]; /* high word */\r
+            op_b = r_data[DATA_W-1:0]; /* low word */\r
+            if (curr_half_ff) begin\r
+                next = S_WRITE;\r
+            end else begin\r
+                /* set carry in to carry out for the next state */\r
+                /* we have to add once more */\r
+                addr_ci_s = carry_out;\r
+                next = S_READ;\r
+            end\r
+            curr_addr_s = curr_addr_ff + 1;\r
+            curr_half_s = !curr_half_ff;\r
+        end\r
+        S_WRITE: begin\r
+            read = 1'b0;\r
+            write = 1'b1;\r
+            w_addr = curr_waddr_ff;\r
+            w_data = buff_result;\r
+            // next = S_WT2; // timing\r
+            if (curr_addr_ff < read_end_addr) begin\r
+                next = S_READ;\r
+                /* reset carry over */\r
+                addr_ci_s = 1'b0;\r
+                curr_waddr_s = curr_waddr_ff + 1;\r
+            end else begin\r
+                next = S_END;\r
+            end\r
+        end\r
+        S_WT2: begin // ign\r
+            if (curr_addr_ff < read_end_addr) begin\r
+                next = S_READ;\r
+                \r
+                curr_waddr_s = curr_waddr_ff + 1;\r
+            end else begin\r
+                next = S_END;\r
+            end\r
+        end\r
+        S_END: begin\r
+            read = 1'b0;\r
+            write = 1'b0;\r
+            next = S_END;\r
+        end\r
+    endcase\r
+end\r
+\r
+       \r
+  endmodule\r
diff --git a/src/verilog/full_adder.sv b/src/verilog/full_adder.sv
new file mode 100644 (file)
index 0000000..6080a01
--- /dev/null
@@ -0,0 +1,18 @@
+/*
+* Module describing a single-bit full adder. 
+* The full adder can be chained to create multi-bit adders. 
+*
+* This module can be modified but the interface must remain the same.
+*/
+module full_adder (
+    // DO NOT CHANGE THESE PORTS
+    input logic a,
+    input logic b,
+    input logic cin,
+    output logic s,
+    output logic cout
+);
+
+    assign {cout, s} = a + b + cin;
+    
+endmodule
\ No newline at end of file
diff --git a/src/verilog/result_buffer.sv b/src/verilog/result_buffer.sv
new file mode 100644 (file)
index 0000000..7bfa9b4
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+* Module describing a 64-bit result buffer and the mux for controlling where
+* in the buffer an adder's result is placed.
+* 
+* synchronous active high reset on posedge clk
+* This module can and should be modified but the interface should not be changed.
+*/
+module result_buffer import calculator_pkg::*; (
+    // DO NOT CHANGE ANY OF THESE PORTS
+    input logic     clk_i,                          //clock signal
+    input logic     rst_i,                          //reset signal
+    input logic     [DATA_W-1 : 0] result_i,        //result from ALU
+    input logic     loc_sel,                        //mux control signal
+    output logic    [MEM_WORD_SIZE-1 : 0] buffer_o //64-bit output of buffer
+);
+    //declare 64-bit buffer
+    logic [MEM_WORD_SIZE-1 : 0] internal_buffer;
+
+    //TODO: Write a sequential block to write the next values into the buffer.
+    always_ff @(posedge clk_i) begin
+        if (rst_i) begin
+            internal_buffer <= '0;
+        end else begin
+            //Place result_i into buffer based on loc_sel
+            if (loc_sel) begin
+                internal_buffer[MEM_WORD_SIZE-1:DATA_W] <= result_i;
+            end else begin
+                internal_buffer[DATA_W-1:0] <= result_i;
+            end
+        end
+    end
+
+    always_comb begin
+        buffer_o = internal_buffer;
+    end
+endmodule
diff --git a/src/verilog/tb_calculator.sv b/src/verilog/tb_calculator.sv
new file mode 100644 (file)
index 0000000..4dbdc55
--- /dev/null
@@ -0,0 +1,92 @@
+module tb_calculator import calculator_pkg::*; ();
+
+    //=============== Generate the clock =================
+    localparam CLK_PERIOD = 20; //Set clock period: 20 ns
+    localparam DUTY_CYCLE = 0.5;
+    //define clock
+    logic clk_tb;
+    
+    initial begin
+       forever //run the clock forever
+       begin           
+               #(CLK_PERIOD*DUTY_CYCLE) clk_tb = 1'b1; //wait duty cycle then set clock high
+               #(CLK_PERIOD*DUTY_CYCLE) clk_tb = 1'b0; //wait duty cycle then set clock low
+       end
+       end
+
+    //======== Define wires going into your module ========
+    logic             rst_tb;   // global
+    logic [ADDR_W-1:0] read_start_addr_tb, read_end_addr_tb;  //input read addresses
+    logic [ADDR_W-1:0] write_start_addr_tb, write_end_addr_tb;  //input write addresses
+
+    //======== Expected addition result signal ========
+    logic [31:0] expected_post_lower [0:1023];
+    logic [31:0] expected_post_upper [0:1023];
+    logic [63:0] expected_result;
+    logic [ADDR_W-1:0] current_write_addr;
+
+    // Track current write address from controller
+    assign current_write_addr = DUT.ctrl_w_addr_s;
+
+    // Get expected result from post-state files
+    assign expected_result = {expected_post_upper[current_write_addr], expected_post_lower[current_write_addr]};
+
+    //========= Instantiate a gcd module ==============
+    top_lvl DUT (
+        .clk                (clk_tb),
+        .rst                (rst_tb),
+        .read_start_addr    (read_start_addr_tb),
+        .read_end_addr      (read_end_addr_tb),
+        .write_start_addr   (write_start_addr_tb),
+        .write_end_addr     (write_end_addr_tb)
+    ) ;
+
+    initial begin
+        //These two lines just allow visibility of signals in the simulation
+        $shm_open("waves.shm");
+        $shm_probe("AC");
+        $display("\n--------------Beginning Simulation!--------------\n");
+        $display("Time: %t", $time);
+        @(posedge clk_tb);
+        initialize_signals();
+        fork begin
+            wait(DUT.u_ctrl.state == S_END);
+            #100;
+        end
+        begin
+            #100000;
+        end
+        join_any
+        $display("\n-------------Finished Simulation!----------------\n");
+        $display("Time: %t", $time);
+        $display("Cycle Count: %0d cycles (from S_IDLE to S_END)", DUT.u_ctrl.cycle_count);
+        $writememb("sim_memory_post_state_lower.txt", DUT.sram_A.memory_mode_inst.memory);
+        $writememb("sim_memory_post_state_upper.txt", DUT.sram_B.memory_mode_inst.memory);
+        $finish;
+    end
+
+    //Task to set the initial state of the signals. Task is called up above
+    task initialize_signals();
+    begin
+        $display("--------------Initializing Signals---------------\n");
+        $display("Time: %t", $time);
+        rst_tb              = 1'b1;
+        read_start_addr_tb  = '0;
+        read_end_addr_tb    = 9'b011111111;
+        write_start_addr_tb = 9'b110000000;
+        write_end_addr_tb   = 9'b111111111;
+
+        $readmemb("memory_pre_state_lower.txt", DUT.sram_A.memory_mode_inst.memory);
+        $readmemb("memory_pre_state_upper.txt", DUT.sram_B.memory_mode_inst.memory);
+        
+        // Load expected post-state files for comparison
+        $readmemb("memory_post_state_lower.txt", expected_post_lower);
+        $readmemb("memory_post_state_upper.txt", expected_post_upper);
+        
+        @(posedge clk_tb);
+        rst_tb              = 1'b0;
+    end
+    endtask
+
+       
+endmodule 
diff --git a/src/verilog/top_lvl.sv b/src/verilog/top_lvl.sv
new file mode 100644 (file)
index 0000000..e4f39f5
--- /dev/null
@@ -0,0 +1,176 @@
+/* 
+ * This top_level module integrates the controller, memory, adder, and result buffer to form a complete calculator system.
+ * It handles memory reads/writes, arithmetic operations, and result buffering.
+ */
+module top_lvl import calculator_pkg::*; (
+    input  logic                 clk,
+    input  logic                 rst,
+
+    // Memory Config
+    input  logic [ADDR_W-1:0]    read_start_addr,
+    input  logic [ADDR_W-1:0]    read_end_addr,
+    input  logic [ADDR_W-1:0]    write_start_addr,
+    input  logic [ADDR_W-1:0]    write_end_addr
+    
+);
+
+/*
+    // Controller wires
+    logic                       write, read;
+       logic [ADDR_W-1:0]          r_addr, w_addr;
+    logic [MEM_WORD_SIZE-1:0]   r_data;
+    logic [31:0]                op_a,   op_b;
+    logic                       carry_in, carry_out;
+    logic                       buffer_control;
+
+    // Result buffer wires
+    logic [MEM_WORD_SIZE-1:0]   buffer_word;   // 64-bit output of buffer
+
+    // Splitting up read and write data buses
+    logic [DATA_W-1:0]          w_data_lower, w_data_upper;
+    logic [DATA_W-1:0]          r_data_lower, r_data_upper;
+*/
+    // FIXME Advaith BEGIN
+    logic [DATA_W-1:0] addr_a_s;
+    logic [DATA_W-1:0] addr_b_s;
+    logic addr_ci_s;
+    logic addr_co_s;
+    logic [DATA_W-1:0] addr_sum_s;
+
+    logic [DATA_W-1:0] resbuf_result_s;
+    logic resbuf_loc_sel_s;
+    logic [MEM_WORD_SIZE-1:0] resbuf_buffer_s;
+
+    logic sram1_cs_s;
+    logic sram1_we_s; /* write enable */
+    logic [ADDR_W-1:0] sram1_addr_s;
+    logic [DATA_W-1:0] sram1_din_s;
+    logic [DATA_W-1:0] sram1_dout_s;
+
+    logic sram2_cs_s;
+    logic sram2_we_s; /* write enable */
+    logic [ADDR_W-1:0] sram2_addr_s;
+    logic [DATA_W-1:0] sram2_din_s;
+    logic [DATA_W-1:0] sram2_dout_s;
+
+    logic ctrl_write_s;
+    logic [ADDR_W-1:0] ctrl_w_addr_s;
+    logic [MEM_WORD_SIZE-1:0] ctrl_w_data_s;
+    logic ctrl_read_s;
+    logic [ADDR_W-1:0] ctrl_r_addr_s;
+    logic [MEM_WORD_SIZE-1:0] ctrl_r_data_s;
+    // FIXME Advaith end
+
+    // FIXME Advaith begin
+    always_comb begin
+        // connect the memory modules to controller
+        sram1_cs_s = !(ctrl_read_s || ctrl_write_s);
+        sram1_we_s = !ctrl_write_s;
+        sram1_din_s = ctrl_w_data_s[DATA_W-1:0];
+
+        sram2_cs_s = !(ctrl_read_s || ctrl_write_s);
+        sram2_we_s = !ctrl_write_s;
+        sram2_din_s = ctrl_w_data_s[MEM_WORD_SIZE-1:DATA_W];
+
+        ctrl_r_data_s = {sram1_dout_s, sram2_dout_s};
+        resbuf_result_s = addr_sum_s;
+
+        if (ctrl_write_s) begin
+            sram1_addr_s = ctrl_w_addr_s;
+            sram2_addr_s = ctrl_w_addr_s;
+        end else begin
+            sram1_addr_s = ctrl_r_addr_s;
+            sram2_addr_s = ctrl_r_addr_s;
+        end
+    end
+
+    //Any wires, combinational assigns, etc should go at the top for visibility
+   
+    //TODO: Finish instantiation of your controller module
+    controller u_ctrl (
+        .clk_i(clk),
+        .rst_i(rst),
+        .read_start_addr(read_start_addr),
+        .read_end_addr(read_end_addr),
+        .write_start_addr(write_start_addr),
+        .write_end_addr(write_end_addr),
+        .write(ctrl_write_s),
+        .w_addr(ctrl_w_addr_s),
+        .w_data(ctrl_w_data_s),
+        .read(ctrl_read_s),
+        .r_addr(ctrl_r_addr_s),
+        .r_data(ctrl_r_data_s),
+        .buffer_control(resbuf_loc_sel_s),
+        .op_a(addr_a_s),
+        .op_b(addr_b_s),
+        .carry_in           (addr_ci_s),
+        .carry_out          (addr_co_s),
+        .buff_result(resbuf_buffer_s)
+    );
+
+       //TODO: Finish instantiation of your adder module
+    adder32 u_adder (
+        .a_i(addr_a_s),
+        .b_i(addr_b_s),
+        .c_i(addr_ci_s),
+        .c_o(addr_co_s),
+        .sum_o(addr_sum_s)
+    );
+    //TODO: Finish instantiation of your result buffer
+    result_buffer u_resbuf (
+      .clk_i(clk),
+      .rst_i(rst),
+      .result_i(resbuf_result_s),
+      .loc_sel(resbuf_loc_sel_s),
+      .buffer_o(resbuf_buffer_s)
+    );
+    // FIXME Advaith new RAM
+    CF_SRAM_1024x32_macro sram_A (
+        .DO         (sram1_dout_s), // data output
+        .DI         (sram1_din_s), // data input
+        .AD         (sram1_addr_s), // 10-bit address
+        .CLKin      (clk), // Clock input             
+        .EN         (sram1_cs_s || ~sram1_we_s), // Global enable
+        .R_WB       (sram1_we_s), // Read enable
+
+        // DO NOT MODIFY THE FOLLOWING PINS
+        .BEN        (32'hFFFF_FFFF),    
+        .TM         (1'b0),            
+        .SM         (1'b0),            
+        .WLBI       (1'b0),            
+        .WLOFF      (1'b0),            
+        .ScanInCC   (1'b0),
+        .ScanInDL   (1'b0),
+        .ScanInDR   (1'b0),
+        .ScanOutCC  (),                
+        .vpwrac     (1'b1),            
+        .vpwrpc     (1'b1)
+    );
+
+    // TODO check enable signals
+    CF_SRAM_1024x32_macro sram_B (
+        .DO         (sram2_dout_s), // data output
+        .DI         (sram2_din_s), // data input
+        .AD         (sram2_addr_s), // 10-bit address
+        .CLKin      (clk), // Clock input             
+        .EN         (sram2_cs_s || ~sram2_we_s), // Global enable
+        .R_WB       (sram2_we_s), // Read enable
+
+        // DO NOT MODIFY THE FOLLOWING PINS
+        .BEN        (32'hFFFF_FFFF),    
+        .TM         (1'b0),            
+        .SM         (1'b0),            
+        .WLBI       (1'b0),            
+        .WLOFF      (1'b0),            
+        .ScanInCC   (1'b0),
+        .ScanInDL   (1'b0),
+        .ScanInDR   (1'b0),
+        .ScanOutCC  (),                
+        .vpwrac     (1'b1),            
+        .vpwrpc     (1'b1)
+    );
+    // FIXME Advaith end
+
+   
+endmodule