cv-frontend-vue icon indicating copy to clipboard operation
cv-frontend-vue copied to clipboard

Added pre condition in the verilog module

Open 092vk opened this issue 5 months ago โ€ข 2 comments

Fixes #561

Describe the changes you have made in this PR -

  1. Added the pre condiiton logic in the verilog module
  2. Made the verilog module consistent to the circuit simulation logic

Note: Please check Allow edits from maintainers. if you would like us to assist in the PR.

Summary by CodeRabbit

  • Bug Fixes
    • Improved the T flip-flopโ€™s asynchronous reset so preset/unknown cases are handled more accurately, reducing simulation inaccuracies.
    • Refined enable and toggle semantics so the flip-flop now reliably holds or toggles only when enabled and t is high, while maintaining complementary q/q_inv outputs after reset.

092vk avatar Jun 29 '25 04:06 092vk

Deploy Preview for circuitverse ready!

Name Link
Latest commit c9f15185fd63144932c9a14e4384eeb531c309f0
Latest deploy log https://app.netlify.com/projects/circuitverse/deploys/68aaa8e3f696ff0008831760
Deploy Preview https://deploy-preview-620--circuitverse.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

Lighthouse
1 paths audited
Performance: 46 (๐Ÿ”ด down 1 from production)
Accessibility: 72 (๐Ÿ”ด down 1 from production)
Best Practices: 92 (no change from production)
SEO: 80 (๐Ÿ”ด down 2 from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify project configuration.

netlify[bot] avatar Jun 29 '25 04:06 netlify[bot]

Walkthrough

The Verilog string in TflipFlop.js was updated to change reset and toggle semantics: asynchronous reset now assigns outputs based on pre, enable gating replaces previous en==0 path, and the always block and port declarations were restructured to match simulator logic.

Changes

Cohort / File(s) Change Summary
T flip-flop Verilog update
src/simulator/src/sequential/TflipFlop.js
Rewrote the generated Verilog module string in moduleVerilog(): updated port declarations (input clk, a_rst, en; input [WIDTH-1:0] t, pre;), changed async reset to assign q = pre and q_inv = ~pre, replaced previous enable/toggle paths with explicit en-gated toggle and hold branches, wrapped always block with begin...end, and added inline comments.

Estimated code review effort

๐ŸŽฏ 2 (Simple) | โฑ๏ธ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix errors in Verilog modules and ensure consistency with simulator logic (#561) โœ…
Implement preset (pre) handling in flip-flop Verilog modules (#561) โœ…
Ensure flip-flop enable and toggle semantics match simulator behavior (#561) โœ…
โœจ Finishing Touches
  • [ ] ๐Ÿ“ Generate Docstrings
๐Ÿงช Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

โค๏ธ Share
๐Ÿชง Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Jun 29 '25 04:06 coderabbitai[bot]