updates for v1.1.0 which includes bls12-381 co processor first cut
This commit is contained in:
parent
d1ab35d9cd
commit
ae2f524c6b
|
@ -0,0 +1,4 @@
|
||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Ignore everything in this directory
|
||||||
|
*
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
|
@ -19,7 +19,7 @@ package require tar
|
||||||
set TOP top_sp
|
set TOP top_sp
|
||||||
|
|
||||||
## Replace with the name of your module
|
## Replace with the name of your module
|
||||||
set CL_MODULE cl_hello_world
|
set CL_MODULE cl_zcash
|
||||||
|
|
||||||
#################################################
|
#################################################
|
||||||
## Command-line Arguments
|
## Command-line Arguments
|
||||||
|
@ -39,7 +39,7 @@ set uram_option [lindex $argv 11]
|
||||||
set notify_via_sns [lindex $argv 12]
|
set notify_via_sns [lindex $argv 12]
|
||||||
set VDEFINES [lindex $argv 13]
|
set VDEFINES [lindex $argv 13]
|
||||||
##################################################
|
##################################################
|
||||||
## Flow control variables
|
## Flow control variables
|
||||||
##################################################
|
##################################################
|
||||||
set cl.synth 1
|
set cl.synth 1
|
||||||
set implement 1
|
set implement 1
|
||||||
|
@ -148,7 +148,7 @@ if {[string compare $notify_via_sns "1"] == 0} {
|
||||||
}
|
}
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
### Strategy options
|
### Strategy options
|
||||||
##################################################
|
##################################################
|
||||||
switch $strategy {
|
switch $strategy {
|
||||||
"BASIC" {
|
"BASIC" {
|
||||||
|
@ -187,14 +187,14 @@ source $HDK_SHELL_DIR/build/scripts/device_type.tcl
|
||||||
source $HDK_SHELL_DIR/build/scripts/step_user.tcl -notrace
|
source $HDK_SHELL_DIR/build/scripts/step_user.tcl -notrace
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
## Generate clocks based on Recipe
|
## Generate clocks based on Recipe
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
puts "AWS FPGA: ([clock format [clock seconds] -format %T]) Calling aws_gen_clk_constraints.tcl to generate clock constraints from developer's specified recipe.";
|
puts "AWS FPGA: ([clock format [clock seconds] -format %T]) Calling aws_gen_clk_constraints.tcl to generate clock constraints from developer's specified recipe.";
|
||||||
|
|
||||||
source $HDK_SHELL_DIR/build/scripts/aws_gen_clk_constraints.tcl
|
source $HDK_SHELL_DIR/build/scripts/aws_gen_clk_constraints.tcl
|
||||||
#################################################################
|
#################################################################
|
||||||
#### Do not remove this setting. Need to workaround bug
|
#### Do not remove this setting. Need to workaround bug
|
||||||
##################################################################
|
##################################################################
|
||||||
set_param hd.clockRoutingWireReduction false
|
set_param hd.clockRoutingWireReduction false
|
||||||
##################################################
|
##################################################
|
||||||
|
@ -236,7 +236,7 @@ if {$implement} {
|
||||||
# Apply Clock Properties for Clock Table Recipes
|
# Apply Clock Properties for Clock Table Recipes
|
||||||
##################################################
|
##################################################
|
||||||
puts "AWS FPGA: ([clock format [clock seconds] -format %T]) - Sourcing aws_clock_properties.tcl to apply properties to clocks. ";
|
puts "AWS FPGA: ([clock format [clock seconds] -format %T]) - Sourcing aws_clock_properties.tcl to apply properties to clocks. ";
|
||||||
|
|
||||||
# Apply properties to clocks
|
# Apply properties to clocks
|
||||||
source $HDK_SHELL_DIR/build/scripts/aws_clock_properties.tcl
|
source $HDK_SHELL_DIR/build/scripts/aws_clock_properties.tcl
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
# Add check if /build and /build/src_port_encryption directories exist
|
# Add check if /build and /build/src_port_encryption directories exist
|
||||||
# Add check if the vivado_keyfile exist
|
# Add check if the vivado_keyfile exist
|
||||||
|
|
||||||
|
set ZCASH_DIR $::env(ZCASH_DIR)
|
||||||
set HDK_SHELL_DIR $::env(HDK_SHELL_DIR)
|
set HDK_SHELL_DIR $::env(HDK_SHELL_DIR)
|
||||||
set HDK_SHELL_DESIGN_DIR $::env(HDK_SHELL_DESIGN_DIR)
|
set HDK_SHELL_DESIGN_DIR $::env(HDK_SHELL_DESIGN_DIR)
|
||||||
set CL_DIR $::env(CL_DIR)
|
set CL_DIR $::env(CL_DIR)
|
||||||
|
@ -30,16 +31,29 @@ if {[llength [glob -nocomplain -dir $TARGET_DIR *]] != 0} {
|
||||||
|
|
||||||
#---- Developr would replace this section with design files ----
|
#---- Developr would replace this section with design files ----
|
||||||
|
|
||||||
|
set fileName "${ZCASH_DIR}/zcash_fpga/src/rtl/top/include.f"
|
||||||
|
catch {set fptr [open $fileName r]} ;
|
||||||
|
set contents [read -nonewline $fptr] ;#Read the file contents
|
||||||
|
close $fptr ;#Close the file since it has been read now
|
||||||
|
set splitCont [split $contents "\n"] ;#Split the files contents on new line
|
||||||
|
foreach ele $splitCont {
|
||||||
|
set filep [subst $ele]
|
||||||
|
if { [file exists $filep] } {
|
||||||
|
file copy -force $filep $TARGET_DIR
|
||||||
|
puts "Copied $filep into $TARGET_DIR"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
## Change file names and paths below to reflect your CL area. DO NOT include AWS RTL files.
|
## Change file names and paths below to reflect your CL area. DO NOT include AWS RTL files.
|
||||||
file copy -force $CL_DIR/design/cl_hello_world_defines.vh $TARGET_DIR
|
file copy -force $CL_DIR/design/cl_zcash_defines.vh $TARGET_DIR
|
||||||
file copy -force $CL_DIR/design/cl_id_defines.vh $TARGET_DIR
|
file copy -force $CL_DIR/design/cl_id_defines.vh $TARGET_DIR
|
||||||
file copy -force $CL_DIR/design/cl_hello_world.sv $TARGET_DIR
|
file copy -force $CL_DIR/design/cl_zcash.sv $TARGET_DIR
|
||||||
file copy -force $CL_DIR/../common/design/cl_common_defines.vh $TARGET_DIR
|
file copy -force $CL_DIR/design/cl_zcash_aws_wrapper.sv $TARGET_DIR
|
||||||
|
file copy -force $CL_DIR/../common/design/cl_common_defines.vh $TARGET_DIR
|
||||||
file copy -force $UNUSED_TEMPLATES_DIR/unused_apppf_irq_template.inc $TARGET_DIR
|
file copy -force $UNUSED_TEMPLATES_DIR/unused_apppf_irq_template.inc $TARGET_DIR
|
||||||
file copy -force $UNUSED_TEMPLATES_DIR/unused_cl_sda_template.inc $TARGET_DIR
|
file copy -force $UNUSED_TEMPLATES_DIR/unused_cl_sda_template.inc $TARGET_DIR
|
||||||
file copy -force $UNUSED_TEMPLATES_DIR/unused_ddr_a_b_d_template.inc $TARGET_DIR
|
file copy -force $UNUSED_TEMPLATES_DIR/unused_ddr_a_b_d_template.inc $TARGET_DIR
|
||||||
file copy -force $UNUSED_TEMPLATES_DIR/unused_ddr_c_template.inc $TARGET_DIR
|
file copy -force $UNUSED_TEMPLATES_DIR/unused_ddr_c_template.inc $TARGET_DIR
|
||||||
file copy -force $UNUSED_TEMPLATES_DIR/unused_dma_pcis_template.inc $TARGET_DIR
|
|
||||||
file copy -force $UNUSED_TEMPLATES_DIR/unused_pcim_template.inc $TARGET_DIR
|
file copy -force $UNUSED_TEMPLATES_DIR/unused_pcim_template.inc $TARGET_DIR
|
||||||
file copy -force $UNUSED_TEMPLATES_DIR/unused_sh_bar1_template.inc $TARGET_DIR
|
file copy -force $UNUSED_TEMPLATES_DIR/unused_sh_bar1_template.inc $TARGET_DIR
|
||||||
file copy -force $UNUSED_TEMPLATES_DIR/unused_flr_template.inc $TARGET_DIR
|
file copy -force $UNUSED_TEMPLATES_DIR/unused_flr_template.inc $TARGET_DIR
|
||||||
|
|
|
@ -21,7 +21,7 @@ set VDEFINES $VDEFINES
|
||||||
create_project -in_memory -part [DEVICE_TYPE] -force
|
create_project -in_memory -part [DEVICE_TYPE] -force
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
## Generate clocks based on Recipe
|
## Generate clocks based on Recipe
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
puts "AWS FPGA: ([clock format [clock seconds] -format %T]) Calling aws_gen_clk_constraints.tcl to generate clock constraints from developer's specified recipe.";
|
puts "AWS FPGA: ([clock format [clock seconds] -format %T]) Calling aws_gen_clk_constraints.tcl to generate clock constraints from developer's specified recipe.";
|
||||||
|
@ -60,6 +60,26 @@ read_verilog -sv [ list \
|
||||||
|
|
||||||
puts "AWS FPGA: Reading IP blocks";
|
puts "AWS FPGA: Reading IP blocks";
|
||||||
|
|
||||||
|
# User IP
|
||||||
|
read_ip [ list \
|
||||||
|
$CL_DIR/ip/axis_dwidth_converter_64_to_8/axis_dwidth_converter_64_to_8.xci \
|
||||||
|
$CL_DIR/ip/axis_dwidth_converter_8_to_64/axis_dwidth_converter_8_to_64.xci \
|
||||||
|
$CL_DIR/ip/axis_dwidth_converter_48_to_8/axis_dwidth_converter_48_to_8.xci \
|
||||||
|
$CL_DIR/ip/axi_fifo_mm_s_0/axi_fifo_mm_s_0.xci
|
||||||
|
]
|
||||||
|
|
||||||
|
puts "AWS FPGA: Generating IP blocks";
|
||||||
|
|
||||||
|
set_property generate_synth_checkpoint false [get_files axis_dwidth_converter_64_to_8.xci]
|
||||||
|
set_property generate_synth_checkpoint false [get_files axis_dwidth_converter_8_to_64.xci]
|
||||||
|
set_property generate_synth_checkpoint false [get_files axis_dwidth_converter_48_to_8.xci]
|
||||||
|
set_property generate_synth_checkpoint false [get_files axi_fifo_mm_s_0.xci]
|
||||||
|
|
||||||
|
generate_target all [get_ips axis_dwidth_converter_64_to_8]
|
||||||
|
generate_target all [get_ips axis_dwidth_converter_8_to_64]
|
||||||
|
generate_target all [get_ips axis_dwidth_converter_48_to_8]
|
||||||
|
generate_target all [get_ips axi_fifo_mm_s_0]
|
||||||
|
|
||||||
#Read IP for axi register slices
|
#Read IP for axi register slices
|
||||||
read_ip [ list \
|
read_ip [ list \
|
||||||
$HDK_SHELL_DESIGN_DIR/ip/src_register_slice/src_register_slice.xci \
|
$HDK_SHELL_DESIGN_DIR/ip/src_register_slice/src_register_slice.xci \
|
||||||
|
@ -111,8 +131,8 @@ eval [concat synth_design -top $CL_MODULE -verilog_define XSDB_SLV_DIS $VDEFINES
|
||||||
|
|
||||||
set failval [catch {exec grep "FAIL" failfast.csv}]
|
set failval [catch {exec grep "FAIL" failfast.csv}]
|
||||||
if { $failval==0 } {
|
if { $failval==0 } {
|
||||||
puts "AWS FPGA: FATAL ERROR--Resource utilization error; check failfast.csv for details"
|
puts "AWS FPGA: FATAL ERROR--Resource utilization error; check failfast.csv for details"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
puts "AWS FPGA: ([clock format [clock seconds] -format %T]) writing post synth checkpoint.";
|
puts "AWS FPGA: ([clock format [clock seconds] -format %T]) writing post synth checkpoint.";
|
|
@ -37,6 +37,8 @@ if_axi_stream #(.DAT_BYTS(64), .CTL_BITS(1)) rx_aws_if (i_clk);
|
||||||
if_axi_stream #(.DAT_BYTS(64), .CTL_BITS(1)) tx_aws_if (i_clk);
|
if_axi_stream #(.DAT_BYTS(64), .CTL_BITS(1)) tx_aws_if (i_clk);
|
||||||
|
|
||||||
logic [7:0] rx_zcash_if_keep, tx_zcash_if_keep;
|
logic [7:0] rx_zcash_if_keep, tx_zcash_if_keep;
|
||||||
|
logic [63:0] rx_aws_if_keep, tx_aws_if_keep;
|
||||||
|
|
||||||
|
|
||||||
always_comb begin
|
always_comb begin
|
||||||
rx_zcash_if_keep = rx_zcash_if.get_keep_from_mod();
|
rx_zcash_if_keep = rx_zcash_if.get_keep_from_mod();
|
||||||
|
@ -147,7 +149,7 @@ axis_dwidth_converter_8_to_64 converter_8_to_64 (
|
||||||
.m_axis_tready( tx_aws_if.rdy ),
|
.m_axis_tready( tx_aws_if.rdy ),
|
||||||
.m_axis_tdata ( tx_aws_if.dat ),
|
.m_axis_tdata ( tx_aws_if.dat ),
|
||||||
.m_axis_tlast ( tx_aws_if.eop ),
|
.m_axis_tlast ( tx_aws_if.eop ),
|
||||||
.m_axis_tkeep ( tx_aws_if.mod )
|
.m_axis_tkeep ( tx_aws_if_keep )
|
||||||
);
|
);
|
||||||
|
|
||||||
// Convert 64 bytes to 8 bytes
|
// Convert 64 bytes to 8 bytes
|
||||||
|
@ -158,7 +160,7 @@ axis_dwidth_converter_64_to_8 converter_64_to_8 (
|
||||||
.s_axis_tready( rx_aws_if.rdy ),
|
.s_axis_tready( rx_aws_if.rdy ),
|
||||||
.s_axis_tdata ( rx_aws_if.dat ),
|
.s_axis_tdata ( rx_aws_if.dat ),
|
||||||
.s_axis_tlast ( rx_aws_if.eop ),
|
.s_axis_tlast ( rx_aws_if.eop ),
|
||||||
.s_axis_tkeep ( rx_aws_if.mod ),
|
.s_axis_tkeep ( rx_aws_if_keep ),
|
||||||
.m_axis_tvalid( tx_zcash_if.val ),
|
.m_axis_tvalid( tx_zcash_if.val ),
|
||||||
.m_axis_tready( tx_zcash_if.rdy ),
|
.m_axis_tready( tx_zcash_if.rdy ),
|
||||||
.m_axis_tdata ( tx_zcash_if.dat ),
|
.m_axis_tdata ( tx_zcash_if.dat ),
|
||||||
|
@ -228,22 +230,22 @@ axi_fifo_mm_s_0 axi_fifo_mm_s_0 (
|
||||||
.s_axi4_rready ( rx_axi4_if.rready ),
|
.s_axi4_rready ( rx_axi4_if.rready ),
|
||||||
|
|
||||||
.mm2s_prmry_reset_out_n(),
|
.mm2s_prmry_reset_out_n(),
|
||||||
.axi_str_txd_tvalid ( rx_aws_if.val ),
|
.axi_str_txd_tvalid ( rx_aws_if.val ),
|
||||||
.axi_str_txd_tready ( rx_aws_if.rdy ),
|
.axi_str_txd_tready ( rx_aws_if.rdy ),
|
||||||
.axi_str_txd_tlast ( rx_aws_if.eop ),
|
.axi_str_txd_tlast ( rx_aws_if.eop ),
|
||||||
.axi_str_txd_tkeep ( rx_aws_if.mod ),
|
.axi_str_txd_tkeep ( rx_aws_if_keep ),
|
||||||
.axi_str_txd_tdata ( rx_aws_if.dat ),
|
.axi_str_txd_tdata ( rx_aws_if.dat ),
|
||||||
|
|
||||||
.s2mm_prmry_reset_out_n(),
|
.s2mm_prmry_reset_out_n(),
|
||||||
.axi_str_rxd_tvalid( tx_aws_if.val ),
|
.axi_str_rxd_tvalid( tx_aws_if.val ),
|
||||||
.axi_str_rxd_tready( tx_aws_if.rdy ),
|
.axi_str_rxd_tready( tx_aws_if.rdy ),
|
||||||
.axi_str_rxd_tlast ( tx_aws_if.eop ),
|
.axi_str_rxd_tlast ( tx_aws_if.eop ),
|
||||||
.axi_str_rxd_tkeep ( tx_aws_if.mod ),
|
.axi_str_rxd_tkeep ( tx_aws_if_keep ),
|
||||||
.axi_str_rxd_tdata ( tx_aws_if.dat )
|
.axi_str_rxd_tdata ( tx_aws_if.dat )
|
||||||
);
|
);
|
||||||
|
|
||||||
always_comb begin
|
always_comb begin
|
||||||
rx_axi4_if.rid = 0;
|
rx_axi4_if.rid = 0;
|
||||||
end
|
end
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
add_wave /tb/card/fpga/CL/*pcis*
|
add_wave /tb/card/fpga/CL/*pcis*
|
||||||
add_wave /tb/card/fpga/CL/rx_axi_lite_if/*
|
add_wave /tb/card/fpga/CL/rx_axi_lite_if/*
|
||||||
add_wave /tb/card/fpga/CL/rx_axi4_if/*
|
add_wave /tb/card/fpga/CL/rx_axi4_if/*
|
||||||
add_wave /tb/card/fpga/CL/zcash_axi_lite_if/*
|
add_wave /tb/card/fpga/CL/zcash_axi_lite_if/*
|
||||||
add_wave /tb/card/fpga/CL/zcash_if_tx/*
|
add_wave /tb/card/fpga/CL/zcash_if_tx/*
|
||||||
add_wave /tb/card/fpga/CL/zcash_if_rx/*
|
add_wave /tb/card/fpga/CL/zcash_if_rx/*
|
||||||
add_wave /tb/card/fpga/CL/cl_zcash_aws_wrapper/*
|
add_wave /tb/card/fpga/CL/cl_zcash_aws_wrapper/*
|
||||||
|
|
||||||
run 10 us
|
run 110 us
|
||||||
|
|
|
@ -80,13 +80,16 @@ endtask
|
||||||
task write_stream(input logic [1024*8-1:0] data, input integer len);
|
task write_stream(input logic [1024*8-1:0] data, input integer len);
|
||||||
|
|
||||||
logic [31:0] rdata;
|
logic [31:0] rdata;
|
||||||
|
logic [63:0] strb;
|
||||||
integer len_;
|
integer len_;
|
||||||
len_ = len;
|
len_ = len;
|
||||||
read_ocl_reg(.addr(`AXI_FIFO_OFFSET+32'hC), .rdata(rdata));
|
read_ocl_reg(.addr(`AXI_FIFO_OFFSET+32'hC), .rdata(rdata));
|
||||||
if (len > rdata) $fatal(1, "ERROR: write_pcis::AXI-FIFO does not have enough space to write %d bytes (%d free)", len, rdata);
|
if (len > rdata) $fatal(1, "ERROR: write_pcis::AXI-FIFO does not have enough space to write %d bytes (%d free)", len, rdata);
|
||||||
|
|
||||||
while(len_ > 0) begin
|
while(len_ > 0) begin
|
||||||
tb.poke_pcis(.addr(0), .data(data[511:0]), .strb(0));
|
strb = 0;
|
||||||
|
for(int i = 0; i < 64; i++) if(len_ > i) strb[i] = 1;
|
||||||
|
tb.poke_pcis(.addr(0), .data(data[511:0]), .strb(strb));
|
||||||
len_ = len_ - 512/8;
|
len_ = len_ - 512/8;
|
||||||
data = data >> 512;
|
data = data >> 512;
|
||||||
end
|
end
|
||||||
|
@ -94,9 +97,10 @@ task write_stream(input logic [1024*8-1:0] data, input integer len);
|
||||||
|
|
||||||
$display ("INFO: write_pcis::Wrote %d bytes of data", len);
|
$display ("INFO: write_pcis::Wrote %d bytes of data", len);
|
||||||
|
|
||||||
// Check transmit complete bit and reset it
|
// Wait a few clocks then check transmit complete bit and reset it
|
||||||
|
repeat (10) @(posedge tb.card.fpga.clk_main_a0);
|
||||||
read_ocl_reg(.addr(`AXI_FIFO_OFFSET), .rdata(rdata));
|
read_ocl_reg(.addr(`AXI_FIFO_OFFSET), .rdata(rdata));
|
||||||
if(rdata[27] == 0) $display("WARNING: write_stream transmit complete bit not set");
|
if(rdata[27] == 0) $display("WARNING: write_stream transmit complete bit not set (read 0x%x)", rdata);
|
||||||
write_ocl_reg(.addr(`AXI_FIFO_OFFSET), .data(32'h08000000));
|
write_ocl_reg(.addr(`AXI_FIFO_OFFSET), .data(32'h08000000));
|
||||||
|
|
||||||
endtask
|
endtask
|
||||||
|
@ -141,7 +145,7 @@ task test_status_message();
|
||||||
while(stream_len == 0) read_stream(.data(stream_data), .len(stream_len));
|
while(stream_len == 0) read_stream(.data(stream_data), .len(stream_len));
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
while(10000) @(posedge tb.card.fpga.clk_main_a0);
|
repeat(10000) @(posedge tb.card.fpga.clk_main_a0);
|
||||||
$fatal(1, "ERROR: No reply received from status_request");
|
$fatal(1, "ERROR: No reply received from status_request");
|
||||||
end
|
end
|
||||||
join_any
|
join_any
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
This performs point multiplication. We use the standard double
|
This performs point multiplication. We use the standard double
|
||||||
and add algorithm.
|
and add algorithm.
|
||||||
|
|
||||||
Same as ec_point_mult but also has additional input for adding points
|
Same as ec_point_mult but also has additional input for adding points
|
||||||
which is needed in secp256k1 key verification.
|
which is needed in secp256k1 key verification.
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ module secp256k1_point_mult
|
||||||
input i_p2_val
|
input i_p2_val
|
||||||
);
|
);
|
||||||
|
|
||||||
|
localparam CHK_INPUT = 0;
|
||||||
|
|
||||||
// [0] is connection from/to dbl block, [1] is add block, [2] is arbitrated value
|
// [0] is connection from/to dbl block, [1] is add block, [2] is arbitrated value
|
||||||
if_axi_stream #(.DAT_BYTS(256*2/8), .CTL_BITS(16)) mult_in_if [2:0] (i_clk);
|
if_axi_stream #(.DAT_BYTS(256*2/8), .CTL_BITS(16)) mult_in_if [2:0] (i_clk);
|
||||||
if_axi_stream #(.DAT_BYTS(256/8), .CTL_BITS(16)) mult_out_if [2:0] (i_clk);
|
if_axi_stream #(.DAT_BYTS(256/8), .CTL_BITS(16)) mult_out_if [2:0] (i_clk);
|
||||||
|
@ -104,7 +106,7 @@ always_ff @ (posedge i_clk) begin
|
||||||
p_q <= i_p2;
|
p_q <= i_p2;
|
||||||
state <= ADD_ONLY;
|
state <= ADD_ONLY;
|
||||||
// Check for special cases to determine double or add
|
// Check for special cases to determine double or add
|
||||||
if (i_p.x == i_p2.x && i_p.y == i_p2.y) begin
|
if (CHK_INPUT == 1 && i_p.x == i_p2.x && i_p.y == i_p2.y) begin
|
||||||
p_dbl_in_val <= 1;
|
p_dbl_in_val <= 1;
|
||||||
end else begin
|
end else begin
|
||||||
p_add_in_val <= 1;
|
p_add_in_val <= 1;
|
||||||
|
@ -127,7 +129,7 @@ always_ff @ (posedge i_clk) begin
|
||||||
p_dbl_in_val <= 1;
|
p_dbl_in_val <= 1;
|
||||||
lookahead_dbl <= 1;
|
lookahead_dbl <= 1;
|
||||||
p_dbl_out_rdy <= 0; // Want to make sure we don't output while still waiting for add
|
p_dbl_out_rdy <= 0; // Want to make sure we don't output while still waiting for add
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (p_add_out_val && p_add_out_rdy) begin
|
if (p_add_out_val && p_add_out_rdy) begin
|
||||||
p_add_done <= 1;
|
p_add_done <= 1;
|
||||||
|
@ -144,21 +146,21 @@ always_ff @ (posedge i_clk) begin
|
||||||
if (k_l[0]) begin
|
if (k_l[0]) begin
|
||||||
p_add_in_val <= 1;
|
p_add_in_val <= 1;
|
||||||
// Need to check for special case where the x, y point is the same
|
// Need to check for special case where the x, y point is the same
|
||||||
if (p_q.x == p_n.x && p_q.y == p_n.y) begin
|
if (CHK_INPUT == 1) begin
|
||||||
special_dbl <= 1;
|
if (p_q.x == p_n.x && p_q.y == p_n.y) begin
|
||||||
p_add_in_val <= 0;
|
special_dbl <= 1;
|
||||||
p_add_done <= 1;
|
p_add_in_val <= 0;
|
||||||
|
p_add_done <= 1;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end else begin
|
end else begin
|
||||||
p_add_done <= 1;
|
p_add_done <= 1;
|
||||||
end
|
end
|
||||||
|
|
||||||
// Don't need to double on the final bit
|
// Don't need to double on the final bit
|
||||||
if ((k_l >> 1) != 0)
|
if ((k_l >> 1) != 0)
|
||||||
p_dbl_in_val <= ~lookahead_dbl; // Don't do if we already started
|
p_dbl_in_val <= ~lookahead_dbl; // Don't do if we already started
|
||||||
else
|
else
|
||||||
p_dbl_done <= 1;
|
p_dbl_done <= 1;
|
||||||
|
|
||||||
if (k_l == 0) begin
|
if (k_l == 0) begin
|
||||||
state <= FINISHED;
|
state <= FINISHED;
|
||||||
o_p <= p_add;
|
o_p <= p_add;
|
||||||
|
@ -167,7 +169,6 @@ always_ff @ (posedge i_clk) begin
|
||||||
p_add_in_val <= 0;
|
p_add_in_val <= 0;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
{ADD_ONLY}: begin
|
{ADD_ONLY}: begin
|
||||||
p_dbl_in_val <= (p_dbl_in_val && p_dbl_in_rdy) ? 0 : p_dbl_in_val;
|
p_dbl_in_val <= (p_dbl_in_val && p_dbl_in_rdy) ? 0 : p_dbl_in_val;
|
||||||
|
@ -256,7 +257,7 @@ localparam ARB_BIT = 8;
|
||||||
resource_share # (
|
resource_share # (
|
||||||
.NUM_IN ( 2 ),
|
.NUM_IN ( 2 ),
|
||||||
.CTL_BITS ( 16 ),
|
.CTL_BITS ( 16 ),
|
||||||
.DAT_BITS ( 512 ),
|
.DAT_BITS ( 512 ),
|
||||||
.DAT_BYTS ( 512/8 ),
|
.DAT_BYTS ( 512/8 ),
|
||||||
.OVR_WRT_BIT ( ARB_BIT ),
|
.OVR_WRT_BIT ( ARB_BIT ),
|
||||||
.PIPELINE_IN ( 0 ),
|
.PIPELINE_IN ( 0 ),
|
||||||
|
@ -267,14 +268,14 @@ resource_share_add (
|
||||||
.i_rst ( i_rst ),
|
.i_rst ( i_rst ),
|
||||||
.i_axi ( add_in_if[1:0] ),
|
.i_axi ( add_in_if[1:0] ),
|
||||||
.o_res ( add_in_if[2] ),
|
.o_res ( add_in_if[2] ),
|
||||||
.i_res ( add_out_if[2] ),
|
.i_res ( add_out_if[2] ),
|
||||||
.o_axi ( add_out_if[1:0] )
|
.o_axi ( add_out_if[1:0] )
|
||||||
);
|
);
|
||||||
|
|
||||||
resource_share # (
|
resource_share # (
|
||||||
.NUM_IN ( 2 ),
|
.NUM_IN ( 2 ),
|
||||||
.CTL_BITS ( 16 ),
|
.CTL_BITS ( 16 ),
|
||||||
.DAT_BITS ( 512 ),
|
.DAT_BITS ( 512 ),
|
||||||
.DAT_BYTS ( 512/8 ),
|
.DAT_BYTS ( 512/8 ),
|
||||||
.OVR_WRT_BIT ( ARB_BIT ),
|
.OVR_WRT_BIT ( ARB_BIT ),
|
||||||
.PIPELINE_IN ( 0 ),
|
.PIPELINE_IN ( 0 ),
|
||||||
|
@ -285,14 +286,14 @@ resource_share_sub (
|
||||||
.i_rst ( i_rst ),
|
.i_rst ( i_rst ),
|
||||||
.i_axi ( sub_in_if[1:0] ),
|
.i_axi ( sub_in_if[1:0] ),
|
||||||
.o_res ( sub_in_if[2] ),
|
.o_res ( sub_in_if[2] ),
|
||||||
.i_res ( sub_out_if[2] ),
|
.i_res ( sub_out_if[2] ),
|
||||||
.o_axi ( sub_out_if[1:0] )
|
.o_axi ( sub_out_if[1:0] )
|
||||||
);
|
);
|
||||||
|
|
||||||
resource_share # (
|
resource_share # (
|
||||||
.NUM_IN ( 2 ),
|
.NUM_IN ( 2 ),
|
||||||
.CTL_BITS ( 16 ),
|
.CTL_BITS ( 16 ),
|
||||||
.DAT_BITS ( 512 ),
|
.DAT_BITS ( 512 ),
|
||||||
.DAT_BYTS ( 512/8 ),
|
.DAT_BYTS ( 512/8 ),
|
||||||
.OVR_WRT_BIT ( ARB_BIT ),
|
.OVR_WRT_BIT ( ARB_BIT ),
|
||||||
.PIPELINE_IN ( 0 ),
|
.PIPELINE_IN ( 0 ),
|
||||||
|
@ -303,7 +304,7 @@ resource_share_mult (
|
||||||
.i_rst ( i_rst ),
|
.i_rst ( i_rst ),
|
||||||
.i_axi ( mult_in_if[1:0] ),
|
.i_axi ( mult_in_if[1:0] ),
|
||||||
.o_res ( mult_in_if[2] ),
|
.o_res ( mult_in_if[2] ),
|
||||||
.i_res ( mult_out_if[2] ),
|
.i_res ( mult_out_if[2] ),
|
||||||
.o_axi ( mult_out_if[1:0] )
|
.o_axi ( mult_out_if[1:0] )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -354,7 +355,7 @@ generate
|
||||||
mult_out_if[2].ctl = i_mult_if.ctl;
|
mult_out_if[2].ctl = i_mult_if.ctl;
|
||||||
end
|
end
|
||||||
end else begin
|
end else begin
|
||||||
|
|
||||||
always_comb begin
|
always_comb begin
|
||||||
o_mult_if.reset_source();
|
o_mult_if.reset_source();
|
||||||
i_mult_if.rdy = 0;
|
i_mult_if.rdy = 0;
|
||||||
|
|
|
@ -24,17 +24,18 @@ package zcash_fpga_pkg;
|
||||||
import equihash_pkg::N;
|
import equihash_pkg::N;
|
||||||
import equihash_pkg::K;
|
import equihash_pkg::K;
|
||||||
import secp256k1_pkg::secp256k1_ver_t;
|
import secp256k1_pkg::secp256k1_ver_t;
|
||||||
|
|
||||||
import bls12_381_pkg::point_type_t;
|
import bls12_381_pkg::point_type_t;
|
||||||
|
|
||||||
parameter FPGA_VERSION = 32'h01_00_01; //v1.0.0
|
parameter FPGA_VERSION = 32'h01_01_00; //v1.1.0
|
||||||
|
|
||||||
// What features are enabled in this build
|
// What features are enabled in this build
|
||||||
parameter bit ENB_VERIFY_SECP256K1_SIG = 1;
|
parameter bit ENB_VERIFY_SECP256K1_SIG = 1;
|
||||||
parameter bit ENB_VERIFY_EQUIHASH = 1;
|
parameter bit ENB_VERIFY_EQUIHASH = 1;
|
||||||
parameter bit ENB_BLS12_381 = 1;
|
parameter bit ENB_BLS12_381 = 1;
|
||||||
|
|
||||||
localparam [63:0] FPGA_CMD_CAP = {{61'd0},
|
localparam [63:0] FPGA_CMD_CAP = {{60'd0},
|
||||||
|
ENB_BLS12_381,
|
||||||
ENB_VERIFY_SECP256K1_SIG,
|
ENB_VERIFY_SECP256K1_SIG,
|
||||||
(ENB_VERIFY_EQUIHASH && equihash_pkg::N == 144 && equihash_pkg::K == 5), // N = 144, K = 5 for VERIFY_EQUIHASH command
|
(ENB_VERIFY_EQUIHASH && equihash_pkg::N == 144 && equihash_pkg::K == 5), // N = 144, K = 5 for VERIFY_EQUIHASH command
|
||||||
(ENB_VERIFY_EQUIHASH && equihash_pkg::N == 200 && equihash_pkg::K == 9)}; // N = 200, K = 9 for VERIFY_EQUIHASH command
|
(ENB_VERIFY_EQUIHASH && equihash_pkg::N == 200 && equihash_pkg::K == 9)}; // N = 200, K = 9 for VERIFY_EQUIHASH command
|
||||||
|
|
Loading…
Reference in New Issue