mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 02:27:26 -07:00
style of .v files
This commit is contained in:
parent
4c9b95c216
commit
cb439ef58b
24 changed files with 1257 additions and 1257 deletions
|
@ -20,16 +20,16 @@
|
|||
|
||||
module lf_edge_detect_tb;
|
||||
|
||||
integer fin, fout_state, fout_toggle;
|
||||
integer fout_high, fout_highz, fout_lowz, fout_low, fout_min, fout_max;
|
||||
integer r;
|
||||
integer fin, fout_state, fout_toggle;
|
||||
integer fout_high, fout_highz, fout_lowz, fout_low, fout_min, fout_max;
|
||||
integer r;
|
||||
|
||||
reg clk = 0;
|
||||
reg [7:0] adc_d;
|
||||
wire adc_clk;
|
||||
wire data_rdy;
|
||||
wire edge_state;
|
||||
wire edge_toggle;
|
||||
reg clk = 0;
|
||||
reg [7:0] adc_d;
|
||||
wire adc_clk;
|
||||
wire data_rdy;
|
||||
wire edge_state;
|
||||
wire edge_toggle;
|
||||
|
||||
wire [7:0] high_threshold;
|
||||
wire [7:0] highz_threshold;
|
||||
|
@ -38,74 +38,74 @@ module lf_edge_detect_tb;
|
|||
wire [7:0] max;
|
||||
wire [7:0] min;
|
||||
|
||||
initial
|
||||
begin
|
||||
clk = 0;
|
||||
fin = $fopen(`FIN, "r");
|
||||
if (!fin) begin
|
||||
$display("ERROR: can't open the data file");
|
||||
$finish;
|
||||
end
|
||||
fout_min = $fopen(`FOUT_MIN, "w+");
|
||||
fout_max = $fopen(`FOUT_MAX, "w+");
|
||||
fout_state = $fopen(`FOUT_STATE, "w+");
|
||||
fout_toggle = $fopen(`FOUT_TOGGLE, "w+");
|
||||
fout_high = $fopen(`FOUT_HIGH, "w+");
|
||||
fout_highz = $fopen(`FOUT_HIGHZ, "w+");
|
||||
fout_lowz = $fopen(`FOUT_LOWZ, "w+");
|
||||
fout_low = $fopen(`FOUT_LOW, "w+");
|
||||
if (!$feof(fin))
|
||||
adc_d = $fgetc(fin); // read the first value
|
||||
end
|
||||
initial
|
||||
begin
|
||||
clk = 0;
|
||||
fin = $fopen(`FIN, "r");
|
||||
if (!fin) begin
|
||||
$display("ERROR: can't open the data file");
|
||||
$finish;
|
||||
end
|
||||
fout_min = $fopen(`FOUT_MIN, "w+");
|
||||
fout_max = $fopen(`FOUT_MAX, "w+");
|
||||
fout_state = $fopen(`FOUT_STATE, "w+");
|
||||
fout_toggle = $fopen(`FOUT_TOGGLE, "w+");
|
||||
fout_high = $fopen(`FOUT_HIGH, "w+");
|
||||
fout_highz = $fopen(`FOUT_HIGHZ, "w+");
|
||||
fout_lowz = $fopen(`FOUT_LOWZ, "w+");
|
||||
fout_low = $fopen(`FOUT_LOW, "w+");
|
||||
if (!$feof(fin))
|
||||
adc_d = $fgetc(fin); // read the first value
|
||||
end
|
||||
|
||||
always
|
||||
# 1 clk = !clk;
|
||||
always
|
||||
# 1 clk = !clk;
|
||||
|
||||
// input
|
||||
initial
|
||||
begin
|
||||
while (!$feof(fin)) begin
|
||||
@(negedge clk) adc_d <= $fgetc(fin);
|
||||
end
|
||||
// input
|
||||
initial
|
||||
begin
|
||||
while (!$feof(fin)) begin
|
||||
@(negedge clk) adc_d <= $fgetc(fin);
|
||||
end
|
||||
|
||||
if ($feof(fin))
|
||||
begin
|
||||
# 3 $fclose(fin);
|
||||
$fclose(fout_state);
|
||||
$fclose(fout_toggle);
|
||||
$fclose(fout_high);
|
||||
$fclose(fout_highz);
|
||||
$fclose(fout_lowz);
|
||||
$fclose(fout_low);
|
||||
$fclose(fout_min);
|
||||
$fclose(fout_max);
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
if ($feof(fin))
|
||||
begin
|
||||
# 3 $fclose(fin);
|
||||
$fclose(fout_state);
|
||||
$fclose(fout_toggle);
|
||||
$fclose(fout_high);
|
||||
$fclose(fout_highz);
|
||||
$fclose(fout_lowz);
|
||||
$fclose(fout_low);
|
||||
$fclose(fout_min);
|
||||
$fclose(fout_max);
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
|
||||
initial
|
||||
begin
|
||||
// $monitor("%d\t S: %b, E: %b", $time, edge_state, edge_toggle);
|
||||
end
|
||||
initial
|
||||
begin
|
||||
// $monitor("%d\t S: %b, E: %b", $time, edge_state, edge_toggle);
|
||||
end
|
||||
|
||||
// output
|
||||
always @(negedge clk)
|
||||
if ($time > 2) begin
|
||||
r = $fputc(min, fout_min);
|
||||
r = $fputc(max, fout_max);
|
||||
r = $fputc(edge_state, fout_state);
|
||||
r = $fputc(edge_toggle, fout_toggle);
|
||||
r = $fputc(high_threshold, fout_high);
|
||||
r = $fputc(highz_threshold, fout_highz);
|
||||
r = $fputc(lowz_threshold, fout_lowz);
|
||||
r = $fputc(low_threshold, fout_low);
|
||||
end
|
||||
// output
|
||||
always @(negedge clk)
|
||||
if ($time > 2) begin
|
||||
r = $fputc(min, fout_min);
|
||||
r = $fputc(max, fout_max);
|
||||
r = $fputc(edge_state, fout_state);
|
||||
r = $fputc(edge_toggle, fout_toggle);
|
||||
r = $fputc(high_threshold, fout_high);
|
||||
r = $fputc(highz_threshold, fout_highz);
|
||||
r = $fputc(lowz_threshold, fout_lowz);
|
||||
r = $fputc(low_threshold, fout_low);
|
||||
end
|
||||
|
||||
// module to test
|
||||
lf_edge_detect detect(clk, adc_d, 8'd127,
|
||||
max, min,
|
||||
high_threshold, highz_threshold,
|
||||
lowz_threshold, low_threshold,
|
||||
edge_state, edge_toggle);
|
||||
// module to test
|
||||
lf_edge_detect detect(clk, adc_d, 8'd127,
|
||||
max, min,
|
||||
high_threshold, highz_threshold,
|
||||
lowz_threshold, low_threshold,
|
||||
edge_state, edge_toggle);
|
||||
|
||||
endmodule
|
||||
endmodule
|
||||
|
|
|
@ -13,43 +13,43 @@
|
|||
|
||||
module lp20khz_1MSa_iir_filter_tb;
|
||||
|
||||
integer fin, fout, r;
|
||||
integer fin, fout, r;
|
||||
|
||||
reg clk;
|
||||
reg [7:0] adc_d;
|
||||
wire data_rdy;
|
||||
wire [7:0] adc_filtered;
|
||||
reg clk;
|
||||
reg [7:0] adc_d;
|
||||
wire data_rdy;
|
||||
wire [7:0] adc_filtered;
|
||||
|
||||
initial
|
||||
begin
|
||||
clk = 0;
|
||||
fin = $fopen(`FIN, "r");
|
||||
if (!fin) begin
|
||||
$display("ERROR: can't open the data file");
|
||||
$finish;
|
||||
end
|
||||
fout = $fopen(`FOUT, "w+");
|
||||
if (!$feof(fin))
|
||||
adc_d = $fgetc(fin); // read the first value
|
||||
end
|
||||
initial
|
||||
begin
|
||||
clk = 0;
|
||||
fin = $fopen(`FIN, "r");
|
||||
if (!fin) begin
|
||||
$display("ERROR: can't open the data file");
|
||||
$finish;
|
||||
end
|
||||
fout = $fopen(`FOUT, "w+");
|
||||
if (!$feof(fin))
|
||||
adc_d = $fgetc(fin); // read the first value
|
||||
end
|
||||
|
||||
always
|
||||
# 1 clk = !clk;
|
||||
always
|
||||
# 1 clk = !clk;
|
||||
|
||||
always @(posedge clk)
|
||||
if (data_rdy) begin
|
||||
if ($time > 1)
|
||||
r = $fputc(adc_filtered, fout);
|
||||
if (!$feof(fin))
|
||||
adc_d <= $fgetc(fin);
|
||||
else begin
|
||||
$fclose(fin);
|
||||
$fclose(fout);
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
always @(posedge clk)
|
||||
if (data_rdy) begin
|
||||
if ($time > 1)
|
||||
r = $fputc(adc_filtered, fout);
|
||||
if (!$feof(fin))
|
||||
adc_d <= $fgetc(fin);
|
||||
else begin
|
||||
$fclose(fin);
|
||||
$fclose(fout);
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
|
||||
// module to test
|
||||
lp20khz_1MSa_iir_filter filter(clk, adc_d, data_rdy, adc_filtered);
|
||||
// module to test
|
||||
lp20khz_1MSa_iir_filter filter(clk, adc_d, data_rdy, adc_filtered);
|
||||
|
||||
endmodule
|
||||
|
|
|
@ -14,61 +14,61 @@
|
|||
|
||||
module min_max_tracker_tb;
|
||||
|
||||
integer fin;
|
||||
integer fout_min, fout_max;
|
||||
integer r;
|
||||
integer fin;
|
||||
integer fout_min, fout_max;
|
||||
integer r;
|
||||
|
||||
reg clk;
|
||||
reg [7:0] adc_d;
|
||||
wire [7:0] min;
|
||||
wire [7:0] max;
|
||||
reg clk;
|
||||
reg [7:0] adc_d;
|
||||
wire [7:0] min;
|
||||
wire [7:0] max;
|
||||
|
||||
initial
|
||||
begin
|
||||
clk = 0;
|
||||
fin = $fopen(`FIN, "r");
|
||||
if (!fin) begin
|
||||
$display("ERROR: can't open the data file");
|
||||
$finish;
|
||||
end
|
||||
fout_min = $fopen(`FOUT_MIN, "w+");
|
||||
fout_max = $fopen(`FOUT_MAX, "w+");
|
||||
if (!$feof(fin))
|
||||
adc_d = $fgetc(fin); // read the first value
|
||||
end
|
||||
initial
|
||||
begin
|
||||
clk = 0;
|
||||
fin = $fopen(`FIN, "r");
|
||||
if (!fin) begin
|
||||
$display("ERROR: can't open the data file");
|
||||
$finish;
|
||||
end
|
||||
fout_min = $fopen(`FOUT_MIN, "w+");
|
||||
fout_max = $fopen(`FOUT_MAX, "w+");
|
||||
if (!$feof(fin))
|
||||
adc_d = $fgetc(fin); // read the first value
|
||||
end
|
||||
|
||||
always
|
||||
# 1 clk = !clk;
|
||||
always
|
||||
# 1 clk = !clk;
|
||||
|
||||
// input
|
||||
initial
|
||||
begin
|
||||
while (!$feof(fin)) begin
|
||||
@(negedge clk) adc_d <= $fgetc(fin);
|
||||
end
|
||||
// input
|
||||
initial
|
||||
begin
|
||||
while (!$feof(fin)) begin
|
||||
@(negedge clk) adc_d <= $fgetc(fin);
|
||||
end
|
||||
|
||||
if ($feof(fin))
|
||||
begin
|
||||
# 3 $fclose(fin);
|
||||
$fclose(fout_min);
|
||||
$fclose(fout_max);
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
if ($feof(fin))
|
||||
begin
|
||||
# 3 $fclose(fin);
|
||||
$fclose(fout_min);
|
||||
$fclose(fout_max);
|
||||
$finish;
|
||||
end
|
||||
end
|
||||
|
||||
initial
|
||||
begin
|
||||
// $monitor("%d\t min: %x, max: %x", $time, min, max);
|
||||
end
|
||||
initial
|
||||
begin
|
||||
// $monitor("%d\t min: %x, max: %x", $time, min, max);
|
||||
end
|
||||
|
||||
// output
|
||||
always @(negedge clk)
|
||||
if ($time > 2) begin
|
||||
r = $fputc(min, fout_min);
|
||||
r = $fputc(max, fout_max);
|
||||
end
|
||||
// output
|
||||
always @(negedge clk)
|
||||
if ($time > 2) begin
|
||||
r = $fputc(min, fout_min);
|
||||
r = $fputc(max, fout_max);
|
||||
end
|
||||
|
||||
// module to test
|
||||
min_max_tracker tracker(clk, adc_d, 8'd127, min, max);
|
||||
// module to test
|
||||
min_max_tracker tracker(clk, adc_d, 8'd127, min, max);
|
||||
|
||||
endmodule
|
||||
endmodule
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue