Newb: Help with decoder/latch

P

Prime

Guest
Hi, I am trying to replace an LS573 latch with a CPLD (because in future
I want to be able to do address decoding as well as latching, and a CPLD
will keep my chip count down). But am running into problems, here is my
current code :-

odule avrinterface(AD,RD,WR,ALE,Ahigh,Addr,Dram,CS,RRD,RWR);
input RD; // RD from AVR
input WR; // WR from AVR
input ALE; // Address Latch from AVR
input Ahigh; // High address lines [8..15] from AVR

output [15:0] Addr; // Address lines to RAM
output CS; // Chip select to RAM
output RRD; // RD to ram
output RWR; // WR to ram

inout AD; // Multiplexed low address lines/data lines
from AVR
inout Dram; // Data lines to/from RAM

reg [7:0] Alow = 8'h00;
reg [7:0] DataBuf = 8'h00;
reg [15:0] Addr = 16'h0000;

wire [7:0] Dramin;

assign RRD = RD;
assign RWR = WR;
assign CS = 0;

assign Dramin = Dram;

assign AD = RD ? DataBuf : 8'bz;
assign Dram = WR ? DataBuf : 8'bz;

always @(posedge ALE or posedge RD or posedge WR)
begin
if (ALE == 1)
begin
Alow <= AD;
Addr <= {Ahigh,Alow};
end

if (RD == 1)
begin
DataBuf <= Dramin;
end

if (WR == 1)
begin
DataBuf <= AD;
end
end

endmodule


The latch is used to interface an AVR microcontroler to some standard
SRAM, the AVR multiplexes the bottom 8 address bits and the data bits on
the same port, the top address bits are not multiplexed. The ALE signal
determines if the multiplexed port is data or address, High=Address, RD
and WR are standard active high Read and Write signals.

The problem I get is that when I try and synthisise the above code I get
:-

ERROR:Xst:899 - avrinterface.v line 38: The logic for <Alow> does not
match a known FF or Latch template.
ERROR:Xst:899 - avrinterface.v line 39: The logic for <Addr> does not
match a known FF or Latch template.

If I comment out the if (WR == 1) and the posedge WR in the always, it
compiles but I get a bucket load of errors from "translate" :-

WARNING:Xst:646 - Signal <DataBuf<7:1>> is assigned but never used.
WARNING:Xst:737 - Found 16-bit latch for signal <Addr>.
WARNING:Xst:737 - Found 8-bit latch for signal <Alow>.
WARNING:Xst:737 - Found 8-bit latch for signal <DataBuf>.
WARNING:Xst:1710 - FF/Latch <Addr_12> (without init value) is constant
in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_11>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_10>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_9>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_14>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_15>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Alow_4>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Alow_3>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Alow_2>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Alow_1>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Alow_6>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Alow_7>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_13>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Alow_5>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_1>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_2>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_3>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_4>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_5>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_6>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1895 - Due to other FF/Latch trimming, FF/Latch <Addr_7>
(without init value) is constant in block <avrinterface>.
WARNING:Xst:1291 - FF/Latch <DataBuf_5> is unconnected in block
<avrinterface>.
WARNING:Xst:1291 - FF/Latch <DataBuf_7> is unconnected in block
<avrinterface>.
WARNING:Xst:1291 - FF/Latch <DataBuf_6> is unconnected in block
<avrinterface>.
WARNING:Xst:1291 - FF/Latch <DataBuf_1> is unconnected in block
<avrinterface>.
WARNING:Xst:1291 - FF/Latch <DataBuf_2> is unconnected in block
<avrinterface>.
WARNING:Xst:1291 - FF/Latch <DataBuf_3> is unconnected in block
<avrinterface>.
WARNING:Xst:1291 - FF/Latch <DataBuf_4> is unconnected in block
<avrinterface>.



Does anyone know what I am doing wrong or have any sugestions of how to
fix it.

Cheers.

Phill.
 

Welcome to EDABoard.com

Sponsor

Back
Top