1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-16 08:12:53 +08:00

Add enable signal

This commit is contained in:
Alex Forencich 2014-11-16 01:38:20 -08:00
parent 7c86999399
commit b123525597
20 changed files with 60 additions and 8 deletions

View File

@ -132,6 +132,7 @@ module {{name}} #
wire [{{n-1}}:0] request;
wire [{{n-1}}:0] acknowledge;
wire [{{n-1}}:0] grant;
wire grant_valid;
wire [{{w-1}}:0] grant_encoded;
{% for p in ports %}
assign acknowledge[{{p}}] = input_{{p}}_axis_tvalid & input_{{p}}_axis_tready & input_{{p}}_axis_tlast;
@ -157,6 +158,7 @@ mux_inst (
.output_axis_tready(output_axis_tready),
.output_axis_tlast(output_axis_tlast),
.output_axis_tuser(output_axis_tuser),
.enable(grant_valid),
.select(grant_encoded)
);
@ -172,6 +174,7 @@ arb_inst (
.request(request),
.acknowledge(acknowledge),
.grant(grant),
.grant_valid(grant_valid),
.grant_encoded(grant_encoded)
);

View File

@ -79,6 +79,7 @@ module axis_arb_mux_4 #
wire [3:0] request;
wire [3:0] acknowledge;
wire [3:0] grant;
wire grant_valid;
wire [1:0] grant_encoded;
assign acknowledge[0] = input_0_axis_tvalid & input_0_axis_tready & input_0_axis_tlast;
@ -122,6 +123,7 @@ mux_inst (
.output_axis_tready(output_axis_tready),
.output_axis_tlast(output_axis_tlast),
.output_axis_tuser(output_axis_tuser),
.enable(grant_valid),
.select(grant_encoded)
);
@ -137,6 +139,7 @@ arb_inst (
.request(request),
.acknowledge(acknowledge),
.grant(grant),
.grant_valid(grant_valid),
.grant_encoded(grant_encoded)
);

View File

@ -135,6 +135,7 @@ module {{name}} #
wire [{{n-1}}:0] request;
wire [{{n-1}}:0] acknowledge;
wire [{{n-1}}:0] grant;
wire grant_valid;
wire [{{w-1}}:0] grant_encoded;
{% for p in ports %}
assign acknowledge[{{p}}] = input_{{p}}_axis_tvalid & input_{{p}}_axis_tready & input_{{p}}_axis_tlast;
@ -162,6 +163,7 @@ mux_inst (
.output_axis_tready(output_axis_tready),
.output_axis_tlast(output_axis_tlast),
.output_axis_tuser(output_axis_tuser),
.enable(grant_valid),
.select(grant_encoded)
);
@ -177,6 +179,7 @@ arb_inst (
.request(request),
.acknowledge(acknowledge),
.grant(grant),
.grant_valid(grant_valid),
.grant_encoded(grant_encoded)
);

View File

@ -85,6 +85,7 @@ module axis_arb_mux_64_4 #
wire [3:0] request;
wire [3:0] acknowledge;
wire [3:0] grant;
wire grant_valid;
wire [1:0] grant_encoded;
assign acknowledge[0] = input_0_axis_tvalid & input_0_axis_tready & input_0_axis_tlast;
@ -133,6 +134,7 @@ mux_inst (
.output_axis_tready(output_axis_tready),
.output_axis_tlast(output_axis_tlast),
.output_axis_tuser(output_axis_tuser),
.enable(grant_valid),
.select(grant_encoded)
);
@ -148,6 +150,7 @@ arb_inst (
.request(request),
.acknowledge(acknowledge),
.grant(grant),
.grant_valid(grant_valid),
.grant_encoded(grant_encoded)
);

View File

@ -129,6 +129,7 @@ module {{name}} #
/*
* Control
*/
input wire enable,
input wire [{{w-1}}:0] select
);
@ -172,7 +173,7 @@ always @* begin
// end of frame detection
frame_next = ~input_axis_tlast;
end
end else if (input_axis_tvalid & ~current_output_tvalid) begin
end else if (enable & input_axis_tvalid & ~current_output_tvalid) begin
// start of frame, grab select value
frame_next = 1;
select_next = select;

View File

@ -76,6 +76,7 @@ module axis_demux_4 #
/*
* Control
*/
input wire enable,
input wire [1:0] select
);
@ -129,7 +130,7 @@ always @* begin
// end of frame detection
frame_next = ~input_axis_tlast;
end
end else if (input_axis_tvalid & ~current_output_tvalid) begin
end else if (enable & input_axis_tvalid & ~current_output_tvalid) begin
// start of frame, grab select value
frame_next = 1;
select_next = select;

