|
@@ -50,7 +50,7 @@ module top (
|
|
);
|
|
);
|
|
|
|
|
|
localparam integer SPRAM_AW = 14; /* 14 => 64k, 15 => 128k */
|
|
localparam integer SPRAM_AW = 14; /* 14 => 64k, 15 => 128k */
|
|
- localparam integer WB_N = 5; // TODO: Reduce
|
|
|
|
|
|
+ localparam integer WB_N = 6;
|
|
|
|
|
|
localparam integer WB_DW = 32;
|
|
localparam integer WB_DW = 32;
|
|
localparam integer WB_AW = 16;
|
|
localparam integer WB_AW = 16;
|
|
@@ -61,6 +61,8 @@ module top (
|
|
localparam integer PULSE_COUNTER_WIDTH = 8;
|
|
localparam integer PULSE_COUNTER_WIDTH = 8;
|
|
localparam integer SLOW_PWM_WIDTH = 14;
|
|
localparam integer SLOW_PWM_WIDTH = 14;
|
|
|
|
|
|
|
|
+ localparam integer BUTTON_COUNTER_WIDTH = 5;
|
|
|
|
+
|
|
genvar i;
|
|
genvar i;
|
|
|
|
|
|
|
|
|
|
@@ -97,9 +99,29 @@ module top (
|
|
wire [PULSE_COUNTER_WIDTH-1:0] npuls3;
|
|
wire [PULSE_COUNTER_WIDTH-1:0] npuls3;
|
|
wire [1:0] odd_train_flag;
|
|
wire [1:0] odd_train_flag;
|
|
wire ena_odd_out3;
|
|
wire ena_odd_out3;
|
|
|
|
+ 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;
|
|
|
|
|
|
// Mailbox signal wires
|
|
// Mailbox signal wires
|
|
wire [16*16-1:0] mailbox_regs_flat; // Flattened register array (16 registers of 16 bits each)
|
|
wire [16*16-1:0] mailbox_regs_flat; // Flattened register array (16 registers of 16 bits each)
|
|
|
|
+ wire [16*16-1:0] mailbox_btns_flat;
|
|
|
|
|
|
// SoC
|
|
// SoC
|
|
// ---
|
|
// ---
|
|
@@ -196,12 +218,12 @@ module top (
|
|
.rst (rst)
|
|
.rst (rst)
|
|
);
|
|
);
|
|
|
|
|
|
- // WB Mailbox [4]
|
|
|
|
|
|
+ // WB Register Mailbox [4]
|
|
// ----------
|
|
// ----------
|
|
mailbox_wb #(
|
|
mailbox_wb #(
|
|
.AW(4),
|
|
.AW(4),
|
|
.DW(WB_DW)
|
|
.DW(WB_DW)
|
|
- ) mailbox_I (
|
|
|
|
|
|
+ ) mailbox_regs_I (
|
|
.clk(clk_24m),
|
|
.clk(clk_24m),
|
|
.rst(rst),
|
|
.rst(rst),
|
|
.wb_addr(wb_addr[3:0]),
|
|
.wb_addr(wb_addr[3:0]),
|
|
@@ -225,6 +247,7 @@ module top (
|
|
assign npuls3 = mailbox_regs_flat[127:112]; // Next 16 bits for npuls3
|
|
assign npuls3 = mailbox_regs_flat[127:112]; // Next 16 bits for npuls3
|
|
assign odd_train_flag = mailbox_regs_flat[143:128]; // Next 16 bits for odd_train_flag
|
|
assign odd_train_flag = mailbox_regs_flat[143:128]; // Next 16 bits for odd_train_flag
|
|
assign ena_odd_out3 = mailbox_regs_flat[159:144]; // Next 16 bits for ena_odd_out3
|
|
assign ena_odd_out3 = mailbox_regs_flat[159:144]; // Next 16 bits for ena_odd_out3
|
|
|
|
+ assign write_flash = mailbox_regs_flat[175:160]; // Next 16 bits for write_flash (triggered from keyboard)
|
|
|
|
|
|
three_signal #(
|
|
three_signal #(
|
|
.FAST_PWM_WIDTH(FAST_PWM_WIDTH),
|
|
.FAST_PWM_WIDTH(FAST_PWM_WIDTH),
|
|
@@ -248,6 +271,42 @@ module top (
|
|
.Out3(out3)
|
|
.Out3(out3)
|
|
);
|
|
);
|
|
|
|
|
|
|
|
+ // WB Button Mailbox [5]
|
|
|
|
+ // ----------
|
|
|
|
+ mailbox_wb #(
|
|
|
|
+ .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)
|
|
|
|
+ );
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 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
|
|
reg [31:0] pcount; //dummy variable + usage to make sure button will not be optimized out
|
|
|
|
|
|
button b1(
|
|
button b1(
|