P
pallav
Guest
I'm trying to get reacquainted with Verilog (after 3-4 years). I'm
building a model of a simple memory module. The partial code is as
follows:
module dram #(parameter DRAMSIZE = 8192, parameter ADRWIDTH = 13)
(input ph1, ph2, // non-overlapping phase
clocks
input reset, // synchronous reset
input [ADRWIDTH-1:0] addr, // address
input [3:0] byteen, // byte enable mask
input rwb, en, // read/write bar, memory
enable
inout [31:0] data, // bi-directional data
output done); // memory operation
complete
reg [31:0] DRAM[DRAMSIZE-1:0];
wire [7:0] bytes3, bytes2, bytes1, bytes0;
// assign bytes to data to write to memory depending upon byte
enable mask
assign bytes0 = byteen[0] ? data[7:0] : DRAM[adr][7:0];
assign bytes1 = byteen[1] ? data[15:8] : DRAM[adr][15:8];
assign bytes2 = byteen[2] ? data[23:16] : DRAM[adr][23:16];
assign bytes3 = byteen[3] ? data[31:24] : DRAM[adr][31:24];
....
endmodule // dram
I'm compiling this code using Icarius Verilog and am getting errors on
the assign bytes* statements. The errors are like this:
dram.v:37: parse error
dram.v:37: error: syntax error in continuous assignment
dram.v:38: parse error
dram.v:38: error: syntax error in continuous assignment
dram.v:39: parse error
dram.v:39: error: syntax error in continuous assignment
dram.v:40: parse error
dram.v:40: error: syntax error in continuous assignment
The assign statements look OK to me but I'm not sure if I'm access the
memory correctly. I'm not sure what is the correct syntax for access
particular bits in a given array of regs.
Any ideas what I'm doing wrong? Thanks.
building a model of a simple memory module. The partial code is as
follows:
module dram #(parameter DRAMSIZE = 8192, parameter ADRWIDTH = 13)
(input ph1, ph2, // non-overlapping phase
clocks
input reset, // synchronous reset
input [ADRWIDTH-1:0] addr, // address
input [3:0] byteen, // byte enable mask
input rwb, en, // read/write bar, memory
enable
inout [31:0] data, // bi-directional data
output done); // memory operation
complete
reg [31:0] DRAM[DRAMSIZE-1:0];
wire [7:0] bytes3, bytes2, bytes1, bytes0;
// assign bytes to data to write to memory depending upon byte
enable mask
assign bytes0 = byteen[0] ? data[7:0] : DRAM[adr][7:0];
assign bytes1 = byteen[1] ? data[15:8] : DRAM[adr][15:8];
assign bytes2 = byteen[2] ? data[23:16] : DRAM[adr][23:16];
assign bytes3 = byteen[3] ? data[31:24] : DRAM[adr][31:24];
....
endmodule // dram
I'm compiling this code using Icarius Verilog and am getting errors on
the assign bytes* statements. The errors are like this:
dram.v:37: parse error
dram.v:37: error: syntax error in continuous assignment
dram.v:38: parse error
dram.v:38: error: syntax error in continuous assignment
dram.v:39: parse error
dram.v:39: error: syntax error in continuous assignment
dram.v:40: parse error
dram.v:40: error: syntax error in continuous assignment
The assign statements look OK to me but I'm not sure if I'm access the
memory correctly. I'm not sure what is the correct syntax for access
particular bits in a given array of regs.
Any ideas what I'm doing wrong? Thanks.