View File

@ -132,6 +132,7 @@ module {{name}} #
/*
* Control
*/
input wire enable,
input wire [{{w-1}}:0] select
);
@ -176,7 +177,7 @@ always @* begin
// end of frame detection
frame_next = ~input_axis_tlast;
end
end else if (input_axis_tvalid & ~current_output_tvalid) begin
end else if (enable & input_axis_tvalid & ~current_output_tvalid) begin
// start of frame, grab select value
frame_next = 1;
select_next = select;

View File

@ -82,6 +82,7 @@ module axis_demux_64_4 #
/*
* Control
*/
input wire enable,
input wire [1:0] select
);
@ -136,7 +137,7 @@ always @* begin
// end of frame detection
frame_next = ~input_axis_tlast;
end
end else if (input_axis_tvalid & ~current_output_tvalid) begin
end else if (enable & input_axis_tvalid & ~current_output_tvalid) begin
// start of frame, grab select value
frame_next = 1;
select_next = select;

View File

@ -129,6 +129,7 @@ module {{name}} #
/*
* Control
*/
input wire enable,
input wire [{{w-1}}:0] select
);
@ -191,7 +192,7 @@ always @* begin
// end of frame detection
frame_next = ~current_input_tlast;
end
end else if (selected_input_tvalid) begin
end else if (enable & selected_input_tvalid) begin
// start of frame, grab select value
frame_next = 1;
select_next = select;

View File

@ -76,6 +76,7 @@ module axis_mux_4 #
/*
* Control
*/
input wire enable,
input wire [1:0] select
);
@ -164,7 +165,7 @@ always @* begin
// end of frame detection
frame_next = ~current_input_tlast;
end
end else if (selected_input_tvalid) begin
end else if (enable & selected_input_tvalid) begin
// start of frame, grab select value
frame_next = 1;
select_next = select;

View File

@ -132,6 +132,7 @@ module {{name}} #
/*
* Control
*/
input wire enable,
input wire [{{w-1}}:0] select
);
@ -197,7 +198,7 @@ always @* begin
// end of frame detection
frame_next = ~current_input_tlast;
end
end else if (selected_input_tvalid) begin
end else if (enable & selected_input_tvalid) begin
// start of frame, grab select value
frame_next = 1;
select_next = select;

View File

@ -82,6 +82,7 @@ module axis_mux_64_4 #
/*
* Control
*/
input wire enable,
input wire [1:0] select
);
@ -176,7 +177,7 @@ always @* begin
// end of frame detection
frame_next = ~current_input_tlast;
end
end else if (selected_input_tvalid) begin
end else if (enable & selected_input_tvalid) begin
// start of frame, grab select value
frame_next = 1;
select_next = select;

View File

@ -71,6 +71,7 @@ def dut_axis_demux_4(clk,
output_3_axis_tlast,
output_3_axis_tuser,
enable,
select):
if os.system(build_cmd):
@ -107,6 +108,7 @@ def dut_axis_demux_4(clk,
output_3_axis_tlast=output_3_axis_tlast,
output_3_axis_tuser=output_3_axis_tuser,
enable=enable,
select=select)
def bench():
@ -126,6 +128,7 @@ def bench():
output_2_axis_tready = Signal(bool(0))
output_3_axis_tready = Signal(bool(0))
enable = Signal(bool(0))
select = Signal(intbv(0)[2:])
# Outputs
@ -247,6 +250,7 @@ def bench():
output_3_axis_tlast,
output_3_axis_tuser,
enable,
select)
@always(delay(4))
@ -265,6 +269,7 @@ def bench():
yield clk.posedge
yield clk.posedge
enable.next = True
yield clk.posedge
print("test 1: select port 0")

View File

