|
@@ -102,22 +102,22 @@ module top (
|
|
|
wire write_flash;
|
|
|
|
|
|
// Buttons
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] inc_f1;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] dec_f1;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] inc_d1;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] dec_d1;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] inc_d2;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] dec_d2;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] inc_ph2;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] dec_ph2;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] inc_f3;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] dec_f3;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] inc_d3;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] dec_d3;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] inc_ph3;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] dec_ph3;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] inc_n3;
|
|
|
- wire [BUTTON_COUNTER_WIDTH-1:0] dec_n3;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] inc_f1;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] dec_f1;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] inc_d1;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] dec_d1;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] inc_d2;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] dec_d2;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] inc_ph2;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] dec_ph2;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] inc_f3;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] dec_f3;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] inc_d3;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] dec_d3;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] inc_ph3;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] dec_ph3;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] inc_n3;
|
|
|
+ reg [BUTTON_COUNTER_WIDTH-1:0] dec_n3;
|
|
|
|
|
|
// Mailbox signal wires
|
|
|
wire [16*16-1:0] mailbox_regs_flat; // Flattened register array (16 registers of 16 bits each)
|
|
@@ -220,7 +220,7 @@ module top (
|
|
|
|
|
|
// WB Register Mailbox [4]
|
|
|
// ----------
|
|
|
- mailbox_wb #(
|
|
|
+ mailbox_wb_sw2rtl #(
|
|
|
.AW(4),
|
|
|
.DW(WB_DW)
|
|
|
) mailbox_regs_I (
|
|
@@ -273,48 +273,44 @@ module top (
|
|
|
|
|
|
// WB Button Mailbox [5]
|
|
|
// ----------
|
|
|
- mailbox_wb #(
|
|
|
+ mailbox_wb_rtl2sw #(
|
|
|
.AW(4),
|
|
|
.DW(WB_DW)
|
|
|
) mailbox_btns_I (
|
|
|
.clk(clk_24m),
|
|
|
.rst(rst),
|
|
|
.wb_addr(wb_addr[3:0]),
|
|
|
- .wb_wdata(wb_wdata),
|
|
|
.wb_rdata(wb_rdata[5]),
|
|
|
- .wb_we(wb_we),
|
|
|
.wb_cyc(wb_cyc[5]),
|
|
|
.wb_ack(wb_ack[5]),
|
|
|
- .registers_flat(mailbox_btns_flat)
|
|
|
+ .registers_flat_in(mailbox_btns_flat)
|
|
|
);
|
|
|
|
|
|
|
|
|
// Buttons
|
|
|
- assign inc_f1 = mailbox_btns_flat[15:0];
|
|
|
- assign dec_f1 = mailbox_btns_flat[31:16];
|
|
|
- assign inc_d1 = mailbox_btns_flat[47:32];
|
|
|
- assign dec_d1 = mailbox_btns_flat[63:48];
|
|
|
- assign inc_d2 = mailbox_btns_flat[79:64];
|
|
|
- assign dec_d2 = mailbox_btns_flat[95:80];
|
|
|
- assign inc_ph2 = mailbox_btns_flat[111:96];
|
|
|
- assign dec_ph2 = mailbox_btns_flat[127:112];
|
|
|
- assign inc_f3 = mailbox_btns_flat[143:128];
|
|
|
- assign dec_f3 = mailbox_btns_flat[159:144];
|
|
|
- assign inc_d3 = mailbox_btns_flat[175:160];
|
|
|
- assign dec_d3 = mailbox_btns_flat[191:176];
|
|
|
- assign inc_ph3 = mailbox_btns_flat[207:192];
|
|
|
- assign dec_ph3 = mailbox_btns_flat[223:208];
|
|
|
- assign inc_n3 = mailbox_btns_flat[239:224];
|
|
|
- assign dec_n3 = mailbox_btns_flat[255:240];
|
|
|
-
|
|
|
- reg [31:0] pcount; //dummy variable + usage to make sure button will not be optimized out
|
|
|
+ assign mailbox_btns_flat[15:0] = inc_f1;
|
|
|
+ assign mailbox_btns_flat[31:16] = dec_f1;
|
|
|
+ assign mailbox_btns_flat[47:32] = inc_d1;
|
|
|
+ assign mailbox_btns_flat[63:48] = dec_d1;
|
|
|
+ assign mailbox_btns_flat[79:64] = inc_d2;
|
|
|
+ assign mailbox_btns_flat[95:80] = dec_d2;
|
|
|
+ assign mailbox_btns_flat[111:96] = inc_ph2;
|
|
|
+ assign mailbox_btns_flat[127:112] = dec_ph2;
|
|
|
+ assign mailbox_btns_flat[143:128] = inc_f3;
|
|
|
+ assign mailbox_btns_flat[159:144] = dec_f3;
|
|
|
+ assign mailbox_btns_flat[175:160] = inc_d3;
|
|
|
+ assign mailbox_btns_flat[191:176] = dec_d3;
|
|
|
+ assign mailbox_btns_flat[207:192] = inc_ph3;
|
|
|
+ assign mailbox_btns_flat[223:208] = dec_ph3;
|
|
|
+ assign mailbox_btns_flat[239:224] = inc_n3;
|
|
|
+ assign mailbox_btns_flat[255:240] = dec_n3;
|
|
|
|
|
|
button b1(
|
|
|
.clk(clk_24m),
|
|
|
.nrst(~rst),
|
|
|
.butt(btn_1),
|
|
|
|
|
|
- .press_count(pcount)
|
|
|
+ .press_count(inc_f1)
|
|
|
);
|
|
|
|
|
|
// TODO: dummy led onoff when value has been written
|
|
@@ -322,7 +318,7 @@ module top (
|
|
|
if (rst) begin
|
|
|
led[0] = 1'b0;
|
|
|
led[1] = 1'b0;
|
|
|
- led[2] = 1'b0 & pcount[25];
|
|
|
+ led[2] = 1'b0;
|
|
|
end else if (period1 == 1) begin
|
|
|
led[0] = 1'b1;
|
|
|
led[1] = 1'b0;
|
|
@@ -345,14 +341,14 @@ module top (
|
|
|
led[2] = 1'b0;
|
|
|
end
|
|
|
|
|
|
- always @(posedge clk_24m or posedge rst)
|
|
|
- if (rst) begin
|
|
|
- led[3] = 1'b0;
|
|
|
- end else if (btn_2) begin
|
|
|
- led[3] = 1'b1;
|
|
|
- end else begin
|
|
|
- led[3] = 1'b0;
|
|
|
- end
|
|
|
+ //always @(posedge clk_24m or posedge rst)
|
|
|
+ // if (rst) begin
|
|
|
+ // led[3] = 1'b0;
|
|
|
+ // end else if (btn_2) begin
|
|
|
+ // led[3] = 1'b1;
|
|
|
+ // end else begin
|
|
|
+ // led[3] = 1'b0;
|
|
|
+ // end
|
|
|
|
|
|
//// TODO: dummy driving from delay1
|
|
|
always @(posedge clk_24m or posedge rst)
|