Main memory has 512 words, that means it requires 9 bits to identify each word. The physical address length is 9 bits.
Assuming the cache is a Direct Mapped Cache,
Block is of size 8 words, so you need 3 bits for block offset.
Cache contains 32 words and block size is given as 8 words, that means cache contains 4 blocks. To identify one line/block you need 2 bits.
The remaining bits go for tag, i.e 4 bits.