Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] help in correcting errors in fifo verilog code

Status
Not open for further replies.

theHermes

Newbie level 6
Joined
Mar 13, 2011
Messages
13
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,434
HI, this is my code for synchronous fifo.I have tried to correct errors as much as possible but I have not suceeded. The error it says is illegal left hand assignment and shows many places.but I don`t know how to correct? Thanks for ur help.

`timescale 1ns / 1ps
module fifo2 (wr, rst,clk,rd,din,full, empty,dout);

input wr,rd,clk,rst;
input [7:0] din;
output full,empty;
output [7:0] dout;
integer count,tmp;
reg [7:0]memory[15:0];
initial
begin
count=0;
tmp=0;
end


always@ (posedge clk)
begin

if (rst == 1)
begin
dout <= 0;
empty <= 0;
full <= 0;
end

if (wr == 1)
begin
if(count == 15)
begin
full <= 1;
end
else
begin
full <= 0;
empty <= 0;
memory[count] <= din;
count <= count + 1;
end
end

else if (rd == 1)
begin
if(count == 0)
begin
dout <= 0;
empty <= 1;
end
else if (count == 1)
begin
empty <= 0;
full <= 0;
dout <= memory[0];
count <= count - 1;
end
else
begin
empty <= 0;
full <= 0;
dout <= memory[0];
for (tmp = 0; tmp<15 ; tmp = tmp + 1)
memory[tmp] <= memory[tmp + 1];
count <= count - 1;
end

end
end
endmodule
 

if you assign a value inside 'always' block
the object has to be declared as 'reg';

add 'reg' to the declaration:
output reg full,empty;
the same for dout;

J.A
 

the code now has no errors. thanks a lot!!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top