Workspace with comment-preserving parser (vlog_parser), prettier-style document IR + formatting rules (vlog_formatter), and CLI (vfmt). Includes snapshot/idempotency tests and a TODO backlog of practices adopted from ruff and Verible. Co-Authored-By: Claude Fable 5 <[email protected]>
61 lines
1.2 KiB
Plaintext
61 lines
1.2 KiB
Plaintext
`include "defines.vh"
|
|
`define MAX_VAL 255
|
|
`default_nettype none
|
|
|
|
// Old-school Verilog-2001 module, non-ANSI ports
|
|
module legacy_dut (clk, rst, d, q, qb);
|
|
input clk; // clock
|
|
input rst;
|
|
input [7:0] d;
|
|
output reg [7:0] q;
|
|
output qb;
|
|
|
|
wire #5 delayed_net;
|
|
reg [3:0] mem [0:15]; // small memory
|
|
integer i;
|
|
|
|
assign #(2:3:4) qb = ~q[0];
|
|
assign delayed_net = d[0] & d[1], other = d[2] | d[3];
|
|
|
|
and g1 (n1, d[0], d[1]);
|
|
or #2 g2 (n2, n1, d[2]), g3 (n3, n2, d[3]);
|
|
|
|
defparam u_sub.WIDTH = 8, u_sub.DEPTH = 4;
|
|
|
|
always @(posedge clk or posedge rst)
|
|
if (rst) q <= 8'h00;
|
|
else q <= d;
|
|
|
|
initial begin : init_blk
|
|
for (i = 0; i < 16; i = i + 1) mem[i] = i[3:0];
|
|
#100;
|
|
@(posedge clk);
|
|
wait (rst == 0);
|
|
-> done_event;
|
|
fork
|
|
#10 $display("a");
|
|
#20 $display("b");
|
|
join
|
|
repeat (3) @(posedge clk);
|
|
do begin
|
|
i = i - 1;
|
|
end while (i > 0);
|
|
forever begin
|
|
#5 clk_int = ~clk_int;
|
|
if (stop) disable init_blk;
|
|
end
|
|
end
|
|
|
|
task automatic drive;
|
|
input [7:0] value;
|
|
output done;
|
|
begin
|
|
q = value;
|
|
done = 1'b1;
|
|
end
|
|
endtask
|
|
|
|
specparam_unused u_x (.a(a), .b());
|
|
endmodule
|
|
`default_nettype wire
|