0
\$\begingroup\$

I designed 6 bit binary adder which should add two numbers in first complement. The numbers are being input via registers. I have to display the numbers and the result on two 7-segment displays via ROM in decimal, and an output before the displays which will tell if the number is negative or positive. I am having trouble with configuring the ROM. I made the table for all 64 numbers. The first display acts as 'tens' and the second as 'ones'. enter image description here

The 6 full adders are on the left connected in parallel vertically. The left 6 bit result is not complemented, the right is. How can I configure the ROM and what size should it be? Right now it is Address bit width: 6, Data bit width: 12. Thank you very much!

\$\endgroup\$
1
\$\begingroup\$

Let's start by thinking about the size of the ROM. I would prefer two separate ROMS, one for the tens and one for the ones.

Each of them needs all the bits of the result. These are 6 bits, so the Address Bit Width is 6.

The outputs of the ROMs drive directly the segments of the LEDs. We need to control each of the segments. These are 7 segments per LED, so the Data Bit Width is 7.

Now we need to put the right data into the ROM to configure it. I did it like this:

  1. Put the ROMs behind a 6-bit counter, because this is the fastest way to check all 64 values. You can copy the ROMs and LEDs later into the adder circuit.
  2. Reset the simulation, which will set the counter to 0.
  3. Open the "Hex Editor" by right clicking a ROM and selecting "Edit Contents…". Note that you need to close it, if you want to edit the other ROM.
  4. Edit the value at cell 00 until the correct digit is shown on the accompanied LED. You need some understanding how binary values and hex values are connected. You might need to jot down a table.
  5. Repeat this with the other ROM.
  6. Click the clock generator (with the poke tool, not the edit tool) so that the counter counts up by 1.
  7. Repeat both editing steps for the next numbers, until you have all ROM values for the digits from 0 to 9 (on the ones ROM) and from 0 to 6 (for the tens ROM).
  8. Now copy manually the respective values in all ROM cells. The ROM for the ones will get the sequence 0-1-2-3-4-5-6-7-8-9-0-...-9-0-1-2-3. The ROM for the tens will get 0-0-0-0-0-0-0-0-0-0-1-1-...-1-2-2-...-5-6-6-6-6.

my example

If you rather like to use a single ROM, you will need 14 data bits. The method to fill the ROM is still the same.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I've done the 6 bit adders and the results are correct. For this problem my professor limited us to a single ROM, I have problems with displaying the result correctly. For example the numbers 0, 3, 7, 8, 9 are displayed correctly and the other ones are not. I've done a table for the bits: x1 x2 x3 x4 x5 & x6, and for the two displays a, b, c, d, e, f, g and a1, b1, c1, d1, e1, f1, g1. I grouped them by four and adding two zeros at the end because f1 and g1 were left 'alone', and then converted them to hex. I used 6 address to 16 data bit ROM. I don't know how to fix this problem.. \$\endgroup\$ – ChidoriMaster Feb 2 at 22:30
  • \$\begingroup\$ imgur.com/LPyvobN This is part of the implementation I've done. I've left out the 5 full adders (they were too big to fit in a sensible sized image, and the result is complemented because the numbers added are in first complement). I used the 'last bit carry' as a sign when there is overflow so the two displays show - -.😅 \$\endgroup\$ – ChidoriMaster Feb 2 at 22:34
  • \$\begingroup\$ Do you know that you can "divide-and-conquer" your design? Logisim implements so-called subcircuits for this. This is especially useful if you need more than one instance of a block, in your case the full adder. And it is useful to separate top-level blocks from concrete implementations. Follow Logisims built-in tutorial for this. \$\endgroup\$ – the busybee Feb 3 at 6:46
  • \$\begingroup\$ If you still have your 2-ROMs solution (you saved it with another name, didn't you?) you could combine both value sets into one. For example, if ROM1 contains 6b and ROM2 3f at the same address, put 6b3f into the single ROM. Use 16 data bits and skip the eighth bit. -- Anyway, there is no difference in the approach between the 2-ROMs solution and the single-ROM solution. If nothing else helps, you might need to clear the contents of the ROM and start all over. \$\endgroup\$ – the busybee Feb 3 at 6:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.