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.

Problem with a code for assigning RAM location

Status
Not open for further replies.

anandanips

Junior Member level 1
Joined
Dec 21, 2007
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,439

the following modules is required 255 ram locations of 8 bit wide.i am writing code like this.
module xy(x,y,ram);
input x,y;
output [7:0] ram[0:255];

reg[7:0] ram[0:255];


to assigning value of ram location i am writing like
ram[0]=data;
ram[1]=data;
ram[2]=data;
ram[3]=data;
ram[4]=data;
.
.
.
.
.
.// where data is 8 bit wide.
that statements are exeuting in different case .
for output only one assignment statement (as above) will be appear.
my proplem is ,i am getting 2 error in the place of array declattion:
output [7:0] ram[0:255];
reg[7:0] ram[0:255];
so , please can anyone clear my mistakes.and say the above assignment is correct or not also
 

answer to me

try this

module ram_data(
output wire [7:0] data,
input wire [17:0]address,
input wire ce,
input wire oe,
input wire we
);


reg [7:0] mem[255 : 1];

assign data = ce?(oe ?( we? 10'bz : mem[address]) :10'bz): 10'bz ;

initial
begin

mem[1] = 8'b01000000 ;// 64
mem[2] = 8'b00111111 ;// 63
mem[3] = 8'b00111100 ;// 60
mem[4] = 8'b00111000 ;// 56
mem[5] = 8'b00110001 ;// 49
mem[6] = 8'b00101010 ;// 42
mem[7] = 8'b00100001 ;// 33
mem[8] = 8'b00010111 ;// 23
mem[9] = 8'b00001100 ;// 12
mem[10] = 8'b00000010 ;// 2
.
.
.
.
end

endmodule
 

answer to me

Verilog doesn't allow passing a register array (such as 'ram') through a module port. Try passing only the 8-bit address and 8-bit data signals, as kalyansrinivas described.

It may help the discussion if you could show the complete module rather than just a few lines of code.

Please ask follow-up questions in the same discussion, instead of creating a new discussion:
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top