Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arithmetic Lab Simulation for 8-bit Adder using default negative numbers fails partway #69

Open
tylerricks377 opened this issue Aug 7, 2023 · 0 comments

Comments

@tylerricks377
Copy link
Collaborator

The second simulation for the Arithmetic lab simulates a simple 8-bit adder. Running this simulation with the default code and default simulation input as is generates this error:

Compiling
###########################################################################################
b'Input (18446744073709551495) on line 8 too large. Expected 8 bit value.\nEnabling waves into logs/vlt_dump.vcd...\n'
  zero:
    co      : "▔▔▔╲▁▁▁▁▁▁▁▁▁▁▁"
  two:
    cin     : "▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔"
    co      : "▁▁▁▁▁▁▁▁▁╱▔▔╲▁▁"
  three:
    co      : "▁▁▁╱▔▔╲▁▁╱▔▔╲▁▁"
  four:
    co      : "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁"
  six:
    cin     : "▁▁▁▁▁▁╱▔▔▔▔▔╲▁▁"
...

and the simulation of all the signals prints only half-way from left to right. The values on line 8 are cin = 0, a = 100, and b = -121.

Taking out all the negative values in the simulation code area gets rid of this problem, and the entire simulation prints out normally, ex:

Compiling
###########################################################################################
b'Enabling waves into logs/vlt_dump.vcd...\n'
  zero:
    co      : "▔▔▔╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔▔▔▔▔▔▔╲▁▁▁▁▁╱▔▔╲▁▁╱▔▔▔▔▔▔▔▔"
  two:
    cin     : "▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔╲▁▁▁▁▁╱▔▔╲▁▁▁▁▁▁▁▁╱▔▔▔▔▔╲▁▁▁▁▁╱▔▔"
    co      : "▁▁▁▁▁▁▁▁▁╱▔▔╲▁▁▁▁▁▁▁▁╱▔▔╲▁▁▁▁▁▁▁▁╱▔▔╲▁▁▁▁▁▁▁▁╱▔▔"
  three:
    co      : "▁▁▁╱▔▔╲▁▁╱▔▔╲▁▁▁▁▁▁▁▁╱▔▔╲▁▁╱▔▔╲▁▁╱▔▔╲▁▁▁▁▁▁▁▁╱▔▔"
  four:
    co      : "▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔╲▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁╱▔▔"
  six:
    cin     : "▁▁▁▁▁▁╱▔▔▔▔▔╲▁▁╱▔▔╲▁▁▁▁▁▁▁▁▁▁▁╱▔▔▔▔▔╲▁▁╱▔▔╲▁▁▁▁▁"
...

Currently, the code is assuming the numbers in the simulation are all unsigned and not two's complement. The question I have is this: do we want to change all the default values in the simulation to be positive, or do we want to change the code to additionally calculate the number of bits needed for two's complement numbers on top of unsigned numbers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant