Hello,
I am new to VHDL and am trying to adapt code from https://github.com/skiselev/tiny_z80/tree/master/CPLD
to implement memory paging registers for a Z80 board (with a Xilinx CPLD XC9572XL-10VQ64C).
Paging registers should provide 4 banks of 16Kb (in Z80 address space), mapping 512Kb, should be writable and readable back.
(similar to how it is described in https://www.smbaker.com/16-megabytes-of-ram-in-a-heathkit-h8-vintage-computer).
For now I am stuck as it seems that the values are not written or retained by the registers.
The simulation in Xilinx iSim shows that correct values are stored and read from the register (with test bench for the "page_reg_4x6_lpm.vhd").
This does not match with the physical CPLD.

For now I cannot get the value written in any of the paging registers back, the PA is read as zeros.
When reading D6 holds correct value for PAGE_ENA (written to and read from PAGE_ENA_FF flip flop), lower bits are always 0.
In asm
out (78h),2ah ; write to the first paging register
in a,(78h) ; read the value back, but always getting only PAGE_ENA and zeros for the rest
The use of the paging register (A_HI are the A14, A15 bits of address):
rdaddress <= A(1 downto 0) when PAGE_RD = '1' else A_HI;
-- Page register
PAGE_REG : page_reg_4x6_lpm port map(CLK => CPU_CLK, RSTn => RSTn,
data => D(5 downto 0),
-- rdaddress => A_HI,
rdaddress => rdaddress,
wraddress => A(1 downto 0),
wren => PAGE_WR,
q => PA);
...
D(6) <= PAGE_ENA when PAGE_RD = '1' else 'Z'; -- this comes back as expected
D(5 downto 0) <= PA(19 downto 14) when PAGE_RD = '1' else (others => 'Z'); -- always zeros
Is it correct to hold register values in the page_reg_4x6_lpm itself like
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (5 DOWNTO 0);
or should they be moved to tinyz80 entity for them to be preserved (maybe I misunderstand the basics)?
I am new to VHDL and am trying to adapt code from https://github.com/skiselev/tiny_z80/tree/master/CPLD
to implement memory paging registers for a Z80 board (with a Xilinx CPLD XC9572XL-10VQ64C).
Paging registers should provide 4 banks of 16Kb (in Z80 address space), mapping 512Kb, should be writable and readable back.
(similar to how it is described in https://www.smbaker.com/16-megabytes-of-ram-in-a-heathkit-h8-vintage-computer).
For now I am stuck as it seems that the values are not written or retained by the registers.
The simulation in Xilinx iSim shows that correct values are stored and read from the register (with test bench for the "page_reg_4x6_lpm.vhd").
This does not match with the physical CPLD.

For now I cannot get the value written in any of the paging registers back, the PA is read as zeros.
When reading D6 holds correct value for PAGE_ENA (written to and read from PAGE_ENA_FF flip flop), lower bits are always 0.
In asm
out (78h),2ah ; write to the first paging register
in a,(78h) ; read the value back, but always getting only PAGE_ENA and zeros for the rest
The use of the paging register (A_HI are the A14, A15 bits of address):
rdaddress <= A(1 downto 0) when PAGE_RD = '1' else A_HI;
-- Page register
PAGE_REG : page_reg_4x6_lpm port map(CLK => CPU_CLK, RSTn => RSTn,
data => D(5 downto 0),
-- rdaddress => A_HI,
rdaddress => rdaddress,
wraddress => A(1 downto 0),
wren => PAGE_WR,
q => PA);
...
D(6) <= PAGE_ENA when PAGE_RD = '1' else 'Z'; -- this comes back as expected
D(5 downto 0) <= PA(19 downto 14) when PAGE_RD = '1' else (others => 'Z'); -- always zeros
Is it correct to hold register values in the page_reg_4x6_lpm itself like
SIGNAL sub_wire0 : STD_LOGIC_VECTOR (5 DOWNTO 0);
or should they be moved to tinyz80 entity for them to be preserved (maybe I misunderstand the basics)?
Attachments
-
3.5 KB Views: 0
-
2.1 KB Views: 2
-
447 bytes Views: 1
-
4 KB Views: 0