URL
https://opencores.org/ocsvn/eco32/eco32/trunk
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 118 |
Rev 220 |
Line 24... |
Line 24... |
output byte_n;
|
output byte_n;
|
output [19:0] a;
|
output [19:0] a;
|
input [15:0] d;
|
input [15:0] d;
|
|
|
reg [3:0] state;
|
reg [3:0] state;
|
reg a0;
|
reg upper_half;
|
|
|
// the following control signals are all
|
// the following control signals are all
|
// either constantly asserted or deasserted
|
// either constantly asserted or deasserted
|
assign ce_n = 0;
|
assign ce_n = 0;
|
assign oe_n = 0;
|
assign oe_n = 0;
|
assign we_n = 1;
|
assign we_n = 1;
|
assign rst_n = 1;
|
assign rst_n = 1;
|
assign byte_n = 1;
|
assign byte_n = 1;
|
|
|
// the flash ROM is organized in 16-bit halfwords
|
// the flash ROM is organized in 16-bit halfwords
|
// address line a0 is controlled by the state machine
|
// address line a[0] is controlled by the state machine
|
// (this is necessary for word accesses)
|
// (this is necessary for word accesses)
|
assign a[19:1] = addr[20:2];
|
assign a[19:1] = addr[20:2];
|
assign a[0] = a0;
|
assign a[0] = upper_half;
|
|
|
// the state machine
|
// the state machine
|
always @(posedge clk) begin
|
always @(posedge clk) begin
|
if (reset == 1) begin
|
if (reset == 1) begin
|
state <= 0;
|
state <= 0;
|
Line 52... |
Line 52... |
// wait for start of access
|
// wait for start of access
|
if (en == 1 && wr == 0) begin
|
if (en == 1 && wr == 0) begin
|
state <= 1;
|
state <= 1;
|
if (size[1] == 1) begin
|
if (size[1] == 1) begin
|
// word access
|
// word access
|
a0 <= 0;
|
upper_half <= 0;
|
end else begin
|
end else begin
|
// halfword or byte access
|
// halfword or byte access
|
a0 <= addr[1];
|
upper_half <= addr[1];
|
end
|
end
|
end
|
end
|
end else
|
end else
|
if (state == 6) begin
|
if (state == 6) begin
|
if (size[1] == 1) begin
|
if (size[1] == 1) begin
|
// word access
|
// word access
|
// latch upper halfword
|
// latch upper halfword
|
data_out[31:24] <= d[7:0];
|
data_out[31:24] <= d[7:0];
|
data_out[23:16] <= d[15:8];
|
data_out[23:16] <= d[15:8];
|
state <= 7;
|
state <= 7;
|
a0 <= 1;
|
upper_half <= 1;
|
end else begin
|
end else begin
|
// halfword or byte access
|
// halfword or byte access
|
data_out[31:16] <= 16'h0000;
|
data_out[31:16] <= 16'h0000;
|
if (size[0] == 1) begin
|
if (size[0] == 1) begin
|
// halfword access
|
// halfword access
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.