@ -43,6 +43,7 @@ reg output_1_axis_tready = 0;
reg output_2_axis_tready = 0;
reg output_3_axis_tready = 0;
reg enable = 0;
reg [1:0] select = 0;
// Outputs
@ -78,6 +79,7 @@ initial begin
output_1_axis_tready,
output_2_axis_tready,
output_3_axis_tready,
enable,
select);
$to_myhdl(input_axis_tready,
output_0_axis_tdata,
@ -136,6 +138,7 @@ UUT (
.output_3_axis_tlast(output_3_axis_tlast),
.output_3_axis_tuser(output_3_axis_tuser),
// Control
.enable(enable),
.select(select)
);

View File

@ -76,6 +76,7 @@ def dut_axis_demux_64_4(clk,
output_3_axis_tlast,
output_3_axis_tuser,
enable,
select):
if os.system(build_cmd):
@ -117,6 +118,7 @@ def dut_axis_demux_64_4(clk,
output_3_axis_tlast=output_3_axis_tlast,
output_3_axis_tuser=output_3_axis_tuser,
enable=enable,
select=select)
def bench():
@ -137,6 +139,7 @@ def bench():
output_2_axis_tready = Signal(bool(0))
output_3_axis_tready = Signal(bool(0))
enable = Signal(bool(0))
select = Signal(intbv(0)[2:])
# Outputs
@ -272,6 +275,7 @@ def bench():
output_3_axis_tlast,
output_3_axis_tuser,
enable,
select)
@always(delay(4))
@ -290,6 +294,7 @@ def bench():
yield clk.posedge
yield clk.posedge
enable.next = True
yield clk.posedge
print("test 1: select port 0")

View File

@ -44,6 +44,7 @@ reg output_1_axis_tready = 0;
reg output_2_axis_tready = 0;
reg output_3_axis_tready = 0;
reg enable = 0;
reg [1:0] select = 0;
// Outputs
@ -84,6 +85,7 @@ initial begin
output_1_axis_tready,
output_2_axis_tready,
output_3_axis_tready,
enable,
select);
$to_myhdl(input_axis_tready,
output_0_axis_tdata,
@ -151,6 +153,7 @@ UUT (
.output_3_axis_tlast(output_3_axis_tlast),
.output_3_axis_tuser(output_3_axis_tuser),
// Control
.enable(enable),
.select(select)
);

View File

@ -71,6 +71,7 @@ def dut_axis_mux_4(clk,
output_axis_tlast,
output_axis_tuser,
enable,
select):
if os.system(build_cmd):
@ -107,6 +108,7 @@ def dut_axis_mux_4(clk,
output_axis_tlast=output_axis_tlast,
output_axis_tuser=output_axis_tuser,
enable=enable,
select=select)
def bench():
@ -135,6 +137,7 @@ def bench():
output_axis_tready = Signal(bool(0))
enable = Signal(bool(0))
select = Signal(intbv(0)[2:])
# Outputs
@ -244,6 +247,7 @@ def bench():
output_axis_tlast,
output_axis_tuser,
enable,
select)
@always(delay(4))
@ -262,6 +266,7 @@ def bench():
yield clk.posedge
yield clk.posedge
enable.next = True
yield clk.posedge
print("test 1: select port 0")

View File

@ -52,6 +52,7 @@ reg input_3_axis_tuser = 0;
reg output_axis_tready = 0;
reg enable = 0;
reg [1:0] select = 0;
// Outputs
@ -87,6 +88,7 @@ initial begin
input_3_axis_tlast,
input_3_axis_tuser,
output_axis_tready,
enable,
select);
$to_myhdl(input_0_axis_tready,
input_1_axis_tready,
@ -136,6 +138,7 @@ UUT (
.output_axis_tlast(output_axis_tlast),
.output_axis_tuser(output_axis_tuser),
// Control
.enable(enable),
.select(select)
);

View File

@ -76,6 +76,7 @@ def dut_axis_mux_64_4(clk,
output_axis_tlast,
output_axis_tuser,
enable,
select):
if os.system(build_cmd):
@ -117,6 +118,7 @@ def dut_axis_mux_64_4(clk,
output_axis_tlast=output_axis_tlast,
output_axis_tuser=output_axis_tuser,
enable=enable,
select=select)
def bench():
@ -149,6 +151,7 @@ def bench():
output_axis_tready = Signal(bool(0))
enable = Signal(bool(0))
select = Signal(intbv(0)[2:])
# Outputs
@ -269,6 +272,7 @@ def bench():
output_axis_tlast,
output_axis_tuser,
enable,
select)
@always(delay(4))
@ -287,6 +291,7 @@ def bench():
yield clk.posedge
yield clk.posedge
enable.next = True
yield clk.posedge
print("test 1: select port 0")

View File

@ -56,6 +56,7 @@ reg input_3_axis_tuser = 0;
reg output_axis_tready = 0;
reg enable = 0;
reg [1:0] select = 0;
// Outputs
@ -96,6 +97,7 @@ initial begin
input_3_axis_tlast,
input_3_axis_tuser,
output_axis_tready,
enable,
select);
$to_myhdl(input_0_axis_tready,
input_1_axis_tready,
@ -151,6 +153,7 @@ UUT (
.output_axis_tlast(output_axis_tlast),
.output_axis_tuser(output_axis_tuser),
// Control
.enable(enable),
.select(select)
);