CPLD bug fixes
This commit is contained in:
+17
-17
@@ -9,14 +9,14 @@ module BUS_Con (
|
||||
output o_miso, // <-- MISO Logic added here
|
||||
|
||||
// Local Interface
|
||||
output o_rvaild, // (Typo in original: o_rvalid)
|
||||
input i_rvaild, // Valid signal from Backend (Data is ready)
|
||||
input i_wvaild,
|
||||
output o_rvalid, // (Typo in original: o_rvalid)
|
||||
input i_rvalid, // Valid signal from Backend (Data is ready)
|
||||
input i_wvalid,
|
||||
output o_wready,
|
||||
input i_reg_busy,
|
||||
input [23:0] i_rdata, // Data from Backend to send to Master
|
||||
output o_wr,
|
||||
output o_cmd_vaild,
|
||||
output o_cmd_valid,
|
||||
output [23:0] o_data,
|
||||
output [6:0] o_addr,
|
||||
output o_err
|
||||
@@ -61,19 +61,19 @@ module BUS_Con (
|
||||
reg err_flag;
|
||||
reg [1:0] state;
|
||||
//
|
||||
reg [31:0] tx_buffer; // Holds data waiting for the next CS Low
|
||||
reg [31:0] miso_shift; // The actual shifter
|
||||
// Output Registers
|
||||
reg [6:0] addr_out;
|
||||
reg [23:0] data_out;
|
||||
reg wr_out;
|
||||
reg [31:0] tx_buffer; // Holds data waiting for the next CS Low
|
||||
reg [31:0] miso_shift; // The actual shifter
|
||||
// Output Registers
|
||||
reg [6:0] addr_out;
|
||||
reg [23:0] data_out;
|
||||
reg wr_out;
|
||||
reg cmd_valid_out;
|
||||
|
||||
//
|
||||
localparam IDLE = 2'b00;
|
||||
localparam CMD_SENT = 2'b01;
|
||||
localparam WAIT_BUSY = 2'b10;
|
||||
localparam DONE = 2'b11;
|
||||
localparam IDLE = 2'b00;
|
||||
localparam CMD_SENT = 2'b01;
|
||||
localparam WAIT_BUSY = 2'b10;
|
||||
localparam DONE = 2'b11;
|
||||
|
||||
|
||||
always @(posedge i_sys_clk) begin
|
||||
@@ -122,7 +122,7 @@ module BUS_Con (
|
||||
end else begin
|
||||
// If backend provides valid read data, store it.
|
||||
// We pad the top 8 bits with Zeros (or you can put status flags here)
|
||||
if (i_rvaild) begin
|
||||
if (i_rvalid) begin
|
||||
tx_buffer <= {8'h00, i_rdata};
|
||||
end
|
||||
end
|
||||
@@ -205,11 +205,11 @@ module BUS_Con (
|
||||
assign o_addr = addr_out;
|
||||
assign o_data = data_out;
|
||||
assign o_wr = wr_out;
|
||||
assign o_cmd_vaild = cmd_valid_out;
|
||||
assign o_cmd_valid = cmd_valid_out;
|
||||
assign o_err = err_flag;
|
||||
assign o_wready = (state == IDLE);
|
||||
|
||||
// Pass through unused signal or hook it up if needed
|
||||
assign o_rvaild = 1'b0;
|
||||
assign o_rvalid = i_rvalid;
|
||||
|
||||
endmodule
|
||||
@@ -104,6 +104,10 @@ module CPLD_Con (
|
||||
exec_flag <= 1'b0;
|
||||
exec_done_flag <= 1'b1;
|
||||
freq_slot_flag <= 'd0;
|
||||
PMU_OC_1 <= 'd0;
|
||||
PMU_OC_2 <= 'd0;
|
||||
PMU_OC_3 <= 'd0;
|
||||
PMU_OC_4 <= 'd0;
|
||||
dc_slot_flag<='d0;
|
||||
err_flag <= 'd0;
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<BaliProject version="3.2" title="NewExtIns_CPLD2" device="LCMXO2-7000HC-4FG484C" default_implementation="impl1">
|
||||
<Options/>
|
||||
<Implementation title="impl1" dir="impl1" description="impl1" synthesis="synplify" default_strategy="Strategy1">
|
||||
<Options def_top="CPLD_Con" top="RelayConTop"/>
|
||||
<Options def_top="RelayConTop" top="RelayConTop"/>
|
||||
<Source name="RelayConTop.v" type="Verilog" type_short="Verilog">
|
||||
<Options top_module="RelayConTop"/>
|
||||
</Source>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
rvl_alias "i_sys_clk" "i_sys_clk";
|
||||
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
||||
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
||||
RVL_ALIAS "i_sys_clk" "i_sys_clk";
|
||||
|
||||
@@ -8,7 +8,7 @@ module RelayConTop (
|
||||
output o_miso,
|
||||
output o_rvalid,
|
||||
input i_rready,
|
||||
input i_wvaild,
|
||||
input i_wvalid,
|
||||
output o_wready,
|
||||
output o_err,
|
||||
output [7:0]o_RC_F, //Ref: Schematic
|
||||
@@ -61,20 +61,20 @@ module RelayConTop (
|
||||
|
||||
wire con_done;
|
||||
|
||||
BUS_Con BUS_Con_2(
|
||||
BUS_Con BUS_Con_2(
|
||||
.i_sys_clk(i_sys_clk),
|
||||
.i_rst_n(i_rst_n),
|
||||
.i_sclk(i_sclk),
|
||||
.i_mosi(i_mosi),
|
||||
.i_cs(i_cs),
|
||||
.i_rvaild(con_rvaild),
|
||||
.i_wvaild(i_wvaild),
|
||||
.i_rvalid(con_rvalid),
|
||||
.i_wvalid(i_wvalid),
|
||||
.i_reg_busy(reg_busy),
|
||||
.i_rdata(r_data),
|
||||
.o_cmd_vaild(cmd_valid),
|
||||
.o_cmd_valid(cmd_valid),
|
||||
.o_wr(wr_flag),
|
||||
.o_miso(o_miso),
|
||||
.o_rvaild(o_rvalid),
|
||||
.o_miso(o_miso),
|
||||
.o_rvalid(o_rvalid),
|
||||
.o_wready(o_wready),
|
||||
.o_data(w_data),
|
||||
.o_addr(reg_addr),
|
||||
@@ -161,7 +161,7 @@ module RelayConTop (
|
||||
assign o_PMU_OC_4[31:25] = PMU_OC_4[31:25];
|
||||
|
||||
|
||||
assign o_err = bus_err_flag || reg_err_flag;
|
||||
assign o_err = bus_err_flag || reg_err_flag || cpld_err_flag;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
Reference in New Issue
Block a user