Even Numbers Filter - Verilog Typing CST Test
Loading…
Even Numbers Filter — Verilog Code
Outputs even numbers from a fixed array.
module EvenNumbers(
output reg [31:0] evens [0:4]
);
reg [31:0] nums [0:9];
integer i, idx;
initial begin
nums = '{1,2,3,4,5,6,7,8,9,10};
end
always @(*) begin
idx = 0;
for(i=0;i<10;i=i+1) begin
if(nums[i] % 2 == 0) begin
evens[idx] = nums[i];
idx = idx + 1;
end
end
end
endmoduleVerilog Language Guide
Verilog is a hardware description language (HDL) used to model, simulate, and design digital circuits such as CPUs, FPGAs, ASICs, and SoCs. Known for its C-like syntax, simplicity, and dominance in commercial chip design.
Primary Use Cases
- ▸ASIC and SoC design
- ▸FPGA development
- ▸Digital logic design (ALUs, FSMs, DSP blocks)
- ▸Processor architecture modeling
- ▸Hardware simulation & verification
Notable Features
- ▸C-like syntax (begin/end, if, case)
- ▸Concurrent and procedural blocks
- ▸Gate-level, RTL, and behavioral modeling
- ▸Synthesizable hardware constructs
- ▸Rich simulation capabilities
Origin & Creator
Developed in 1984 by Phil Moorby at Gateway Design Automation; standardized as IEEE 1364.
Industrial Note
Verilog powers most commercial semiconductor chips - including CPUs, GPUs, networking ASICs, and FPGA IP cores.