CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 01:25:27 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=cb60df982e3593138d8446eb87c04778f0ee66cccc54eb90783413e12eeb459ba%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%220wWYT7FR_CRcp2dzL4-akGujsGh4L2Ip%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d2cda95859c469-BLR
module viterbi_tx_rx_tb(); reg clk; reg rst; reg encoder_i; reg - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module viterbi_tx_rx_tb();
- reg clk;
- reg rst;
- reg encoder_i;
- reg enable_encoder_i;
- wire decoder_o;
- wire [1:0] encoder_o;
- reg [1:0] corrupted_encoder_o; // To hold the corrupted encoded output
- reg [1:0] encoder_o_reg;
- reg enable_decoder_in;
- integer error_counter = 0; // To count the number of errors introduced
- integer corrected_counter = 0; // To count the number of errors corrected
- // Instantiate the DUT (Device Under Test)
- viterbi_tx_rx vtr(
- .clk(clk),
- .rst(rst),
- .encoder_i(encoder_i),
- .enable_encoder_i(enable_encoder_i),
- .decoder_o(decoder_o)
- );
- // Generate a clock signal
- always
- #50 clk = ~clk;
- // Testbench stimulus
- initial begin
- clk = 1'b1;
- rst = 1'b0;
- encoder_i = 1'b0;
- enable_encoder_i = 1'b0;
- corrupted_encoder_o = 2'b00; // Initialize the corrupted encoded output
- // Reset the system
- #1000 rst = 1'b1;
- enable_encoder_i = 1'b1;
- // Input sequence for the encoder
- #100 encoder_i = 1'b1;
- #100 encoder_i = 1'b0;
- #100 encoder_i = 1'b1;
- #100 encoder_i = 1'b1;
- #100 encoder_i = 1'b0;
- #100 encoder_i = 1'b1;
- // Stop the simulation after enough time
- #1000000 $finish;
- end
- // Simulate errors in the encoded output
- always @(posedge clk) begin
- if (rst && enable_encoder_i) begin
- // Capture the encoder output
- encoder_o_reg <= vtr.encoder_o;
- // Introduce an error in the encoder output every few cycles
- if (error_counter % 10 == 0) begin
- // Flip one bit to introduce an error
- corrupted_encoder_o = {~encoder_o_reg[1], encoder_o_reg[0]};
- error_counter = error_counter + 1;
- end else begin
- corrupted_encoder_o = encoder_o_reg; // No error
- end
- // Enable the decoder after capturing the encoded data
- enable_decoder_in <= vtr.valid_encoder_o;
- end
- end
- // Monitor the decoder output and compare it with the original input
- always @(posedge clk) begin
- if (rst && enable_decoder_in) begin
- // Check if the decoder output matches the original input
- if (decoder_o != encoder_i) begin
- corrected_counter = corrected_counter + 1;
- end
- end
- end
- // Display the number of errors introduced and corrected
- initial begin
- $monitor("Time: %0t | Encoder Input: %b | Corrupted Encoder Output: %b | Decoder Output: %b | Errors Introduced: %d | Errors Corrected: %d",
- $time, encoder_i, corrupted_encoder_o, decoder_o, error_counter, corrected_counter);
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
-
π Swapzone +37% glitch β W
JavaScript | 1 sec ago | 0.25 KB
-
π Exchange profit method
JavaScript | 4 sec ago | 0.24 KB
-
β
β Make huge profits on trading ββ P
JavaScript | 10 sec ago | 0.25 KB
-
β Free Crypto Method β
JavaScript | 14 sec ago | 0.24 KB
-
ββ
Marketplace Glitch β
Working β
NEVER SEEN...
JavaScript | 18 sec ago | 0.25 KB
-
π Crypto Swap Glitch β
Working
JavaScript | 24 sec ago | 0.24 KB
-
ββ
Exploit 2500$ in 15 Minutesβββ E
JavaScript | 28 sec ago | 0.25 KB
-
π EASY MONEY GUIDE β
Working
JavaScript | 33 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand