Skip to content

Commit

Permalink
fix tb_nonperiodiccounter
Browse files Browse the repository at this point in the history
  • Loading branch information
fhaus1 committed Dec 6, 2024
1 parent 4fd777b commit 5d77ef0
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ sources:
- hw/newusb_regs/newusb_reg_pkg.sv
- hw/newusb_regs/newusb_reg_top.sv
- hw/newusb/new_usb_ohci_pkg.sv
- hw/newusb/new_usb_nonperiodiccounter.sv
- hw/newusb/new_usb_ohci.sv
- hw/cheshire_pkg.sv
- hw/cheshire_soc.sv
Expand Down
7 changes: 4 additions & 3 deletions hw/newusb/new_usb_nonperiodiccounter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module new_usb_nonperiodiccounter (

logic [1:0] count;
logic restart_counter;
logic en_i;

counter #(.WIDTH(2), .STICKY_OVERFLOW(1'b1)) i_counter (
.clk_i,
Expand All @@ -36,7 +37,7 @@ module new_usb_nonperiodiccounter (
.overflow_o(counter_overflown_o)
);

Check warning on line 39 in hw/newusb/new_usb_nonperiodiccounter.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/newusb/new_usb_nonperiodiccounter.sv#L39

Remove trailing spaces. [Style: trailing-spaces] [no-trailing-spaces]
Raw output
message:"Remove trailing spaces. [Style: trailing-spaces] [no-trailing-spaces]" location:{path:"hw/newusb/new_usb_nonperiodiccounter.sv" range:{start:{line:39 column:1}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"} suggestions:{range:{start:{line:39 column:1} end:{line:40}} text:"\n"}
assign counter_is_threshold_i = (count == 2'b00);
assign counter_is_threshold_o = (count == 2'b00);

// create enable, one pulse for one count
logic served_control_td_prev;
Expand All @@ -47,7 +48,7 @@ module new_usb_nonperiodiccounter (
logic served_bulk_td_prev;
logic reloadcbsr;
`FF(served_bulk_td_prev, served_bulk_td_i, 1'b0)
restart_counter = served_bulk_td_i && ~served_bulk_td_prev;
assign reload_cbsr = (restart_counter || !rst_ni);
assign restart_counter = served_bulk_td_i && ~served_bulk_td_prev;
assign reload_cbsr = (restart_counter || ~rst_ni);

endmodule

Check warning on line 54 in hw/newusb/new_usb_nonperiodiccounter.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/newusb/new_usb_nonperiodiccounter.sv#L54

File must end with a newline. [Style: posix-file-endings] [posix-eof]
Raw output
message:"File must end with a newline. [Style: posix-file-endings] [posix-eof]" location:{path:"hw/newusb/new_usb_nonperiodiccounter.sv" range:{start:{line:54 column:10}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"} suggestions:{range:{start:{line:54 column:10} end:{line:55}} text:"endmodule\n"}
13 changes: 13 additions & 0 deletions hw/newusb_tb/tb_new_usb_nonperiodiccounter.sv
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,17 @@ initial begin
rst_ni = 1;
end

logic overflow;
logic threshold;

new_usb_nonperiodiccounter i_nonperiodiccounter (
.clk_i,
.rst_ni,
.served_bulk_td_i(1'b0), // successfully served bulk transfer descriptor
.served_control_td_i(1'b1), // successfully served control transfer descriptor
.cbsr_i(2'b11),
.counter_overflown_o(overflow), // enough control EDs served
.counter_is_threshold_o(threshold) // signals last control ED to send for listservice
);

endmodule
2 changes: 2 additions & 0 deletions target/sim/vsim/start.newusb_nonperiodiccounter.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ set NumericStdNoWarnings 1
eval vsim -c ${TESTBENCH} -t 1ps -vopt -voptargs="+acc"
add wave -position insertpoint sim:/tb_new_usb_nonperiodiccounter/clk_i
add wave -position insertpoint sim:/tb_new_usb_nonperiodiccounter/rst_ni
add wave -position insertpoint sim:/tb_new_usb_nonperiodiccounter/overflow
add wave -position insertpoint sim:/tb_new_usb_nonperiodiccounter/threshold

run 1us

0 comments on commit 5d77ef0

Please sign in to comment.