forked from BerkeleyLab/Bedrock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlb_gateway.v
56 lines (52 loc) · 1.5 KB
/
lb_gateway.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Simple wrapper of mem_gateway.v
// Rename ports to get something more familiar to:
// - newad.py
// - picorv32 memory bus bridge
// - xilinx DRP bridge
// - potential axi-lite/wishbone bridge
module lb_gateway #(
parameter n_lat =8,
parameter read_pipe_len=3
) (
input clk, // timespec 6.8 ns
// client interface with RTEFI, see doc/clients.eps
input [10:0] len_c,
input [ 7:0] idata,
input raw_l,
input raw_s,
output [ 7:0] odata,
// local bus master
output lb_clk,
output [23:0] lb_addr,
output lb_write,
output lb_read,
output lb_rvalid,
output lb_pre_rvalid,
output [31:0] lb_wdata,
input [31:0] lb_rdata
);
wire control_strobe, control_rd;
wire [read_pipe_len:0] control_pipe_rd;
mem_gateway #(
.n_lat (n_lat),
.read_pipe_len (read_pipe_len)
) mem_gateway_i (
.clk (clk),
.len_c (len_c),
.idata (idata),
.raw_l (raw_l),
.raw_s (raw_s),
.odata (odata),
.addr (lb_addr),
.control_strobe (control_strobe),
.control_rd (control_rd),
.control_rd_valid(lb_rvalid),
.control_pipe_rd (control_pipe_rd),
.data_out (lb_wdata),
.data_in (lb_rdata)
);
assign lb_clk = clk;
assign lb_write = control_strobe & ~control_rd;
assign lb_read = |control_pipe_rd;
assign lb_pre_rvalid = control_pipe_rd[read_pipe_len-1];
endmodule