This should give you some information:
https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-0950-CPLD-ATF1504AS(L)-Datasheet.pdfThere are 4 dedicated input pins on the 1504 and either 32 or 64 pins capable of being used as either input or output, depending on the package the chip comes in (44 pin package = 32 I/O, 84 pin package = 64 I/O). Each of the I/O pins is associated with a specific macrocell. You need at least one macrocell for every pin used as an output.
Each macrocell consists of a bundle of combinatorial logic and one flip flop. Thus you need at least one macrocell for every flip flop used in your design.
The 64 macrocells are organised as 4 logic array blocks (LABs) with 16 macrocells in each one. The inputs available to a macrocell are:
(i) 16 signals equal to the complement of one of the product terms generated in each of the 16 macrocells in the same LAB
(ii) True and complement versions of 40 signals imported into the LAB from the global interconnect
Each macrocell has 5 product terms which can AND any selection of the above signals. Some of these can be ORed and then XORed in the usual logic tree, the output of which can either drive the flip flop input (D input, T input or latch control), or can be directed to the output pin. The signal from the pin and the flip flop output are fed back separately to the global interconnect, so it is possible to have a macrocell output driven by a combinatorial function but still use the flip flop for buried logic.
Separate single product terms (which must be allocated from the 5 available) can be used to drive the following with custom signals:
(i) The output enable for the output pin
(ii) The asynchronous set signal of the flip flop
(iii) The asynchronous reset signal of the flip flop; alternatively, the global reset signal GCLR can be used for this and in this case the signal is universally available without having to be imported from the global interconnect (so without taking up one of your 40 slots for the LAB)
(iv) Either the clock enable or the clock of the flip flop. If one of the global clocks is used to clock the flip flop, the clock enable is made available as a separate signal; if a custom clock is used, the CE is held high.
The global interconnect contains the following signals:
(i) The 4 dedicated inputs
(ii) Pin states for all I/O pins
(iii) For each macrocell, either the flip flop output or the main combinatorial logic tree output
Each LAB can pick at most 40 of these signals to use.
Typically you will need 1 macrocell for each flip flop, plus one for each output which is generated by a combinatorial function rather than directly as the output of a flip flop. However you may need more if you have complex combinatorial functions (lots of product terms needed) or very high connectivity between parts of the device.
What software package are you using to compile your VHDL into a JEDEC file you can program onto the 1504?
If you're using Quartus plus POF2JED, it doesn't optimize very well for the 1504 because the 7064 which is the "equivalent" doesn't allow such a flexible allocation of resources - for example it doesn't allow separate output enables per macrocell, and it doesn't allow separate use of the flip flop for macrocells whose output is combinatorial.