Have I found a bug in the HardwareSimulator ? (Probably not)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Have I found a bug in the HardwareSimulator ? (Probably not)

Lozminda
Here's my code for RAM8
1   DMux8Way(in=load, sel[0..2]=address[0..2], a=l0, b=l1, c=l2, d=l3, e=l4, f=l5, g=l6, h=l7);
2   RAM8(in=in, load=l0,address[0..2]=address[3..5],out=o0);
3   RAM8(in=in, load=l1,address[0..2]=address[3..5],out=o1);
4   RAM8(in=in, load=l2,address[0..2]=address[3..5],out=o2);
5   RAM8(in=in, load=l3,address[0..2]=address[3..5],out=o3);
6   RAM8(in=in, load=l4,address[0..2]=address[3..5],out=o4);
7   RAM8(in=in, load=l5,address[0..2]=address[3..5],out=o5);
8   RAM8(in=in, load=l6,address[0..2]=address[3..5],out=o6);
9   RAM8(in=in, load=l7,address[0..2]=address[3..5],out=o7);
10 Mux8Way16(a=o0, b=o1, c=o2, d=o3, e=o4, f=o5, g=o6, h=o7, sel[0..2]=address[0..2], out=out);

(I've put the line numbers in to help with the following)

I run it through the HS (HardwareSimulator) and according to it, my chip is fine. I wasn't completely sure i'd wired it correctly so just to look for false positives as it were i changed line 2 to
RAM8(in=in, load=l0,address[0..2]=address[0..2],out=o0); (The second address is [0..2] not [3..5])

And the HS again completed the test script with no errors
so i changed subsequent lines until i had this

2   RAM8(in=in, load=l0,address[0..2]=address[0..2],out=o0);
3   RAM8(in=in, load=l1,address[0..2]=address[0..2],out=o1);
4   RAM8(in=in, load=l2,address[0..2]=address[0..2],out=o2);
5   RAM8(in=in, load=l3,address[0..2]=address[0..2],out=o3);
6   RAM8(in=in, load=l4,address[0..2]=address[0..2],out=o4);
7   RAM8(in=in, load=l5,address[0..2]=address[0..2],out=o5);
8   RAM8(in=in, load=l6,address[0..2]=address[3..5],out=o6);
9   RAM8(in=in, load=l7,address[0..2]=address[3..5],out=o7);

still no errors from the HS. It was only when i'd changed all but one did i finally get a comparison error.

Any thoughts anyone ?
All the best to my fellow N2Ters, have a good day!
Lozminda
Reply | Threaded
Open this post in threaded view
|

Re: Have I found a bug in the HardwareSimulator ? (Probably not)

Lozminda
Ps Having done a quick check online it would seem my original code was wrong too [0..2] should be swapped with [3..5] ie i've got my address digits the wrong way around, though this doesn't seem to matter according to the HS.. Cheers
Reply | Threaded
Open this post in threaded view
|

Re: Have I found a bug in the HardwareSimulator ? (Probably not)

WBahn
Administrator
In reply to this post by Lozminda
How can this be your code for RAM8 when you USE a bunch of RAM8 parts in it?

I think you mean that this is your code for RAM64.

In your modifications you are progressively reducing the effective size of your memory and making it so that multiple addresses map to the same memory location. The tests can't detect that until you get to a point where you write to one address that overwrites a memory location that was previously written to using a different address and that is subsequently read using that previous address.

For instance, in your first modification (where you just changed line 2), you've made it so that if the person writes to any address where address = ???000 will write to address 000 in that RAM8 block. So if you write

RAM[8] = 8
RAM[16] = 16

and then go back and read RAM[8] you will discover that it is now 16.

Reply | Threaded
Open this post in threaded view
|

Re: Have I found a bug in the HardwareSimulator ? (Probably not)

WBahn
Administrator
In reply to this post by Lozminda
Putting the upper bits as the bank select (going to the MUX and DMUX parts) is the most intuitive way, but it doesn't really matter. As long as each address maps to a distinct memory location and it is the same location whether you are reading or writing, it will work fine.
Reply | Threaded
Open this post in threaded view
|

Re: Have I found a bug in the HardwareSimulator ? (Probably not)

Lozminda
In reply to this post by WBahn
Yes indeed RAM64, my mistake.

I did have a feeling it might be something like that. Thank you. As I've gone on my appreciation of the HardwareSimulator is increasing, after a few teething problems.

Thanks again for your reply.

All the best

L