Altera Code to Demultiplex HC12 Address and Data Busses


SUBDESIGN demux_addr
(
    E               :  INPUT;   % E-Clock %

    PA[7..0]        :  BIDIR;   % Address and Data (15-8) from HC12 %
    PB[7..0]        :  BIDIR;   % Address and Data (7-0) from HC12 %

    A[15..0]        :  OUTPUT;  % Demultiplexed address bits % 
)


VARIABLE
    demux[15..0]    :  DFF;    % Demuliplexed address internal %

BEGIN

% ***********************************************************************%
% Address demultiplexing                                                 %
% ***********************************************************************%

    demux[15..8].d = PA[7..0];
    demux[7..0].d  = PB[7..0];
    demux[15..0].clk = E; 

    A[15..0] = demux[15..0].q;
    
END;