I can't for the life of me figure out what is wrong with my code.
I want my register "[Rom_Bank_Reg7..0]" to be written when the input address is between 0x2000 - 0x2FFF (and WR is asserted). I've included the top 4 bits of the address bus as inputs so I can detect this address range.
The output "[hiRom7..0]" should behave as follows:
- If address is between 0x0000 and 0x3FFF, set output to 0x00
- If address between 0x4000 and 0x7FFF, set output to contents of "[Rom_Bank_Reg7..0]"
Because the system only reads from from for addresses less than 0x8000, I am using A15 as a CE (active low) for the ROM.
I don't think the ATF1504ASL supports synchronous resets, so that's why I'm using asynchronous. I didn't think this would be a problem, since my RESET signal is coming from an input pin (faster than using product terms). However, my program keeps hanging when I try to execute it. Does anyone see any issues below, especially regarding any potential reset issues?
Just in case, .l is the latch input, .le is the latch enable, and .ar is the async reset.
Sorry if I ask any dumb questions, I'm a total newbie and WinCUPL is surprisingly hard to find help with.
Code:
/* INPUTS */
pin 2 = A15; /*RomCE, Active low*/
pin 3 = A14;
pin 5 = A13;
pin 6 = A12;
pin 8 = D7;
pin 10 = D6;
pin 11 = D5;
pin 12 = D4;
pin 13 = D3;
pin 14 = D2;
pin 15 = D1;
pin 18 = D0;
pin 20 = RD;
pin 21 = WR;
pin 39 = RESET;
/* OUTPUTS */
pin 23 = hiRom0;
pin 25 = hiRom1;
pin 27 = hiRom2;
pin 28 = hiRom3;
pin 30 = hiRom4;
pin 31 = hiRom5;
pin 33 = hiRom6;
pin 34 = hiRom7;
/* VARIABLES */
Rom_Bank_Select = !A15 & !A14 & A13 & !A12 & !WR;
node [Rom_Bank_Reg7..0];
[Rom_Bank_Reg7..0].l = [D7..0];
[Rom_Bank_Reg7..0].le = Rom_Bank_Select;
Rom_Bank_Reg7.ar = !RESET;
Rom_Bank_Reg6.ar = !RESET;
Rom_Bank_Reg5.ar = !RESET;
Rom_Bank_Reg4.ar = !RESET;
Rom_Bank_Reg3.ar = !RESET;
Rom_Bank_Reg2.ar = !RESET;
Rom_Bank_Reg1.ar = !RESET;
Rom_Bank_Reg0.ar = !RESET;
[hiRom7..0] = [Rom_Bank_Reg7..0] & A14;