Appendix 10
Appendix 10
// Noel's wires
wire [77:0] dout;
wire [3:0] rs232_state;
wire [1:0] shift_state, tx_control_state;
wire ready, send_block, done, send, enable;
// Ray's wires
wire [7:0] write_enables;
wire [9:0] gray_addra;
wire [23:0] vga_out;
wire [63:0] data_in;
// Analyzer inputs
///
always @(switch[2:0])
case (switch[2:0])
7: coef[12:0] = data_output[12:0];
6: coef[12:0] = data_output[25:13];
5: coef[12:0] = data_output[38:26];
4: coef[12:0] = data_output[51:39];
3: coef[12:0] = data_output[64:52];
2: coef[12:0] = data_output[77:65];
1: coef[12:0] = data_output[90:78];
0: coef[12:0] = data_output[103:91];
endcase // case(switch[2:0])
always @(switch[2:0])
case (switch[2:0])
0: analyzer_out[12:0] = data_output[12:0];
1: analyzer_out[12:0] = data_output[25:13];
2: analyzer_out[12:0] = data_output[38:26];
3: analyzer_out[12:0] = data_output[51:39];
4: analyzer_out[12:0] = data_output[64:52];
5: analyzer_out[12:0] = data_output[77:65];
6: analyzer_out[12:0] = data_output[90:78];
7: analyzer_out[12:0] = data_output[103:91];
endcase // case(switch[2:0])
always @(switch[2:0])
case (switch[2:0])
0: mult_out[12:0] = mult_column[12:0];
1: mult_out[12:0] = mult_column[25:13];
2: mult_out[12:0] = mult_column[38:26];
3: mult_out[12:0] = mult_column[51:39];
4: mult_out[12:0] = mult_column[64:52];
5: mult_out[12:0] = mult_column[77:65];
6: mult_out[12:0] = mult_column[90:78];
7: mult_out[12:0] = mult_column[103:91];
endcase // case(switch[2:0])
always @(switch[2:0])
case (switch[2:0])
0: sr_out[17:0] = shift_reg_output[17:0];
1: sr_out[17:0] = shift_reg_output[35:18];
2: sr_out[17:0] = shift_reg_output[53:36];
3: sr_out[17:0] = shift_reg_output[71:54];
4: sr_out[17:0] = shift_reg_output[89:72];
5: sr_out[17:0] = shift_reg_output[107:90];
6: sr_out[17:0] = shift_reg_output[125:108];
7: sr_out[17:0] = shift_reg_output[143:126];
endcase // case(switch[2:0])
always @(switch[2:0])
case (switch[2:0])
0: row_out[7:0] = row[7:0];
1: row_out[7:0] = row[15:8];
2: row_out[7:0] = row[23:16];
3: row_out[7:0] = row[31:24];
4: row_out[7:0] = row[39:32];
5: row_out[7:0] = row[47:40];
6: row_out[7:0] = row[55:48];
7: row_out[7:0] = row[63:56];
endcase // case(switch[1:0])
always @(switch[2:0])
case (switch[2:0])
0: data_in_out[7:0] = data_in[7:0];
1: data_in_out[7:0] = data_in[15:8];
2: data_in_out[7:0] = data_in[23:16];
3: data_in_out[7:0] = data_in[31:24];
4: data_in_out[7:0] = data_in[39:32];
5: data_in_out[7:0] = data_in[47:40];
6: data_in_out[7:0] = data_in[55:48];
7: data_in_out[7:0] = data_in[63:56];
endcase // case(switch[1:0])
video_capture VIDCAP01(
.clock_27mhz(clock_27mhz),
.tv_in_line_clock1(tv_in_line_clock1),
.reset_button(button1),
.encoder_busy(encode_busy),
.tv_in_ycrcb(tv_in_ycrcb),
.vga_out_sync_b(vga_out_sync_b),
.vga_out_blank_b(vga_out_blank_b),
.vga_out_hsync(vga_out_hsync),
.vga_out_vsync(vga_out_vsync),
.vga_out(vga_out),
.macro_line(line_active),
.write_enables(write_enables),
.data_in(data_in),
.gray_addra(gray_addra),
.tv_in_reset_b(tv_in_reset_b),
.tv_in_i2c_clock(tv_in_i2c_clock),
.tv_in_i2c_data(tv_in_i2c_data)
);
video_memory VIDMEM001(
.wr_clk(tv_in_line_clock1),
.addra(gray_addra),
.dina(data_in),
.write_enables(write_enables),
.r_clk(clock_27mhz),
.line_read(line_read),
.block_read(block_read),
.inter_row_cnt(inter_row_cnt),
.addrb(),
.output_row(row)
);
encoder ENCODER01(
.clk(clock_27mhz),
.reset(reset),
.resolution_select(resolution_select),
.max_lines(max_lines),
.max_blocks(max_blocks),
.line_active(line_active),
.row(row_in),
.encode_busy(encode_busy),
.transmit_busy(transmit_busy),
.inter_row_cnt(inter_row_cnt),
.block_read(block_read),
.line_read(line_read),
.data_output(data_output),
.write_address(write_address),
.wen(wen),
.mult_column(mult_column),
.column_select(),
.output_select(output_select),
.stage1_output(stage1_output),
.shift_reg_output(shift_reg_output)
);
wireless_memory WIREMEM001 (
.wr_clk(clock_27mhz),
.wr_addr(write_address),
.din(data_output[77:0]),
.wen(wen),
.r_clk(clock_27mhz),
.read_addr(read_addr),
.dout(dout)
);
alphanumeric_displays ALPHA1(
.global_clock(clock_27mhz),
.manual_reset(reset),
.disp_test(1'b0),
.disp_blank(disp_blank),
.disp_clock(disp_clock),
.disp_rs(disp_rs),
.disp_ce_b(disp_ce_b),
.disp_reset_b(disp_reset_b),
.disp_data_out(disp_data_out),
.dots(dots)
);
tx_control_unit tx_control(.clk(clock_27mhz),
.reset(reset),
.cts_b(rs232_cts),
.read_data(dout),
.encode_wr_addr(write_address),
.rts_b(rs232_rts),
.txd(rs232_txd),
.read_addr(read_addr),
.tx_busy(transmit_busy),
.rs232_state(rs232_state),
.state(tx_control_state),
.shift_once(shift_once),
.ready(ready),
.enable(enable));
toplevel_test top(.clk(clock_27mhz),
.reset(reset),
.cts_b(rs232_cts),
.txd(rs232_txd),
.rts_b(rs232_rts));
endmodule // labkit
module video_capture(clock_27mh
,
z tv_in_line_clock1, reset_button, encoder_busy,
sync,
tv_in_ycrcb, vga_out_sync_b, vga_out_blank_b, vga_out_h
vga_out_vsync, vga_out, macro_line, write_enables, data_in,
gray_addra, tv_in_reset_b, tv_in_i2c_clock, tv_in_i2c_data);
input clock_27mh
,
z tv_in_line_clock1, reset_button, encoder_busy;
input [19:0] tv_in_ycrcb;
sync, vga_out_vsync;
output vga_out_sync_b, vga_out_blank_b, vga_out_h
output [23:0] vga_out;
output [4:0] macro_line;
output [63:0] data_in;
output [7:0] write_enables;
output [9:0] gray_addra;
output tv_in_reset_b, tv_in_i2c_clock, tv_in_i2c_data;
// Instantiate A
G
V Controller
A_controller
G
V Controller(clock_27mh
,
z reset_sync, sync,
h vsync, pixel_count,
line_count, vga_out_sync_b, vga_out_blank_b, b
hlank, vblank, dout);
// Instantiate delay
delay sync_delay(clock_27mh
,
z sync,
h vsync, vga_out_h
sync, vga_out_vsync);
// Instantiate display
wire [23:0] RG
B_out;
display top_display(clock_27mh
,
z R, ,
G B, pixel_count,
B_out);
line_count, doutb, addrb, vga_out, RG
// Top Level
wire [9:0] ;
Y
wire data_valid;
wire [7:0] _
Yout;
wire encoder_busy;
wire [4:0] macro_line;
test pleasework(tv_in_line_clock1, clock_27mh
,
z clock_27mh
,
z reset_sync,
tv_in_ycrcb, R, ,
G B, dout, doutb, addrb, start, line_count_sync, write,
addra,
pixel_count, line_count, RG
B_out, ,
Y data_valid, _out,
Y encoder_busy,
macro_line,
write_enables, data_in, gray_addra);
adv7185init ADV
(reset_sync, clock_27mh
,
z source, tv_in_reset_b,
tv_in_i2c_clock, tv_in_i2c_data);
endmodule
module display(clk, R, G, B, pixel_count, line_count, doutb, addrb, vga_out,
RGB_out);
input clk;
input [7:0] R, G, B;
input [9:0] pixel_count, line_count;
input [23:0] doutb;
input [23:0] RGB_out;
output [23:0] vga_out;
output [15:0] addrb;
endmodule
// witch
S ebounce
D odule
M
// use your system clock for the clock input
// to produce a synchronous, debounced output
module debounce (reset, clock, noisy, clean);
parameter Y
A
L
E
D = 270000; // 01
. sec with a 27Mhz clock
input reset, clock, noisy;
output clean;
endmodule
module VG
A_controller(clk, reset, hsync, vsync, pixel_count, line_count,
vga_out_sync_b, vga_out_blank_b, hblank, vblank, dout);
input clk, reset;
input [38
:0] dout;
output [9:0] line_count;
output [9:0] pixel_count;
output hsync, vsync, vga_out_sync_b, vga_out_blank_b, hblank, vblank;
endmodule
//
// File: video_decoder.v
// Date: 31-Oct-05
// Author: J. Castro (MIT 6.111, fall 2005)
//
// This file contains the ntsc_decode and adv7185init modules
//
// These modules are used to grab input NTSC video data from the RCA
// phono jack on the right hand side of the 6.111 labkit (connect
// the camera to the LOWER jack).
//
/////////////////////////////////////////////////////////////////////////////
//
// NTSC decode - 16-bit CCIR656 decoder
// By Javier Castro
// This module takes a stream of LLC data from the adv7185
// NTSC/PAL video decoder and generates the corresponding pixels,
// that are encoded within the stream, in YCrCb format.
// Make sure that the adv7185 is set to run in 16-bit LLC2 mode.
// clk - line-locked clock (in this case, LLC1 which runs at 27Mhz)
// reset - system reset
// tv_in_ycrcb - 10-bit input from chip. should map to pins [19:10]
// ycrcb - 24 bit luminance and chrominance (8 bits each)
// f - field: 1 indicates an even field, 0 an odd field
// v - vertical sync: 1 means vertical sync
// h - horizontal sync: 1 means horizontal sync
input clk;
input reset;
input [9:0] tv_in_ycrcb; // modified for 10 bit input - should be P[19:10]
output [29:0] ycrcb;
output f;
output v;
output h;
output data_valid;
output [4:0] current_state;
// output [4:0] state;
parameter SYNC_1 = 0;
parameter SYNC_2 = 1;
parameter SYNC_3 = 2;
parameter SAV_f1_cb0 = 3;
parameter SAV_f1_y0 = 4;
parameter SAV_f1_cr1 = 5;
parameter SAV_f1_y1 = 6;
parameter EAV_f1 = 7;
parameter SAV_VBI_f1 = 8;
parameter EAV_VBI_f1 = 9;
parameter SAV_f2_cb0 = 10;
parameter SAV_f2_y0 = 11;
parameter SAV_f2_cr1 = 12;
parameter SAV_f2_y1 = 13;
parameter EAV_f2 = 14;
parameter SAV_VBI_f2 = 15;
parameter EAV_VBI_f2 = 16;
end
else
begin
// these states don't do much except allow us to know where we are in
the stream.
// whenever the synchronization code is seen, go back to the
sync_state before
// transitioning to the new state
case (current_state)
SYNC_1: current_state <= (tv_in_ycrcb == 10'h000) ? SYNC_2 :
SYNC_1;
SYNC_2: current_state <= (tv_in_ycrcb == 10'h000) ? SYNC_3 :
SYNC_1;
SYNC_3: current_state <= (tv_in_ycrcb == 10'h200) ? SAV_f1_cb0 :
(tv_in_ycrcb == 10'h274) ? EAV_f1 :
(tv_in_ycrcb == 10'h2ac) ? SAV_VBI_f1 :
(tv_in_ycrcb == 10'h2d8) ? EAV_VBI_f1 :
(tv_in_ycrcb == 10'h31c) ? SAV_f2_cb0 :
(tv_in_ycrcb == 10'h368) ? EAV_f2 :
(tv_in_ycrcb == 10'h3b0) ? SAV_VBI_f2 :
(tv_in_ycrcb == 10'h3c4) ? EAV_VBI_f2 : SYNC_1;
// These states are here in the event that we want to cover these
signals
// in the future. For now, they just send the state machine back to
SYNC_1
EAV_f1: current_state <= SYNC_1;
SAV_VBI_f1: current_state <= SYNC_1;
EAV_VBI_f1: current_state <= SYNC_1;
EAV_f2: current_state <= SYNC_1;
SAV_VBI_f2: current_state <= SYNC_1;
EAV_VBI_f2: current_state <= SYNC_1;
endcase
end
end // always @ (posedge clk)
wire y_enable;
wire cr_enable;
wire cb_enable;
reg f = 0;
endmodule
///////////////////////////////////////////////////////////////////////////////
//
// 6.111 FPGA Labkit -- ADV7185 Video Decoder Configuration Init
//
// Created:
// Author: Nathan Ickes
//
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 0
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 1
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 2
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 3
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 4
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 5
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 7
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 8
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 9
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register A
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register B
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register C
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register D
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register E
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register F
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Register 33
///////////////////////////////////////////////////////////////////////////////
input reset;
input clock_27mhz;
output tv_in_reset_b; // Reset signal to ADV7185
output tv_in_i2c_clock; // I2C clock output to ADV7185
output tv_in_i2c_data; // I2C data line to ADV7185
input source; // 0: composite, 1: s-video
initial begin
$display("ADV7185 Initialization values:");
$display(" Register 0: 0x%X", `ADV7185_REGISTER_0);
$display(" Register 1: 0x%X", `ADV7185_REGISTER_1);
$display(" Register 2: 0x%X", `ADV7185_REGISTER_2);
$display(" Register 3: 0x%X", `ADV7185_REGISTER_3);
$display(" Register 4: 0x%X", `ADV7185_REGISTER_4);
$display(" Register 5: 0x%X", `ADV7185_REGISTER_5);
$display(" Register 7: 0x%X", `ADV7185_REGISTER_7);
$display(" Register 8: 0x%X", `ADV7185_REGISTER_8);
$display(" Register 9: 0x%X", `ADV7185_REGISTER_9);
$display(" Register A: 0x%X", `ADV7185_REGISTER_A);
$display(" Register B: 0x%X", `ADV7185_REGISTER_B);
$display(" Register C: 0x%X", `ADV7185_REGISTER_C);
$display(" Register D: 0x%X", `ADV7185_REGISTER_D);
$display(" Register E: 0x%X", `ADV7185_REGISTER_E);
$display(" Register F: 0x%X", `ADV7185_REGISTER_F);
$display(" Register 33: 0x%X", `ADV7185_REGISTER_33);
end
//
// Generate a 1MHz for the I2C driver (resulting I2C clock rate is 250kHz)
//
reg [7:0] clk_div_count, reset_count;
reg clock_slow;
wire reset_slow;
initial
begin
clk_div_count <= 8'h00;
// synthesis attribute init of clk_div_count is "00";
clock_slow <= 1'b0;
// synthesis attribute init of clock_slow is "0";
end
//
// I2C driver
//
reg load;
reg [7:0] data;
wire ack, idle;
//
// State machine
//
8'h1A: begin
data <= 8'h8A;
load <= 1'b1;
if (ack)
state <= state+1;
end
8'h1B:
begin
data <= 8'h33;
if (ack)
state <= state+1;
end
8'h1C:
begin
load <= 1'b0;
if (idle)
state <= state+1;
end
8'h1D:
begin
load <= 1'b1;
data <= 8'h8B;
if (ack)
state <= state+1;
end
8'h1E:
begin
data <= 8'hFF;
if (ack)
state <= state+1;
end
8'h1F:
begin
load <= 1'b0;
if (idle)
state <= state+1;
end
8'h20:
begin
// Idle
if (old_source != source) state <= state+1;
old_source <= source;
end
8'h21: begin
// Send ADV7185 address
data <= 8'h8A;
load <= 1'b1;
if (ack) state <= state+1;
end
8'h22: begin
// Send subaddress of register 0
data <= 8'h00;
if (ack) state <= state+1;
end
8'h23: begin
// Write to register 0
data <= `ADV7185_REGISTER_0 | {5'h00, {3{source}}};
if (ack) state <= state+1;
end
8'h24: begin
// Wait for I2C transmitter to finish
load <= 1'b0;
if (idle) state <= 8'h20;
end
endcase
endmodule
module i2c (reset, clock4x, data, load, idle, ack, scl, sda);
input reset;
input clock4x;
input [7:0] data;
input load;
output ack;
output idle;
output scl;
output sda;
endmodule
module synchroniz
er(clk1, clk2, reset, tv_in_ycrcb, dout, write,
line_count_sync, pixel_count_sync,
ycrcb, data_valid, current_state, tv_in_sync, almost_empty);
input clk1, clk2, reset;
input [19:0] tv_in_ycrcb;
output [58:0] dout;
output write;
output [9:0] line_count_sync, pixel_count_sync;
output [29:0] ycrcb;
output data_valid;
output [4:0] current_state;
output [19:0] tv_in_sync;
output almost_empty;
reg wr_en = 0;
reg rd_en = 0;
reg [9:0] pixel_count_sync, line_count_sync;
reg write;
wire [58:0] dout_int;
wire [58:0] dout;
endmodule
module set_address(clk, reset, data_counter, data_counter2, data_out,
pixel_count_internal,
line_count_internal, addr, iteration_counter, one_time, write_enables,
write_counter, write_counter_int,
encoder_busy, macro_line);
input clk, reset, encoder_busy;
input [3:0] data_counter;
input [4:0] data_counter2;
input [63:0] data_out;
input [9:0] pixel_count_internal, line_count_internal;
output [9:0] addr;
output [7:0] iteration_counter, write_enables;
output one_time;
output [3:0] write_counter, write_counter_int;
output [4:0] macro_line;
begin
case (write_counter)
0:
if (~one_write_cycle)
begin
write_enables <= 8'b10000000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
1:
if (~one_write_cycle)
begin
write_enables <= 8'b01000000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
2:
if (~one_write_cycle)
begin
write_enables <= 8'b00100000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
3:
if (~one_write_cycle)
begin
write_enables <= 8'b00010000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
4:
if (~one_write_cycle)
begin
write_enables <= 8'b00001000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
5:
if (~one_write_cycle)
begin
write_enables <= 8'b00000100;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
6:
if (~one_write_cycle)
begin
write_enables <= 8'b00000010;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
7:
if (~one_write_cycle)
begin
write_enables <= 8'b00000001;
one_write_cycle <= 1;
halt <= (encoder_busy_sync2)? 1 : 0;
end
else
write_enables <= 8'h00;
default: write_enables <= 8'h00;
endcase
case (one_time)
0:
begin
iteration_counter <= (iteration_counter ==
239)? 0 : iteration_counter + 1;
write_counter_int <= (write_counter_int ==
7)? 0: write_counter_int + 1;
macro_line <= ((macro_line == 29) &&
(write_counter_int == 7))? 0 :
end
else
case (write_counter)
0:
if (~one_write_cycle)
begin
write_enables <= 8'b10000000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
1:
if (~one_write_cycle)
begin
write_enables <= 8'b01000000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
2:
if (~one_write_cycle)
begin
write_enables <= 8'b00100000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
3:
if (~one_write_cycle)
begin
write_enables <= 8'b00010000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
4:
if (~one_write_cycle)
begin
write_enables <= 8'b00001000;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
5:
if (~one_write_cycle)
begin
write_enables <= 8'b00000100;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
6:
if (~one_write_cycle)
begin
write_enables <= 8'b00000010;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
7:
if (~one_write_cycle)
begin
write_enables <= 8'b00000001;
one_write_cycle <= 1;
end
else
write_enables <= 8'h00;
default: write_enables <= 8'h00;
endcase
else
if ((data_counter == 8) && (data_counter2 == 29))
halt <= (encoder_busy_sync2)? 1 : 0;
else
halt <= 1;
else
begin
one_time <= 0;
one_write_cycle <= 0;
write_enables <= 0;
end
case (data_counter2)
0:
addr <= base_addr;
1:
addr <= base_addr + 1;
2:
addr <= base_addr + 2;
3:
addr <= base_addr + 3;
4:
addr <= base_addr + 4;
5:
addr <= base_addr + 5;
6:
addr <= base_addr + 6;
7:
addr <= base_addr + 7;
8:
addr <= base_addr + 8;
9:
addr <= base_addr + 9;
10:
addr <= base_addr + 10;
11:
addr <= base_addr + 11;
12:
addr <= base_addr + 12;
13:
addr <= base_addr + 13;
14:
addr <= base_addr + 14;
15:
addr <= base_addr + 15;
16:
addr <= base_addr + 16;
17:
addr <= base_addr + 17;
18:
addr <= base_addr + 18;
19:
addr <= base_addr + 19;
20:
addr <= base_addr + 20;
21:
addr <= base_addr + 21;
22:
addr <= base_addr + 22;
23:
addr <= base_addr + 23;
24:
addr <= base_addr + 24;
25:
addr <= base_addr + 25;
26:
addr <= base_addr + 26;
27:
addr <= base_addr + 27;
28:
addr <= base_addr + 28;
29:
addr <= base_addr + 29;
default: addr <= addr;
endcase
end
else
begin
addr <= 0;
base_addr <= 0;
write_enables <= 0;
iteration_counter <= 0;
write_counter_int <= 0;
end
end
wire [7:0] ;
Y
wire [9:0] pixel_count_internal, line_count_internal;
end
//new
/* -----\
/----- EXCLUDED -----\
/-----
encoder_memory memstructure(clk, clk2, addra, addrb, data_in, write_enables,
dout0, dout1, dout2, dout3, dout4, dout5, dout6, dout7);
----- EXCLUDED -----/\
-----/\ ----- */
read64 read(clk2, reset, Y_out, dout0, dout1, dout2, dout3, dout4, dout5, dout6,
dout7, addrb,
pixel_count, line_count, read_counter, read_counter2, switch_dout_counter,
iteration_counter2,
first_eight, second_eight, dout, start);
endmodule
/*
*
*
* Module: ycrcb2rgb
*
* eneric
G Eq
uations:
*
/
module CrCb2RG
Y B(R, G
, ,
B clk, rst, ,
Y Cr, Cb);
output [7:0] R, ,
G ;
B
input clk,rst;
input[9:0] ,
Y Cr, Cb;
//registering constants
always @(posedge clk)
begin
b 0100101010;
const1 = 10' //1.164 = 01.00101010
const2 = 10'
b 0110011000; //1.596 = 01.10011000
b 0011010000;
const3 = 10' //0.813 = 00.11010000
b 0001100100;
const4 = 10' //0.392 = 00.01100100
b 1000000100;
const5 = 10' //2.017 = 10.00000100
end
/*
always @(posedge clk or posedge rst)
if (rst)
begin
R_int =< 0; _int
G =
< 0; _int
B =
< 0;
end
else
begin
X
_int =
< (const1 *(Y_reg - d64))
' ;
R_int = X
< _int +(const2 *(Cr_reg - d512));
'
_int
G < _int
= X - (const3 *(Cr_reg - d512))
' - (const4 *(Cb_reg - d512));
'
B
_int = X
< _int +(const5 *(Cb_reg - d512));
'
end
/
*
/*limit output to 0 - 4095, 0 uals o and 4095
< eq > eq
uals 4095 /
*
endmodule
module test(clk1, clk2, clk3, reset, tv_in_ycrcb, R, G, B, dout, doutb,
addrb, start, line_count_sync, write, addra, pixel_count, line_count,
RGB_out,
Y, data_valid, Y_out, encoder_busy, macro_line, write_enables, data_in,
gray_addra);
input clk1, clk2, clk3, reset;
input [19:0] tv_in_ycrcb;
input [15:0] addrb;
input [9:0] pixel_count, line_count;
input encoder_busy;
output start, write;
output [7:0] R, G, B;
output [9:0] line_count_sync;
output [58:0] dout;
output [23:0] doutb;
output [15:0] addra;
output [23:0] RGB_out;
output [4:0] macro_line;
output [63:0] data_in;
output [7:0] write_enables;
output [9:0] gray_addra;
//new
output [9:0] Y;
output data_valid;
output [7:0] Y_out;
//new
wire [4:0] current_state;
wire data_valid;
wire [29:0] ycrcb;
wire [19:0] tv_in_sync;
wire [4:0] macro_line;
assign Y = ycrcb[29:20];
assign Cr = ycrcb[19:10];
assign Cb = ycrcb[9:0];
wire almost_empty;
synchronizer sync(clk1, clk2, reset, tv_in_ycrcb, dout, write, line_count_sync,
pixel_count_sync,
ycrcb, data_valid, current_state, tv_in_sync, almost_empty);
//new
wire [9:0] pixel_count, line_count;
wire [23:0] RGB_out;
assign RGB_out = {Y_out, Y_out, Y_out};
wire [9:0] gray_addra;
endmodule
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Encoder - Video Memory Module
// 05/13/2006
//
//////////////////////////////////////////////////////
module video_memory(
wr_clk,
addra,
dina,
write_enables,
r_clk,
line_read,
block_read,
inter_row_cnt,
addrb,
output_row
);
wire [63:0] out0, out1, out2, out3, out4, out5, out6, out7;
wire [9:0] addrb;
endmodule // video_memory
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Encoder
// 05/05/2006
//
//////////////////////////////////////////////////////
module encoder(
clk,
reset,
resolution_select,
max_lines,
max_blocks,
line_active,
row,
encode_busy,
transmit_busy,
inter_row_cnt,
block_read,
line_read,
data_output,
write_address,
wen,
mult_column,
column_select,
output_select,
stage1_output,
shift_reg_output
);
output encode_busy;
output [4:0] block_read, line_read;
output [2:0] inter_row_cnt;
output [194:0] data_output;
output [9:0] write_address;
output wen;
output [103:0] mult_column;
output [2:0] column_select;
output [2:0] output_select;
output [17:0] stage1_output;
output [143:0] shift_reg_output;
endmodule // encoder
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// DCT Multiply Module - Encoder
// 04/24/2006
//
//////////////////////////////////////////////////////
module dct_multiply(
clk,
reset,
row,
column_select,
output_column,
stage1_output,
shift_reg_output,
done
);
// Shift Register
mult_shift_reg MULTSHFTREG1(
.clk(clk),
.reset(reset),
.coef(stage1_output),
b1),
.rdy(1'
.column(shift_reg_output),
.done(done)
);
endmodule // dct_multiply
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// DCT Front - First stage of multiply module
// 04/24/2006
//
//////////////////////////////////////////////////////
module dct_front(
clk,
row,
column,
output_trunc,
output_coef
);
input clk;
input [71:0] row, column;
// Debugging vector
assign output_trunc = coef;
endmodule // dct_front
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Single Matrix Coefficient enerator
G - Naive Implementation
// 04/22/2006
//
//////////////////////////////////////////////////////
module matrix_naive(
clk,
row,
column,
RX _1, RX
_0, RX _3, RX
_2, RX _5, RX
_4, RX _7,
_6, RX
RI_0, RI_1, RI_2, RI_3,
RM_0, RM_1,
product);
input clk;
input [71:0] row, column;
wire signed [8
:0] row_pixel [7:0];
wire signed [8
:0] col_pixel [7:0];
assign RX
_0 = RX
[0];
assign RX
_1 = RX
[1];
assign RX
_2 = RX
[2];
assign RX
_3 = RX
[3];
assign RX
_4 = RX
[4];
assign RX
_5 = RX
[5];
assign RX
_6 = RX
[6];
assign RX
_7 = RX
[7];
mult_sign_9 MU
LT0(.
clk(clk), a(row_pixel[0]),
. b(col_pixel[0]),
. (
q
.RX
[0]));
mult_sign_9 MU clk(clk),
LT1(. .
a(row_pixel[1]), b(col_pixel[1]),
. (
.RX
q [1]));
mult_sign_9 MU clk(clk),
LT2(. .
a(row_pixel[2]), b(col_pixel[2]),
. (
.RX
q [2]));
mult_sign_9 MU clk(clk),
LT3(. .
a(row_pixel[3]), b(col_pixel[3]),
. (
.RX
q [3]));
mult_sign_9 LT4(.
MU clk(clk), a(row_pixel[4]),
. .
b(col_pixel[4]), q
(
.RX
[4]));
mult_sign_9 MU clk(clk),
LT5(. .
a(row_pixel[5]), b(col_pixel[5]),
. (
.RX
q [5]));
mult_sign_9 MU clk(clk),
LT6(. .
a(row_pixel[6]), b(col_pixel[6]),
. (
.RX
q [6]));
mult_sign_9 MU clk(clk),
LT7(. .
a(row_pixel[7]), b(col_pixel[7]),
. (
.RX
q [7]));
adder_sign_18ADD00(.
A(RX
[0]), B(RX
. [1]), S(RI[0]));
.
adder_sign_18ADD01(. [2]),
A(RX . [3]),
B(RX .
S(RI[1]));
A(RX
adder_sign_18ADD02(. [4]), B(RX
. [5]), S(RI[2]));
.
adder_sign_18ADD03(. [6]),
A(RX . [7]),
B(RX .
S(RI[3]));
adder_sign_19 ADD10(.
A(RI[0]), B(RI[1]),
. S(RM[0]));
.
A(RI[2]), B(RI[3]),
adder_sign_19 ADD11(. . S(RM[1]));
.
adder_sign_20 ADD20(.
A(RM[0]), B(RM[1]),
. S(product));
.
endmodule // matrix_naive
//////////////////////////////////////////////////////
//
// ivek
V Sh
ah
// Final Project
//
//
// Truncate Stage 1 (21 bits ->18 bits)
// 04/24/2006
//
//////////////////////////////////////////////////////
module trunc_s1(
input_coef,
output_coef
);
endmodule // trunc_s1
//////////////////////////////////////////////////////
//
// ivek
V Sh
ah
// Final Project
//
//
// Encoder Internal Sh
ift Register
// 05/12/2006
//
//////////////////////////////////////////////////////
module mult_sh
ift_reg(
clk,
reset,
coef,
rdy,
column,
done
);
parameter MAX
_FILL = 8;
if (reg_fill == MAX
_FILL - 1)
done <= 1;
else
done <= 0;
end // else: !if(!reset)
end // always @ (posedge clk)
endmodule // mult_sh
ift_reg
//////////////////////////////////////////////////////
//
// ivek
V Sh
ah
// Final Project
//
//
// DCT Back - Second stage of multiply module
// 04/24/2006
//
//////////////////////////////////////////////////////
module dct_back(
clk,
row0,
row1,
row2,
row3,
row4,
row5,
row6,
row7,
column,
output_trunc,
output_column
);
input clk;
input [71:0] row0, row1, row2, row3, row4, row5, row6, row7;
input [143:0] column;
endmodule // dct_back
//////////////////////////////////////////////////////
//
// ivek
V Sh
ah
// Final Project
//
//
// Matrix Multiply ->Stage 2
// 04/22/2006
//
//////////////////////////////////////////////////////
module matrix_mult_s2(
clk,
row0,
row1,
row2,
row3,
row4,
row5,
row6,
row7,
column,
coef0,
coef1,
coef2,
coef3,
coef4,
coef5,
coef6,
coef7
);
input clk;
input [71:0] row0, row1, row2, row3, row4, row5, row6, row7;
input [143:0] column;
output [29:0] coef0, coef1, coef2, coef3, coef4, coef5, coef6, coef7;
matrix_naive_s2_trunc MTX
0(.clk(clk), .row(row0), .column(column),
.product(coef0));
matrix_naive_s2_trunc 1(.clk(clk), .row(row1), .column(column),
MTX
.product(coef1));
matrix_naive_s2_trunc 2(.clk(clk), .row(row2), .column(column),
MTX
.product(coef2));
matrix_naive_s2_trunc MTX
3(.clk(clk), .row(row3), .column(column),
.product(coef3));
matrix_naive_s2_trunc 4(.clk(clk), .row(row4), .column(column),
MTX
.product(coef4));
matrix_naive_s2_trunc 5(.clk(clk), .row(row5), .column(column),
MTX
.product(coef5));
matrix_naive_s2_trunc MTX
6(.clk(clk), .row(row6), .column(column),
.product(coef6));
matrix_naive_s2_trunc 7(.clk(clk), .row(row7), .column(column),
MTX
.product(coef7));
endmodule // matrix_mult_s2
//////////////////////////////////////////////////////
//
// ivek
V Sh
ah
// Final Project
//
//
// Single Matrix Coefficient e
Gnerator - Naive Implementation Stage 2 truncated
// 04/22/2006
//
//////////////////////////////////////////////////////
module matrix_naive_s2_trunc(
clk,
row,
column,
RX
_0, RX
_1, RX
_2, RX
_3, RX
_4, RX
_5, RX
_6, RX
_7,
RI_0, RI_1, RI_2, RI_3,
RM_0, RM_1,
product);
input clk;
input [71:0] row;
input [143:0] column;
assign RX
_0 = RX
[0];
assign RX
_1 = RX
[1];
assign RX
_2 = RX
[2];
assign RX
_3 = RX
[3];
assign RX
_4 = RX
[4];
assign RX
_5 = RX
[5];
assign RX
_6 = RX
[6];
assign RX
_7 = RX
[7];
adder_sign_27 ADD00(.A(RX
[0]), .B(RX
[1]), .S(RI[0]));
adder_sign_27 [2]),
ADD01(.A(RX .B(RX
[3]), .S(RI[1]));
adder_sign_27 [4]),
ADD02(.A(RX .B(RX
[5]), .S(RI[2]));
adder_sign_27 [6]),
ADD03(.A(RX .B(RX
[7]), .S(RI[3]));
endmodule // matrix_naive
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Truncate Stage 2 (21 bits ->18 bits)
// 04/24/2006
//
//////////////////////////////////////////////////////
module trunc_s2(
input_coef,
output_coef
);
endmodule // trunc_s2
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// DCT Matrix
// 04/22/2006
//
//////////////////////////////////////////////////////
module dct_table(clk,
row0, row1, row2, row3, row4, row5, row6, row7,
col0, col1, col2, col3, col4, col5, col6, col7
);
input clk;
output [71:0] row0, row1, row2, row3, row4, row5, row6, row7;
output [71:0] col0, col1, col2, col3, col4, col5, col6, col7;
assign col0 = d
{ct_coef[0], dct_coef[8], dct_coef[16], dct_coef[24],
;
dct_coef[32], dct_coef[40], dct_coef[48], dct_coef[56]}
assign col1 = dct_coef[1],
{ dct_coef[9], dct_coef[17], dct_coef[25],
;
dct_coef[33], dct_coef[41], dct_coef[49], dct_coef[57]}
assign col2 = dct_coef[2],
{ dct_coef[10], dct_coef[18], dct_coef[26],
dct_coef[34], dct_coef[42], dct_coef[50], dct_coef[58]}
;
assign col3 = dct_coef[3],
{ dct_coef[11], dct_coef[19], dct_coef[27],
;
dct_coef[35], dct_coef[43], dct_coef[51], dct_coef[59]}
assign col4 = dct_coef[4],
{ dct_coef[12], dct_coef[20], dct_coef[28],
;
dct_coef[36], dct_coef[44], dct_coef[52], dct_coef[60]}
assign col5 = dct_coef[5],
{ dct_coef[13], dct_coef[21], dct_coef[29],
;
dct_coef[37], dct_coef[45], dct_coef[53], dct_coef[61]}
assign col6 = d
{ct_coef[6], dct_coef[14], dct_coef[22], dct_coef[30],
;
dct_coef[38], dct_coef[46], dct_coef[54], dct_coef[62]}
assign col7 = dct_coef[7],
{ dct_coef[15], dct_coef[23], dct_coef[31],
dct_coef[39], dct_coef[47], dct_coef[55], dct_coef[63]}
;
endmodule // dct_table
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Encoder Memory Register
// 05/04/2006
//
//////////////////////////////////////////////////////
module encode_memory_register(
clk,
reset,
load_select,
max_lines,
max_blocks,
resolution_select,
coef0,
coef1,
coef2,
coef3,
coef4,
coef5,
coef6,
coef7,
data_output,
address,
wen
);
parameter NORMAL = 0;
parameter OOM
Z = 1;
parameter OTHER = 2;
input clk;
input reset;
input [2:0] load_select, resolution_select;
input [4:0] max_lines, max_blocks;
input [DATA_SIZ
E-1:0] coef0, coef1, coef2, coef3, coef4, coef5, coef6, coef7;
output [DATA_BUFFER:0] data_output;
output [9:0] address;
output wen;
// Pick E
WN
if (buffer_fill =
> block_siz
e)
begin
wen =
< 1;
buffer_fill =
< load_select;
end
else
begin
wen =
< 0;
buffer_fill =
< buffer_fill +load_select;
end
// Increment
if (wen)
address =
< (address == 99)
8 ?0 : address +1;
// Choose max_resolution
case (resolution_select)
NORMAL: block_siz
e = 6;
OOM:
Z block_siz
e = 15;
OTHER: block_siz
e = 10;
e = 6;
default: block_siz
endcase // case(resolution_select)
end // else: if(!
! reset)
endmodule // encode_memory_register
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Encoder Finite State Machine
// 05/01/2006
//
//////////////////////////////////////////////////////
module encode_fsm(
clk,
reset,
resolution_select,
max_blocks,
max_lines,
transmit_busy,
line_active,
line_read,
block_read,
column_select,
inter_row_cnt,
output_select,
encode_busy,
state);
// State
reg [1:0] state, next;
parameter IDLE = 0;
parameter IDLE_ENCODE = 1;
parameter ENCODE_BLOCK = 2;
integer i;
parameter PIPELINE = 1;
parameter NORMAL = 0;
parameter ZOOM = 1;
parameter OTHER = 2;
end
else
begin
line_read <= line_read_int;
block_read <= block_read_int;
column_select <= column_select_int;
inter_row_cnt <= inter_row_cnt_int;
output_select <= output_pipe[PIPELINE-1];
state <= next;
line_read_int = line_read;
block_read_int = block_read;
column_select_int = column_select;
inter_row_cnt_int = inter_row_cnt;
next = state;
encode_busy = 1;
case (state)
//
// IDLE -> waiting for TRANSMITTER to FINISH SENDINGFRAME
//
IDLE:
begin
encode_busy = 0;
output_pipe_int = 0;
if (transmit_busy)
next = IDLE;
else
next = IDLE_ENCODE;
end
//
// IDLE_ENCODE -> waiting for Video Capture to finish writing lines
//
IDLE_ENCODE:
begin
// NOTICE -> not registered
encode_busy = 1;
output_pipe_int = 0;
// Do nothing, wait for line_active to move past current_line
if (line_read == line_active)
next = IDLE_ENCODE;
else
next = ENCODE_BLOCK;
end
//
// Encode Block -> Multiply current block by DCT rows
//
ENCODE_BLOCK:
begin
// Reset block_dct
if (inter_row_cnt == 7)
inter_row_cnt_int = 0;
else
inter_row_cnt_int = inter_row_cnt + 1;
// Reset Blocks
if ((inter_row_cnt == 6) && (column_select == 7) && (block_read ==
max_blocks))
block_read_int = 0;
else if ((inter_row_cnt == 6) && (column_select == 7))
block_read_int = block_read + 1;
// Reset Lines
if ((inter_row_cnt == 6) && (column_select == 7) && (block_read ==
max_blocks) && (line_read == max_lines))
line_read_int = 0;
else if ((inter_row_cnt == 6) && (column_select == 7) &&
(block_read == max_blocks))
line_read_int = line_read + 1;
endcase // case(state)
module wireless_memory(
wr_clk,
wr_addr,
din,
wen,
r_clk,
read_addr,
dout
);
endmodule // wireless_memory
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Noel Campbell
//
// Create Date: 23:00:12 05/14/06
// Design Name:
// Module Name: tx_control_unit
// Project Name:
// Target Device:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tx_control_unit(clk,
reset,
cts_b,
read_data,
encode_wr_addr,
rts_b,
txd,
read_addr,
tx_busy,
rs232_state,
state,
shift_once,
send,
ready,
enable
);
wire [79
:0] encoded_data;
wire ready;
wire [7:0] encoded_byte;
parameter MAX_READ_ADDR = 10'
d89
;
9
// States
parameter IDLE = 0;
parameter LOAD = 1;
parameter SEND = 2;
parameter WAIT = 3;
parameter SHIFT = 4;
tx_shift_reg txsr(.clk(clk),
.reset(reset),
.load(load),
.encoded_data(encoded_data),
.shift_once(shift_once),
.encoded_byte(encoded_byte)
);
rs232_senderFSM_new sender(.clk(clk),
.reset(reset),
.data(encoded_byte),
.cts_b(cts_b),
.send(send),
.txd(txd),
.rts_b(rts_b),
.ready(ready),
.state(rs232_state),
.enable(enable));
endmodule // tx_control_unit
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Noel Campbell
//
// Create Date: 23:00:12 05/14/06
// Design Name:
// Module Name: tx_shift_reg
// Project Name:
// Target Device:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tx_sh
ift_reg(clk,
reset,
encoded_data,
load,
sh
ift_once,
encoded_byte);
if (sh
ift_once)
load_data <= 8'b0,
{ load_data[79:8]}
;
endmodule // tx_sh
ift_reg
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:08:54 05/02/06
// Design Name:
// Module Name: rs232_senderFSM_new
// Project Name:
// Target Device:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module rs232_senderFSM_new(clk,
reset,
data,
cts_b,
send,
txd,
rts_b,
ready,
state,
enable);
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:32:34 05/16/2006
// Design Name: tx_control_unit
// Module Name: tb_control_unit_new.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: tx_control_unit
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_control_unit_new_v;
// Inputs
reg clk;
reg reset;
reg cts_b;
reg [77:0] read_data;
reg [9:0] encode_wr_addr;
// Outputs
wire rts_b;
wire txd;
wire [9:0] read_addr;
wire tx_busy;
wire [3:0] rs232_state;
wire [2:0] state;
wire shift_once;
wire send;
wire ready;
wire enable;
// a
Wit 100 ns for global reset to finish
1
#00;
read_data = 78
'hF0F0F0F0F0F0F0F0F0F0;
repeat (30)
begin
# encode_wr_addr = encode_wr_addr +1;
10
end
end // initial begin
endmodule // tb_control_unit_new_v
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:13:50 04/25/2006
// Design Name: dct_back
// Module Name: tb_dct_back.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: dct_back
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_dct_back_v;
// Inputs
reg clk;
reg [71:0] row0;
reg [71:0] row1;
reg [71:0] row2;
reg [71:0] row3;
reg [71:0] row4;
reg [71:0] row5;
reg [71:0] row6;
reg [71:0] row7;
reg [143:0] column;
// Outputs
wire [95:0] output_column;
wire [239:0] output_trunc;
always 2
# clk = clk;
~
initial begin
e Inputs
// Initializ
clk = 0;
row0 = dct_row[0];
row1 = dct_row[1];
row2 = dct_row[2];
row3 = dct_row[3];
row4 = dct_row[4];
row5 = dct_row[5];
row6 = dct_row[6];
row7 = dct_row[7];
column = 0;
// a
Wit 100 ns for global reset to finish
5
#0;
row0 = dct_row[0];
row1 = dct_row[1];
row2 = dct_row[2];
row3 = dct_row[3];
row4 = dct_row[4];
row5 = dct_row[5];
row6 = dct_row[6];
row7 = dct_row[7];
end
endmodule
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:23:16 04/25/2006
// Design Name: dct_front
// Module Name: tb_dct_front.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: dct_front
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
//`include dct_table.v"
"
module tb_dct_front_v;
// Inputs
reg clk;
reg [71:0] row;
reg [71:0] column;
// Outputs
wire [17:0] output_coef;
wire [20:0] output_trunc;
initial begin
// Initialize Inputs
clk = 0;
row = 0;
column = 0;
endmodule // tb_dct_front_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:49:17 04/25/2006
// Design Name: dct_multiply
// Module Name: tb_dct_multiply.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: dct_multiply
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_dct_multiply_v;
// Inputs
reg clk;
reg reset;
reg [71:0] row;
reg [2:0] column_select;
reg [8:0] temp;
// Outputs
wire [103:0] output_column;
wire [17:0] stage1_output;
wire [143:0] shift_reg_output;
wire done;
integer i;
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
row = 1;
column_select = 0;
i = 0;
endmodule // tb_dct_multiply_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:09:28 04/24/2006
// Design Name: dct_table
// Module Name: tb_dct_table.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: dct_table
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_dct_table_v;
// Inputs
reg clk;
// Outputs
wire [71:0] row0;
wire [71:0] row1;
wire [71:0] row2;
wire [71:0] row3;
wire [71:0] row4;
wire [71:0] row5;
wire [71:0] row6;
wire [71:0] row7;
wire [71:0] col0;
wire [71:0] col1;
wire [71:0] col2;
wire [71:0] col3;
wire [71:0] col4;
wire [71:0] col5;
wire [71:0] col6;
wire [71:0] col7;
initial begin
// Initialize Inputs
clk = 0;
end
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:07:37 05/04/2006
// Design Name: encode_fsm
// Module Name: tb_encode_fsm.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: encode_fsm
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_encode_fsm_v;
// Inputs
reg clk;
reg reset;
reg transmit_busy;
reg [2:0] resolution_select;
reg [4:0] max_blocks;
reg [4:0] max_lines;
reg [4:0] line_active;
// Outputs
wire [4:0] line_read;
wire [4:0] block_read;
wire [2:0] column_select;
wire [2:0] inter_row_cnt;
wire [2:0] output_select;
wire encode_busy;
wire [1:0] state;
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
transmit_busy = 0;
resolution_select = 0;
max_blocks = 10;
max_lines = 4;
line_active = 1;
#800 line_active = 2;
repeat (15)
#20 line_active = line_active + 1;
#5 reset = 0;
resolution_select = 0;
#10 reset = 1;
#20 transmit_busy = 1;
#2000 transmit_busy = 0;
endmodule // tb_encode_fsm_v
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:44:24 05/04/2006
// Design Name: encode_memory_register
// Module Name: tb_encode_mem_reg.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: encode_memory_register
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_encode_mem_reg_v;
// Inputs
reg clk;
reg reset;
reg [2:0] load_select;
reg [4:0] max_lines;
reg [4:0] max_blocks;
reg [2:0] resolution_select;
reg [12:0] coef0;
reg [12:0] coef1;
reg [12:0] coef2;
reg [12:0] coef3;
reg [12:0] coef4;
reg [12:0] coef5;
reg [12:0] coef6;
reg [12:0] coef7;
// Outputs
wire [19
4:0] data_output;
:0]
wire [9 address;
wire wen;
always #1 clk = c
~lk;
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
load_select = 0;
max_lines = 3;
max_blocks = 10;
resolution_select = 0;
coef0 = 1;
coef1 = 2;
coef2 = 3;
coef3 = 4;
coef4 = 5;
coef5 = 6;
coef6 = 7;
coef7 = 8;
#2 load_select = 1;
#2 load_select = 2;
#2 load_select = 3;
#2 load_select = 0;
#4 load_select = 1;
#2 load_select = 2;
#2 load_select = 3;
#2 load_select = 1;
#2 load_select = 2;
#2 load_select = 3;
#2 load_select = 0;
#8 load_select = 1;
#2 load_select = 2;
#2 load_select = 0;
end
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:43:25 05/05/2006
// Design Name: encoder
// Module Name: tb_encoder.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: encoder
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_encoder_v;
// Inputs
reg clk;
reg reset;
reg [2:0] resolution_select;
reg [4:0] max_lines;
reg [4:0] max_blocks;
reg [4:0] line_active;
reg [71:0] row;
reg transmit_busy;
// Outputs
wire encode_busy;
wire [2:0] inter_row_cnt;
wire [4:0] block_read;
wire [4:0] line_read;
wire [19
4:0] data_output;
:0]
wire [9 write_address;
wire wen;
wire [103:0] mult_column;
wire [12:0] mult[7:0];
wire [12:0] output_seg[7:0];
wire [2:0] column_select;
wire [2:0] output_select;
wire [17:0] stage1_output;
wire [143:0] shift_reg_output;
wire [17:0] sreg_seg[7:0];
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
resolution_select = 0;
max_lines = 4;
max_blocks = 10;
line_active = 5;
row = 0;
transmit_busy = 0;
end
for (i = 0; i < 8; i = i + 1)
repeat (8) begin
d127,
'
#40 row = {9 '
9
d127, d127,
'
9 '
9
d127, d127,
'
9 '
9
d127, d127,
'
9
d
'
9127};
end
for (i = 0; i < 8; i = i + 1)
repeat (8) begin
#40 row = {9
d63,
' '
d63,
9 d63,
'
9 9
d63,
' d63,
'
9 9
d63,
' '
d63,
9 '
d63};
9
end
for (i = 0; i < 8; i = i + 1)
repeat (8) begin
#40 row = {9
d1,
' '
d1,
9 d1,
'
9 9
d1,
' d1,
'
9 9
d1,
' '
d1,
9 '
d1};
9
end
for (i = 0; i < 8; i = i + 1)
repeat (8) begin
#40 row = {9
d1,
' '
9
d100, d1,
'
9 d100,
9
' d1,
9
' '
9
d100, d1,
'
9 d100};
9
'
end
for (i = 0; i < 8; i = i + 1)
repeat (8) begin
#40
temp = 1 << i;
row = temp << *i;
9
end
#2000 transmit_busy = 1;
endmodule // tb_encoder_v
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:06:50 04/23/2006
// Design Name: matrix_naive
// Module Name: tb_mtx.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: matrix_naive
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_mtx_v;
// Inputs
reg clk;
reg [71:0] row;
reg [71:0] column;
// Outputs
wire [20:0] product;
always #2 clk = c
~lk;
initial begin
// Initialize Inputs
clk = 0;
row = 0;
column = 0;
#5;
#4 row = {9
d2,
' d2,
'
9 d2,
'
9 d2,
'
9 d2,
'
9 d2,
'
9 d2,
'
9 d2};
'
9
'
column = {9
d2, d2,
'
9 9
d2,
' d2,
'
9 9
d2,
' '
d2,
9 '
d2,
9 '
d2};
9
#4 row = {9
d1,
' d2,
'
9 d3,
'
9 d4,
'
9 d5,
'
9 d6,
'
9 d7,
'
9 d8};
'
9
column = {9
d1,
' '
9
d2, d3,
'
9 '
9
d4, d5,
'
9 d6,
9
' d7,
9
' d8};
9
'
#4 row = {9
hFF,
' hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF};
'
9
column = {9
hFF,
' '
9
hFF, hFF,
'
9 hFF,
9
' hFF,
9
' '
9
hFF, hFF,
'
9 '
9
hFF};
#4 row = {9
hF0,
' hF0,
'
9 hF0,
'
9 hF0,
'
9 hF0,
'
9 hF0,
'
9 hF0,
'
9 hF0};
'
9
column = {9
hF0,
' '
9
hF0, hF0,
'
9 '
9
hF0, hF0,
'
9 hF0,
'
9 9
'
hF0, hF0};
'
9
#4 row = {9
h1FF,
' h1FF,
'9 h1FF,
'
9 h1FF,
'
9 h1FF,
'9 h1FF,
'
9 h1FF,
'
9 h1FF};
'
9
column = {9
hF0,
' '
9
hF0, hF0,
'
9 hF0,
9
' hF0,
9
' '
9
hF0, hF0,
'
9 '
9
hF0};
#4 row = {9
d1,
' d2,
'
9 d3,
'
9 d4,
'
9 d5,
'
9 d6,
'
9 d7,
'
9 d8};
'
9
'
column = {9
d1, d2,
'
9 9
d3,
' '
d4,
9 '
d5,
9 d6,
'
9 9
d7,
' d8};
'
9
#4 row = {9
d1,
' d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1};
'
9
column = {9
d1,
' '
d1,
9 '
9
d1, '
d1,
9 '
9
d1, d1,
'
9 9
'
d1, d1};
'
9
#4 row = {9
d0,
' d0,
'
9 d0,
'
9 d0,
'
9 d0,
'
9 d0,
'
9 d0,
'
9 d0};
'
9
'
column = {9
d0, d0,
'
9 9
d0,
' d0,
'
9 9
d0,
' '
d0,
9 '
d0,
9 '
d0};
9
end
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:52:18 04/24/2006
// Design Name: matrix_mult_s1
// Module Name: tb_mtx_mult_s1.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: matrix_mult_s1
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_mtx_mult_s1_v;
// Inputs
reg clk;
reg [71:0] row0;
reg [71:0] row1;
reg [71:0] row2;
reg [71:0] row3;
reg [71:0] row4;
reg [71:0] row5;
reg [71:0] row6;
reg [71:0] row7;
reg [71:0] column;
// Outputs
wire [20:0] coef0;
wire [20:0] coef1;
wire [20:0] coef2;
wire [20:0] coef3;
wire [20:0] coef4;
wire [20:0] coef5;
wire [20:0] coef6;
wire [20:0] coef7;
always #2 clk = c
~lk;
initial begin
// Initialize Inputs
clk = 0;
row0 = 0;
row1 = 0;
row2 = 0;
row3 = 0;
row4 = 0;
row5 = 0;
row6 = 0;
row7 = 0;
column = 0;
#4 row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {9
d1,
' d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1};
'
9
#4 row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {9
d1,
' d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1};
'
9
#4 row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {9
hFF,
' hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF};
'
9
#4 row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {9
h100,
' h100,
'
9 h100,
'
9 h100,
'
9 h100,
'
9 h100,
'
9 h100,
'
9 h100};
'
9
#4 row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {9
hFF,
' hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF,
'
9 hFF};
'
9
// 1, 4, ,
9 16 ...
for (i = 0; i < 8; i = i +1)
row[i] = i + 1 << *(7-i);
9
#4 row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {9
d1,
' d2,
'
9 d3,
'
9 d4,
'
9 d5,
'
9 d6,
'
9 d7,
'
9 d8};
'
9
end
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:19:54 04/24/2006
// Design Name: matrix_mult_s2
// Module Name: tb_mtx_mult_s2.v
// roj
P ect Name: finalproject
// a
Trget Device:
// o
Tol versions:
// Description:
//
// Verilog est
T E for module: matrix_mult_s2
Fixture created by IS
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_mtx_mult_s2_v;
// Inputs
reg clk;
reg [71:0] row0;
reg [71:0] row1;
reg [71:0] row2;
reg [71:0] row3;
reg [71:0] row4;
reg [71:0] row5;
reg [71:0] row6;
reg [71:0] row7;
reg [143:0] column;
// Outputs
wire [29:0] coef0;
wire [29:0] coef1;
wire [29:0] coef2;
wire [29:0] coef3;
wire [29:0] coef4;
wire [29:0] coef5;
wire [29:0] coef6;
wire [29:0] coef7;
initial begin
// Initialize Inputs
clk = 0;
row0 = 0;
row1 = 0;
row2 = 0;
row3 = 0;
row4 = 0;
row5 = 0;
row6 = 0;
row7 = 0;
column = 0;
for (i = 0; i < 8; i = i 1
+)
row[i] = 1 << 9*i;
4
# row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {18'd1, 18'd1, 18'd1, 18'd1, 18'd1, 18'd1, 18'd1, 18'd1};
4
# row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {18'd1, 18'd1, 18'd1, 18'd1, 18'd1, 18'd1, 18'd1, 18'd1};
4
# row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {18'h1FFFF, 18'h1FFFF, 18'h1FFFF, 18'h1FFFF, 18'h1FFFF,
18'h1FFFF, 18'h1FFFF, 18'h1FFFF};
4
# row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {18'h20000, 18'h20000, 18'h20000, 18'h20000, 18'h20000,
18'h20000, 18'h20000, 18'h20000};
4
# row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {18'h1FFFF, 18'h1FFFF, 18'h1FFFF, 18'h1FFFF, 18'h1FFFF,
18'h1FFFF, 18'h1FFFF, 18'h1FFFF};
// 1, 4, 9, 16 ...
for (i = 0; i < 8; i = i 1)
+
row[i] = i +1 << 9*(7-i);
4
# row0 = row[0];
row1 = row[1];
row2 = row[2];
row3 = row[3];
row4 = row[4];
row5 = row[5];
row6 = row[6];
row7 = row[7];
column = {18'd1, 18'd2, 18'd3, 18'd4, 18'd5, 18'd6, 18'd7, 18'd8};
end
endmodule
// Verilog Test Fixture Template
t̀imescale 1 ns / 1 ps
module TEST_gate;
reg <signal1>;
reg [2:0] <signal2>;
wire [3:0] <signal3>;
wire <signal4>;
<module_name> <instance_name> (
<port1>,
<port2>
);
integer <name1>;
integer <name2>;
// The following code initializes the Global Set Reset (GSR) and Global
Three-State (GTS) nets
// Refer to the Synthesis and Simulation Design Guide for more information on
this process
reg GSR;
assign glbl.GSR = GSR;
reg GTS;
assign glbl.GTS = GTS;
initial begin
GSR = 1;
GTS = 0; // GTS is not activated by default
#100; // GSR is set for 100 ns
GSR = 0;
end
// Initialize Inputs
ifdef
` auto_init
initial begin
end
èndif
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:09
:4904/23/2006
// Design Name: matrix_naive_s2
// Module Name: tb_mtx_s2.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: matrix_naive_s2
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_mtx_s2_v;
// Inputs
reg clk;
reg [167:0] row;
reg [167:0] column;
// Outputs
wire [41:0] RX_0;
wire [41:0] RX_1;
wire [41:0] RX_2;
wire [41:0] RX_3;
wire [41:0] RX_4;
wire [41:0] RX_5;
wire [41:0] RX_6;
wire [41:0] RX_7;
wire [42:0] RI_0;
wire [42:0] RI_1;
wire [42:0] RI_2;
wire [42:0] RI_3;
wire [43:0] RM_0;
wire [43:0] RM_1;
wire [44:0] product;
initial begin
// Initialize Inputs
clk = 0;
row = 0;
column = 0;
#100;
end
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:02:14 04/23/2006
// Design Name: matrix_naive_s2_trunc
// Module Name: tb_mtx_s2_trunc.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: matrix_naive_s2_trunc
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_mtx_s2_trunc_v;
// Inputs
reg clk;
reg [143:0] row;
reg [143:0] column;
// Outputs
wire [35:0] RX_0;
wire [35:0] RX_1;
wire [35:0] RX_2;
wire [35:0] RX_3;
wire [35:0] RX_4;
wire [35:0] RX_5;
wire [35:0] RX_6;
wire [35:0] RX_7;
wire [36:0] RI_0;
wire [36:0] RI_1;
wire [36:0] RI_2;
wire [36:0] RI_3;
wire [37:0] RM_0;
wire [37:0] RM_1;
wire [38:0] product;
always #2 clk = c
~lk;
initial begin
// Initialize Inputs
clk = 0;
row = 0;
column = 0;
#4 row = {9
d2,
' d2,
'
9 d2,
'
9 d2,
'
9 d2,
'
9 d2,
'
9 d2,
'
9 d2};
'
9
column = {18' d2, 18'
d2, 18' d2, 18'
d2, 18' d2, 18'd2, 18' d2};
d2, 18'
#4 row = {9
d1,
' d2,
'
9 d3,
'
9 d4,
'
9 d5,
'
9 d6,
'
9 d7,
'
9 d8};
'
9
column = {18' d2, 18'
d1, 18' d4, 18'
d3, 18' d5, 18'd6, 18' d8};
d7, 18'
hFF,
#4 row = {9
' hFF,
'
9 '
9
hFF, hFF,
'
9 '
9
hFF, hFF,
'
9 '
9
hFF, hFF};
'
9
hFF, 18'
column = {18' hFF, 18'hFF, 18' hFF, 18'
hFF, 18' hFF, 18'
hFF, 18' hFF};
#4 row = {9
hFF0,
' hFF0,
'
9 hFF0,
'
9 hFF0,
'
9 hFF0,
'
9 hFF0,
'
9 hFF0,
'
9 hFF0};
'
9
column = {18' h3FFF0, 18'
h3FFF0, 18' h3FFF0, 18'
h3FFF0, 18' h3FFF0,
h3FFF0, 18'
18' h3FFF0};
h3FFF0, 18'
#4 row = {9
h1FF,
' h1FF,
'
9 h1FF,
'
9 h1FF,
'
9 h1FF,
'
9 h1FF,
'
9 h1FF,
'
9 h1FF};
'
9
hFFF0, 18'
column = {18' hFFF0, 18'
hFFF0, 18' hFFF0, 18'
hFFF0, 18' hFFF0,
18' hFFF0};
hFFF0, 18'
#4 row = {9
d1,
' d2,
'
9 d3,
'
9 d4,
'
9 d5,
'
9 d6,
'
9 d7,
'
9 d8};
'
9
d1, 18'
column = {18' d3, 18'
d2, 18' d5, 18'
d4, 18' d7, 18'
d6, 18' d8};
#4 row = {9
d1,
' d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1,
'
9 d1};
'
9
d1, 18'
column = {18' d1, 18'
d1, 18' d1, 18'
d1, 18' d1, 18'
d1, 18' d1};
#4 row = {9
d0,
' d0,
'
9 d0,
'
9 d0,
'
9 d0,
'
9 d0,
'
9 d0,
'
9 d0};
'
9
column = {18' d0, 18'
d0, 18' d0, 18'
d0, 18' d0, 18'd0, 18' d0};
d0, 18'
end
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:48:11 05/13/2006
// Design Name: mult_shift_reg
// Module Name: tb_mult_shift_reg.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: mult_shift_reg
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_mult_shift_reg_v;
// Inputs
reg clk;
reg reset;
reg [17:0] coef;
reg rdy;
// Outputs
wire [143:0] column;
wire done;
always #1 clk = c
~lk;
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
coef = 0;
rdy = 1;
#5 rdy = 0;
#10 reset = 0;
#10 reset = 1;
endmodule // tb_mult_shift_reg_v
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:05:21 05/02/2006
// Design Name: rs232_senderFSM_new
// Module Name: tb_senderFSM_new.v
// Project Name: final_project
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: rs232_senderFSM_new
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_senderFSM_new_v;
// Inputs
reg clk;
reg reset;
reg [7:0] data;
reg cts;
reg send;
// Outputs
wire txd;
wire rts;
wire ready;
wire [3:0] state;
defparam uut.BAUD_COUNTER = 5;
always #5 clk = clk;
~
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
b00000001;
data = 8'
cts = 1;
send = 0;
end
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:18:44 05/15/2006
// Design Name: tx_shift_reg
// Module Name: tb_tx_shift_reg.v
// Project Name: final_project
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: tx_shift_reg
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_tx_shift_reg_v;
// Inputs
reg clk;
reg reset;
reg [79
:0] encoded_data;
reg ready;
reg send_block;
// Outputs
wire send;
wire done;
wire [7:0] encoded_byte;
wire [1:0] state;
always #5 clk = c
~lk;
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
encoded_data = 0;
ready = 0;
send_block = 0;
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19
:50:31 05/13/2006
// Design Name: video_memory
// Module Name: tb_video_memory.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: video_memory
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_video_memory_v;
// Inputs
reg wr_clk;
reg [9
:0] addra;
reg [63:0] dina;
reg wea;
reg r_clk;
reg [4:0] line_read;
reg [4:0] block_read;
reg [2:0] inter_row_cnt;
// Outputs
:0] addrb;
wire [9
wire [63:0] output_row;
initial begin
// Initialize Inputs
wr_clk = 0;
addra = 0;
dina = 0;
wea = 0;
r_clk = 0;
line_read = 0;
block_read = 0;
inter_row_cnt = 0;
endmodule // tb_video_memory_v
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:52:37 05/14/2006
// Design Name: wireless_memory
// Module Name: tb_wireless_memory.v
// Project Name: finalproject
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: wireless_memory
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_wireless_memory_v;
// Inputs
reg wr_clk;
reg [9
:0] wr_addr;
reg [77:0] din;
reg wen;
reg r_clk;
reg [9
:0] read_addr;
// Outputs
wire [77:0] dout;
initial begin
// Initialize Inputs
wr_clk = 0;
wr_addr = 0;
din = 0;
wen = 0;
r_clk = 0;
read_addr = 0;
// Wait 100 ns for global reset to finish
#100;
end
endmodule
/*******************************************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** +++ *** *
* *** + + *** *
* *** + CHIPCON CC2420DBK EXAMPLES *
* *** + + *** Simple wireless dimmer / RF range tester demo *
* *** +++ *** *
* *** *** *
* ************ *
* ********** *
* *
*******************************************************************************************************
* This program demonstrates the use of the CC2420DB library, including the basic RF library. The *
* packet protocol being used is a small subset of the IEEE 802.15.4 standard. It uses an 802.15.4 MAC *
* compatible frame format, but does not implement any other MAC functions/mechanisms (e.g. CSMA-CA). *
* The basic RF library can thus not be used to communicate with compliant 802.15.4 networks. *
* *
* A pair of CC2420DBs running this program will establish a point-to-point RF link on channel 26, *
* using the following node addresses: *
* - PAN ID: 0x2420 (both nodes) *
* - Short address: *
* 0x1234 if the joystick is moved in any direction at startup *
* 0x5678 if the joystick button is pressed down at startup *
* *
* Please note that there is no so-called (PAN) coordinator. *
* *
* INSTRUCTIONS: *
* Data packets containing a 5-byte payload will be transmitted when the pot meter is turned, or S2 is *
* held down. The first byte of the payload contains the pot meter value, which is used to control the *
* PWM duty cycle on the receiving node. The other bytes are random (never initialized). *
* *
* LED indicators: *
* - Red: Transmission failed (acknowledgment not received) *
* - Yellow: Transmission OK (acknowledgment received) *
* - Orange: Remote controlled dimmer
*
* - Green: Packet received *
*******************************************************************************************************
* Compiler: AVR-GCC *
* Target platform: CC2420DB (can easily be ported to other platforms) *
*******************************************************************************************************
* Revision history: *
* $Log: rf_blink_led.c,v $
* Revision 1.5 2004/07/26 11:18:13 mbr
* Changed PANID from 0xDEAD to 0x2420
*
* Revision 1.4 2004/04/05 08:25:52 mbr
* Comments changed in header
*
* Revision 1.3 2004/03/30 14:58:27 mbr
* Release for web
*
*
*
* *
*
*
*******************************************************************************************************/
#include <include.h>
//-------------------------------------------------------------------------------------------------------
// Basic RF transmission and reception structures
BASIC_RF_RX_INFO rfRxInfo;
BASIC_RF_TX_INFO rfTxInfo;
BYTE pTxBuffer[BASIC_RF_MAX_PAYLOAD_SIZE];
BYTE pRxBuffer[BASIC_RF_MAX_PAYLOAD_SIZE];
BOOL senderReceiver;
//-------------------------------------------------------------------------------------------------------
//-------------------------------------------------------------------------------------------------------
// BASIC_RF_RX_INFO* basicRfReceivePacket(BASIC_RF_RX_INFO *pRRI)
//
// DESCRIPTION:
// This function is a part of the basic RF library, but must be declared by the application. Once
// the application has turned on the receiver, using basicRfReceiveOn(), all incoming packets will
// be received by the FIFOP interrupt service routine. When finished, the ISR will call the
// basicRfReceivePacket() function. Please note that this function must return quickly, since the
// next received packet will overwrite the active BASIC_RF_RX_INFO structure (pointed to by pRRI).
//
// ARGUMENTS:
// BASIC_RF_RX_INFO *pRRI
// The reception structure, which contains all relevant info about the received packet.
//
// RETURN VALUE:
// BASIC_RF_RX_INFO*
// The pointer to the next BASIC_RF_RX_INFO structure to be used by the FIFOP ISR. If there
is
// only one buffer, then return pRRI.
//-------------------------------------------------------------------------------------------------------
BASIC_RF_RX_INFO* basicRfReceivePacket(BASIC_RF_RX_INFO *pRRI) {
UINT8 n;
if (senderReceiver == FALSE) {
// Wait until CTS is low signaling that it is okay to send a byte to the receiver FPGA
// if CTS is high (inactive) disable packet reception until CTS goes back low
while (TRUE) {
if (BM(UART1_CTS) & PIND) {
basicRfReceiveOff();
// Set the green led while the receiver is waiting on CTS to go low
SET_GLED();
}
else {
basicRfReceiveOn();
CLR_GLED();
break;
}
}
} // basicRfReceivePacket
//-------------------------------------------------------------------------------------------------------
// void main (void)
//
// DESCRIPTION:
// Startup routine and main loop
//-------------------------------------------------------------------------------------------------------
int main (void) {
//UINT16 ledDutyCycle, dimmerDifference;
UINT8 n, test;
BOOL success, firstByte; //, senderReceiver;
// Initalize ports for communication with CC2420 and other peripheral units
PORT_INIT();
SPI_INIT();
// Initialize and enable the ADC for reading the pot meter
ADC_INIT();
ADC_SET_CHANNEL(ADC_INPUT_0_POT_METER);
ADC_ENABLE();
// Wait for the user to select node address, and initialize for basic RF operation
while (TRUE) {
if (JOYSTICK_CENTER_PRESSED()) {
senderReceiver = TRUE;
basicRfInit(&rfRxInfo, 26, 0x2420, 0x1234);
rfTxInfo.destAddr = 0x5678;
break;
} else if (JOYSTICK_UP_PRESSED()
|| JOYSTICK_DOWN_PRESSED()
|| JOYSTICK_LEFT_PRESSED()
||JOYSTICK_RIGHT_PRESSED()) {
senderReceiver = FALSE;
basicRfInit(&rfRxInfo, 26, 0x2420, 0x5678);
rfTxInfo.destAddr = 0x1234;
break;
}
}
// Turn on RX mode
basicRfReceiveOn();
//TEST CODE
ENABLE_UART1();
INIT_UART1(UART_BAUDRATE_250K, UART_OPT_8_BITS_PER_CHAR);
firstByte = TRUE;
while (senderReceiver) {
// Wait for sender to issue a request to send
while (TRUE) {
if ((BM(UART1_CTS) & PIND)==0b00000000) {
break;
}
}
// Send packet and wait for ACK (keep resending packet if no ACK is received)
do {
success = basicRfSendPacket(&rfTxInfo);
success = TRUE;
//basicRfSendPacket(&rfTxInfo);
SET_YLED();
}
while (success == FALSE);
CLR_YLED();
//halWait(65535);
//while (TRUE) {
//}
}
return 0;
} // main
////////////////////////////////////////////////////////////////////////////
//
// Lab Kit FINAL – Receive-Decoder-Display
//
////////////////////////////////////////////////////////////////////////////
wire reset;
wire [2:0] resolution_select;
wire [4:0] max_lines, max_blocks;
wire [9:0] addr_active;
wire [103:0] row;
wire [63:0] data_output;
wire decode_busy;
wire [2:0] inter_row_cnt;
wire [4:0] block_read, line_read;
wire [4:0] block_write, line_write;
wire [9:0] write_address, read_addr;
wire wen;
wire [2:0] input_select;
wire [2:0] column_select, column_select_write;
wire [143:0] shift_reg_output;
wire [17:0] stage1_output;
// Ray's wires
wire [63:0] dout0, dout1, dout2, dout3, dout4, dout5, dout6, dout7;
wire [9:0] addr;
wire [23:0] vga_out;
// Noel's wires
wire [639:0] dots;
wire [77:0] encoded_data;
wire [7:0] encoded_byte;
wire [3:0] rs232_state;
wire [2:0] state;
wire[1:0] shift_state;
wire enable, data_ready, wen_wireless, done;
wire [3:0] counter;
rx_control_unit rx_control(.clk(clock_27mhz),
.reset(reset),
.cts_b(rs232_cts_sync),
.rxd(rs232_rxd_sync),
.decode_busy(decode_busy),
.rts_b(rs232_rts),
.enable(enable),
.encoded_data(encoded_data),
.encoded_byte(encoded_byte),
.rs232_state(rs232_state),
.shift_state(shift_state),
.wen(wen_wireless),
.write_addr(write_address),
.state(state),
.done(done),
.counter(counter),
.data_ready(data_ready));
/*
toplevel_test2 top(.clk(clock_27mhz),
.reset(reset),
.cts_b(rs232_cts_sync),
.rxd(rs232_rxd_sync),
.rts_b(rs232_rts),
.data(encoded_byte),
.state(state),
.enable(enable),
.data_ready(data_ready));
*/
alpha_display alpha_dots(.clock(clock_27mhz),
.ascii(1'b1),
.bits(encoded_byte),
.dots(dots[39:0]));
alphanumeric_displays a_disp(.global_clock(clock_27mhz),
.manual_reset(~reset),
.disp_test(switch[7]),
.disp_blank(disp_blank),
.disp_clock(disp_clock),
.disp_rs(disp_rs),
.disp_ce_b(disp_ce_b),
.disp_reset_b(disp_reset_b),
.disp_data_out(disp_data_out),
.dots(dots));
wireless_memory WIREMEMDECODE001(
.wr_clk(clock_27mhz),
.wr_addr(write_address),
.din(encoded_data),
.wen(wen_wireless),
.r_clk(clock_27mhz),
.line_read(line_read),
.block_read(block_read),
.inter_row_cnt(inter_row_cnt),
.dout(row)
);
decoder DECODE001(
.clk(clock_27mhz),
.reset(reset),
.resolution_select(resolution_select),
.max_lines(max_lines),
.max_blocks(max_blocks),
.addr_active(write_address),
.row(row),
.decode_busy(decode_busy),
.inter_row_cnt(inter_row_cnt),
.block_read(block_read),
.line_read(line_read),
.data_output(data_output),
.wen(wen),
.mult_column(mult_column),
.column_select(column_select),
.input_select(input_select),
.stage1_output(stage1_output),
.shift_reg_output(shift_reg_output),
.line_write(line_write),
.block_write(block_write),
.column_select_write(column_select_write)
);
video_memory VIDMEMMOD001D(
.wr_clk(clock_27mhz),
.r_clk(clock_27mhz),
.wen(wen),
.line_write(line_write),
.block_write(block_write),
.column_select_write(column_select_write),
.column_data(data_output),
.addrb(addr),
.dout0(dout0),
.dout1(dout1),
.dout2(dout2),
.dout3(dout3),
.dout4(dout4),
.dout5(dout5),
.dout6(dout6),
.dout7(dout7),
.addra()
);
video_blackwhite VIDBW001(
.clk(clock_27mhz),
.reset(~reset),
.dout0(dout0),
.dout1(dout1),
.dout2(dout2),
.dout3(dout3),
.dout4(dout4),
.dout5(dout5),
.dout6(dout6),
.dout7(dout7),
.addr(addr),
.vga_out_sync_b(vga_out_sync_b),
.vga_out_blank_b(vga_out_blank_b),
.vga_out_hsync(vga_out_hsync),
.vga_out_vsync(vga_out_vsync),
.vga_out(vga_out)
);
always @(switch[2:0])
case (switch[2:0])
0: analyzer_out[12:0] = data_output[7:0];
1: analyzer_out[12:0] = data_output[15:8];
2: analyzer_out[12:0] = data_output[23:16];
3: analyzer_out[12:0] = data_output[31:24];
4: analyzer_out[12:0] = data_output[39:32];
5: analyzer_out[12:0] = data_output[47:40];
6: analyzer_out[12:0] = data_output[55:48];
7: analyzer_out[12:0] = data_output[63:56];
endcase // case(switch[2:0])
always @(switch[2:0])
case (switch[2:0])
0: sr_out[17:0] = shift_reg_output[17:0];
1: sr_out[17:0] = shift_reg_output[35:18];
2: sr_out[17:0] = shift_reg_output[53:36];
3: sr_out[17:0] = shift_reg_output[71:54];
4: sr_out[17:0] = shift_reg_output[89:72];
5: sr_out[17:0] = shift_reg_output[107:90];
6: sr_out[17:0] = shift_reg_output[125:108];
7: sr_out[17:0] = shift_reg_output[143:126];
endcase // case(switch[2:0])
always @(switch[2:0])
case (switch[2:0])
0: row_out[12:0] = row[12:0];
1: row_out[12:0] = row[25:13];
2: row_out[12:0] = row[38:26];
3: row_out[12:0] = row[51:39];
4: row_out[12:0] = row[64:52];
5: row_out[12:0] = row[77:65];
6: row_out[12:0] = row[90:78];
7: row_out[12:0] = row[103:91];
endcase // case(switch[1:0])
always @(switch[2:0])
case (switch[2:0])
0: data_in_out[7:0] = dout0;
1: data_in_out[7:0] = dout1;
2: data_in_out[7:0] = dout2;
3: data_in_out[7:0] = dout3;
4: data_in_out[7:0] = dout4;
5: data_in_out[7:0] = dout5;
6: data_in_out[7:0] = dout6;
7: data_in_out[7:0] = dout7;
endcase // case(switch[1:0])
endmodule // labkit
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:29:20 05/15/06
// Design Name:
// Module Name: rx_control_unit
// Project Name:
// Target Device:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module rx_control_unit(clk,
reset,
cts_b,
rxd,
decode_busy,
rts_b,
enable,
encoded_data,
encoded_byte,
rs232_state,
shift_state,
wen,
write_addr,
state,
done,
counter,
data_ready);
wire wen;
rx_shift_reg rxsr(.clk(clk),
.reset(reset),
.data_ready(data_ready),
.encoded_byte(encoded_byte),
.done(done),
.encoded_data(encoded_data),
.state(shift_state),
.counter(counter));
rs232_receiverFSM rx(.clk(clk),
.reset(reset),
.cts_b(cts_b),
.rxd(rxd),
.data(encoded_byte),
.data_ready(data_ready),
.rts_b(rts_b),
.state(rs232_state),
.enable(enable),
.rx_ready(rx_ready));
endmodule
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:17:46 05/13/06
// Design Name:
// Module Name: rs232_receiverFSM
// Project Name:
// Target Device:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module rs232_receiverFSM(clk,
reset,
cts_b,
rxd,
rx_ready,
data,
data_ready,
rts_b,
state,
enable);
if (data_ready) begin
data <= data_and_flags[8:1];
end
RECEIVE_DATA_BIT_1:
begin
first_count_int = 0;
counting_int = 1;
if (enable) begin
data_and_flags[2] = rxd;
next = RECEIVE_DATA_BIT_2;
end
else begin
next = RECEIVE_DATA_BIT_1;
end
end
RECEIVE_DATA_BIT_2:
begin
first_count_int = 0;
counting_int = 1;
if (enable) begin
data_and_flags[3] = rxd;
next = RECEIVE_DATA_BIT_3;
end
else begin
next = RECEIVE_DATA_BIT_2;
end
end
RECEIVE_DATA_BIT_3:
begin
first_count_int = 0;
counting_int = 1;
if (enable) begin
data_and_flags[4] = rxd;
next = RECEIVE_DATA_BIT_4;
end
else begin
next = RECEIVE_DATA_BIT_3;
end
end
RECEIVE_DATA_BIT_4:
begin
first_count_int = 0;
counting_int = 1;
if (enable) begin
data_and_flags[5] = rxd;
next = RECEIVE_DATA_BIT_5;
end
else begin
next = RECEIVE_DATA_BIT_4;
end
end
RECEIVE_DATA_BIT_5:
begin
first_count_int = 0;
counting_int = 1;
if (enable) begin
data_and_flags[6] = rxd;
next = RECEIVE_DATA_BIT_6;
end
else begin
next = RECEIVE_DATA_BIT_5;
end
end
RECEIVE_DATA_BIT_6:
begin
first_count_int = 0;
counting_int = 1;
if (enable) begin
data_and_flags[7] = rxd;
next = RECEIVE_DATA_BIT_7;
end
else begin
next = RECEIVE_DATA_BIT_6;
end
end
RECEIVE_DATA_BIT_7:
begin
first_count_int = 0;
counting_int = 1;
if (enable) begin
data_and_flags[8] = rxd;
//data_ready_int = 1;
next = IDLE;
end
else begin
next = RECEIVE_DATA_BIT_7;
end
end
IDLE:
begin
first_count_int = 0;
counting_int = 0;
if (rxd) begin
data_and_flags[9] = 1;
data_ready_int = 1;
next = RECEIVE_STOP_BIT;
end
else begin
next = IDLE;
end
end
endcase
end
endmodule
t̀imescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:44:43 05/07/06
// Design Name:
// Module Name: rx_shift_reg
// Project Name:
// Target Device:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module rx_shift_reg(clk,
reset,
data_ready,
encoded_byte,
done,
encoded_data,
state,
counter);
parameter IDLE = 0;
parameter A
WIT = 1;
parameter SAMPLE_AND_SHIFT = 2;
module wireless_memory(
wr_clk,
wr_addr,
din,
wen,
r_clk,
line_read,
block_read,
inter_row_cnt,
dout
);
always @(inter_row_cnt)
case (inter_row_cnt)
0: dout = coef[0],
{ coef[3], coef[5], 65'b0}
;
1: dout = coef[1],
{ coef[4], 78
'b0}
;
2: dout = coef[2],
{ 91'b0}
;
default: dout = 104'b0;
endcase // case(inter_row_cnt)
wireless_mem I
WREMEM0(.clka(wr_clk), .clkb(r_clk), .wea(wen),
.addra(wr_addr), .addrb(addrb), .dina(din), .doutb(memory_out));
endmodule // wireless_memory
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Decoder
// 05/05/2006
//
//////////////////////////////////////////////////////
module decoder(
clk,
reset,
resolution_select,
max_lines,
max_blocks,
addr_active,
row,
decode_busy,
inter_row_cnt,
block_read,
line_read,
data_output,
wen,
mult_column,
column_select,
input_select,
stage1_output,
shift_reg_output,
line_write,
block_write,
column_select_write
);
output decode_busy;
output [4:0] block_read, line_read;
output [2:0] inter_row_cnt;
output [63:0] data_output;
output [103:0] mult_column;
output [2:0] column_select;
output [2:0] input_select;
output [4:0] line_write, block_write;
output [2:0] column_select_write;
output wen;
endmodule // decoder
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// DCT Multiply Module - Decoder
// 05/12/2006
//
//////////////////////////////////////////////////////
module dct_multiply_decode(
clk,
reset,
row,
column_select,
output_column,
output_trunc,
stage1_output,
shift_reg_output
);
input clk;
input reset;
input [103:0] row;
input [2:0] column_select;
// Shift Register
mult_shift_reg MULTSHFTREG1D(
.clk(clk),
.reset(reset),
.coef(stage1_output),
.rdy(1'b1),
.column(shift_reg_output),
.done()
);
endmodule // dct_multiply_decode
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// DCT Front - First stage of multiply module - decode
// 05/12/2006
//
//////////////////////////////////////////////////////
module dct_front_decode(
clk,
row,
column,
output_trunc,
output_coef
);
input clk;
input [103:0] row;
input [71:0] column;
// Debugging vector
assign output_trunc = coef;
endmodule // dct_front_decode
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Single Matrix Coefficient enerator
G - Naive Implementation - Decoder
// 05/12/2006
//
//////////////////////////////////////////////////////
module matrix_naive_decode(
clk,
row,
column,
RX
_0, RX
_1, RX
_2, RX
_3, RX
_4, RX
_5, RX
_6, RX
_7,
RI_0, RI_1, RI_2, RI_3,
RM_0, RM_1,
product);
input clk;
input [103:0] row;
input [71:0] column;
assign RX
_0 = RX
[0];
assign RX
_1 = RX
[1];
assign RX
_2 = RX
[2];
assign RX
_3 = RX
[3];
assign RX
_4 = RX
[4];
assign RX
_5 = RX
[5];
assign RX
_6 = RX
[6];
assign RX
_7 = RX
[7];
mult_sign_13_9 MU
LT0(.
clk(clk), a(row_pixel[0]),
. b(col_pixel[0]),
.
(
q
.RX
[0]));
mult_sign_13_9 LT1(.
MU clk(clk), a(row_pixel[1]),
. .
b(col_pixel[1]),
.RX
(
q [1]));
mult_sign_13_9 LT2(.
MU clk(clk), a(row_pixel[2]),
. .
b(col_pixel[2]),
(
q
.RX
[2]));
mult_sign_13_9 LT3(.
MU clk(clk), a(row_pixel[3]),
. .
b(col_pixel[3]),
(
q
.RX
[3]));
mult_sign_13_9 MU clk(clk), a(row_pixel[4]),
LT4(. . b(col_pixel[4]),
.
(
q
.RX
[4]));
mult_sign_13_9 LT5(.
MU clk(clk), a(row_pixel[5]),
. .
b(col_pixel[5]),
(
q
.RX
[5]));
mult_sign_13_9 LT6(.
MU clk(clk), a(row_pixel[6]),
. .
b(col_pixel[6]),
.RX
(
q [6]));
mult_sign_13_9 LT7(.
MU clk(clk), a(row_pixel[7]),
. .
b(col_pixel[7]),
(
q
.RX
[7]));
adder_sign_22 ADD00(.
A(RX
[0]), B(RX
. [1]), S(RI[0]));
.
adder_sign_22 ADD01(. [2]),
A(RX . [3]),
B(RX .
S(RI[1]));
adder_sign_22 ADD02(. [4]),
A(RX . [5]),
B(RX .
S(RI[2]));
adder_sign_22 A(RX
ADD03(. [6]), B(RX
. [7]), S(RI[3]));
.
adder_sign_23 ADD10(.
A(RI[0]), B(RI[1]),
. S(RM[0]));
.
adder_sign_23 ADD11(.
A(RI[2]), B(RI[3]),
. .
S(RM[1]));
adder_sign_24 ADD20(.
A(RM[0]), B(RM[1]),
. S(product));
.
endmodule // matrix_naive_decode
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Truncate Stage 1 (25 bits -> 18bits) - Deocode
// 05/12/2006
//
//////////////////////////////////////////////////////
module trunc_s1_decode(
input_coef,
output_coef
);
endmodule // trunc_s1_decode
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// DCT Back - Second stage of multiply module - Decode
// 05/12/2006
//
//////////////////////////////////////////////////////
module dct_back_decode(
clk,
row0,
row1,
row2,
row3,
row4,
row5,
row6,
row7,
column,
output_trunc,
output_column
);
input clk;
input [71:0] row0, row1, row2, row3, row4, row5, row6, row7;
input [143:0] column;
endmodule // dct_back_decode
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
//
// Truncate Stage 2 (30 bits -> 10 bits) - Decode
// 04/24/2006
//
//////////////////////////////////////////////////////
module trunc_s2_decode(
input_coef,
output_coef
);
endmodule // trunc_s2_decode
//////////////////////////////////////////////////////
//
// Vivek Shah
// Final Project
//
// Decoder Finite State Machine
// 05/01/2006
//
//////////////////////////////////////////////////////
module decoder_fsm(
clk,
reset,
resolution_select,
max_blocks,
max_lines,
addr_active,
line_read,
block_read,
line_write,
block_write,
column_select,
column_select_write,
inter_row_cnt,
input_select,
decode_busy,
wen,
state);
parameter IDLE = 0;
parameter DECODE_BLOCK = 1;
integer i;
parameter PIPELINE = 3;
parameter NORMAL = 0;
parameter ZOOM = 1;
parameter OTHER = 2;
line_write <= 0;
block_write <= 0;
column_select_write <= 0;
wen <= 0;
end
else
begin
line_read <= line_read_int;
block_read <= block_read_int;
column_select <= column_select_int;
inter_row_cnt <= inter_row_cnt_int;
input_select <= input_pipe_int;
line_read_int = line_read;
block_read_int = block_read;
column_select_int = column_select;
inter_row_cnt_int = inter_row_cnt;
next = state;
decode_busy = 1;
wen_int = 0;
case (state)
//
// IDLE -> waiting for Video Capture to finish writing lines
//
IDLE:
begin
// NOTICE -> not registered
decode_busy = 0;
input_pipe_int = 0;
// Do nothing, wait for addr_active to move past current_line
if (line_read*30 + block_read == addr_active)
next = IDLE;
else
next = DECODE_BLOCK;
end
//
// Decode Block -> Multiply current block by DCT rows
//
DECODE_BLOCK:
begin
// Reset block_dct
if (inter_row_cnt == 7)
inter_row_cnt_int = 0;
else
inter_row_cnt_int = inter_row_cnt + 1;
if ((inter_row_cnt == 7) && (column_select == 7))
column_select_int = 0;
else if (inter_row_cnt == 7)
column_select_int = column_select + 1;
// Reset Blocks
if ((inter_row_cnt == 6) && (column_select == 7) && (block_read ==
max_blocks))
block_read_int = 0;
else if ((inter_row_cnt == 6) && (column_select == 7))
block_read_int = block_read + 1;
// Reset Lines
if ((inter_row_cnt == 6) && (column_select == 7) && (block_read ==
max_blocks) && (line_read == max_lines))
line_read_int = 0;
else if ((inter_row_cnt == 6) && (column_select == 7) &&
(block_read == max_blocks))
line_read_int = line_read + 1;
endcase // case(state)
endmodule // decode_fsm
//////////////////////////////////////////////////////
//
// iv
Vek hah
S
// inal
F roj
P ect
//
//
// ecoder
D - ideo
V emory
M odule
M
// 05/15/2006
//
//////////////////////////////////////////////////////
module i
vdeo_memory(
wr_clk,
r_clk,
wen,
line_write,
block_write,
column_select_write,
column_data,
addrb,
dout0,
dout1,
dout2,
dout3,
dout4,
dout5,
dout6,
dout7,
addra
);
output [63:0] dout0, dout1, dout2, dout3, dout4, dout5, dout6, dout7;
output [12:0] addra;
ideo_mem
v 000Daddra(addra),
M
E
D
I
V (. addrb(addrb),
. clka(wr_clk),
.
clkb(r_clk),
. .
dina(column_data[ 7: 0]), doutb(dout0),
. .
wea(wen));
v
ideo_mem 001Daddra(addra),
M
E
D
I
V (. .
addrb(addrb), clka(wr_clk),
.
clkb(r_clk),
. .
dina(column_data[15: 8]), doutb(dout1),
. .
wea(wen));
ideo_mem
v V (.
002Daddra(addra),
M
E
D
I addrb(addrb),
. .
clka(wr_clk),
.
clkb(r_clk), dina(column_data[23:16]),
. .
doutb(dout2), wea(wen));
.
v
ideo_mem 003Daddra(addra),
M
E
D
I
V (. .
addrb(addrb), clka(wr_clk),
.
clkb(r_clk),
. .
dina(column_data[31:24]), doutb(dout3),
. .
wea(wen));
v
ideo_mem 004Daddra(addra),
M
E
D
I
V (. .
addrb(addrb), clka(wr_clk),
.
.
clkb(r_clk), dina(column_data[39:32]),
. .
doutb(dout4), wea(wen));
.
v
ideo_mem 005Daddra(addra),
M
E
D
I
V (. .
addrb(addrb), clka(wr_clk),
.
clkb(r_clk),
. .
dina(column_data[47:40]), doutb(dout5),
. .
wea(wen));
ideo_mem
v 006Daddra(addra),
M
E
D
I
V (. addrb(addrb),
. clka(wr_clk),
.
clkb(r_clk),
. .
dina(column_data[55:48]), doutb(dout6),
. .
wea(wen));
v
ideo_mem 007Daddra(addra),
M
E
D
I
V (. .
addrb(addrb), clka(wr_clk),
.
clkb(r_clk),
. dina(column_data[63:56]),
. doutb(dout7),
. wea(wen));
.
endmodule // i
vdeo_memory
module i
vdeo_blackwhite(clk, reset, dout0, dout1, dout2, dout3, dout4, dout5,
dout6, dout7, addr,
v
ga_out_sync_b, ga_out_blank_b,
v v
ga_out_hsync, ga_out_v
v sync, ga_out);
v
input clk, reset;
input [63:0] dout0, dout1, dout2, dout3, dout4, dout5, dout6, dout7;
output [9:0] addr;
output ga_out_sync_b,
v ga_out_blank_b,
v v
ga_out_hsync, ga_out_v
v sync;
output [23:0] g
va_out;
wire [7:0] Y;
wire [9:0] pixel_count, line_count;
// nstantiate
I A
G
Vontroller
C
Vcontroller ontroller_display(clk,
_
A
G C reset, hsync, sync,
v pixel_count,
line_count, ga_out_sync_b,
v v
ga_out_blank_b, hblank, blank,
v dout);
// n
Istantiate delay
// n
Istantiate display
wire [23:0] _
B
G
Rout;
wire [38:0] doutb;
wire [7:0] ,
R ,G ;
B
assign R= 8'b0;
assign G= 8'b0;
assign B= 8'b0;
assign doutb = 38'b0;
assign _
B
G
Rout = Y,
{ Y, Y}
;
display top_display_display(clk, ,
R ,
G ,
B pixel_count,
line_count, doutb, addrb, ga_out,
v _
B
Rout);
G
endmodule
/*
i
vdeo_blackwhite(
clk(clk),
.
reset(reset),
.
dout0(dout0),
.
dout1(dout1),
.
.
dout2(dout2),
dout3(dout3),
.
dout4(dout4),
.
dout5(dout5),
.
dout6(dout6),
.
.
dout7(dout7),
addr(addr),
.
g
v
.a_out_sync_b(v
ga_out_sync_b),
g
v
.a_out_blank_b(v
ga_out_blank_b),
g
v
.a_out_hsync(v
ga_out_hsync),
g
v
.a_out_v ga_out_v
sync(v sync),
.a_out(v
g
v ga_out)
);
*/
module read64(clk, reset, Y, dout0, dout1, dout2, dout3, dout4, dout5, dout6,
dout7, addr,
pixel_count, line_count, read_counter, read_counter2, switch_dout_counter,
iteration_counter,
first_eight, second_eight, dout, start);
input clk, reset;
input [9:0] pixel_count, line_count;
input [63:0] dout0, dout1, dout2, dout3, dout4, dout5, dout6, dout7;
output [9:0] addr;
output [7:0] Y;
//new
output [3:0] read_counter;
output [4:0] read_counter2;
output [3:0] switch_dout_counter;
output [7:0] iteration_counter;
output [63:0] first_eight, second_eight, dout;
output start;
wire [63:0] dout0, dout1, dout2, dout3, dout4, dout5, dout6, dout7;
parameter x = 300;
//current
always @ (posedge clk)
begin
if (reset)
begin
read_counter <= 1;
read_counter2 <= 0;
being_read <= 0;
iteration_counter <= 0;
base_addr <= 0;
addr <= 0;
// switch_dout_counter <= 0;
end
else if (pixel_count == x - 5)
begin
case (line_count)
0:
base_addr <= 0;
8:
base_addr <= 30;
16:
base_addr <= 60;
24:
base_addr <= 90;
32:
base_addr <= 120;
40:
base_addr <= 150;
48:
base_addr <= 180;
56:
base_addr <= 210;
64:
base_addr <= 240;
72:
base_addr <= 270;
80:
base_addr <= 300;
88:
base_addr <= 330;
96:
base_addr <= 360;
104:
base_addr <= 390;
112:
base_addr <= 420;
120:
base_addr <= 450;
128:
base_addr <= 480;
136:
base_addr <= 510;
144:
base_addr <= 540;
152:
base_addr <= 570;
160:
base_addr <= 600;
168:
base_addr <= 630;
176:
base_addr <= 660;
184:
base_addr <= 690;
192:
base_addr <= 720;
200:
base_addr <= 750;
208:
base_addr <= 780;
216:
base_addr <= 810;
224:
base_addr <= 840;
232:
base_addr <= 870;
240:
base_addr <= 600;
default: base_addr <= base_addr;
endcase
end
/*
if (line_count == 0)
switch_dout_counter <= 0;
else
switch_dout_counter <= switch_dout_counter + 1;
case (switch_dout_counter)
0:
dout <= dout7;
1:
dout <= dout6;
2:
dout <= dout5;
3:
dout <= dout4;
4:
dout <= dout3;
5:
dout <= dout2;
6:
dout <= dout1;
7:
dout <= dout0;
endcase
end
*/
else if (pixel_count == x - 3)
addr <= base_addr;
else if (pixel_count == x)
if (line_count == 0)
begin
read_counter <= 1;
read_counter2 <= 0;
being_read <= 0;
iteration_counter <= 0;
end
else if (line_count < 240)
begin
read_counter <= 1;
read_counter2 <= 0;
being_read <= 0;
end
else
begin
read_counter <= read_counter;
read_counter2 <= read_counter2;
end
else if ((pixel_count == x + 1) && ((line_count == 0) || (line_count <
240)))
begin
start <= 1;
case (switch_dout_counter)
0:
first_eight <= dout7;
1:
first_eight <= dout6;
2:
first_eight <= dout5;
3:
first_eight <= dout4;
4:
first_eight <= dout3;
5:
first_eight <= dout2;
6:
first_eight <= dout1;
7:
first_eight <= dout0;
default: first_eight <= dout7;
endcase
end
/* if (line_count == 0)
begin
first_eight <= dout7;
start <= 1;
end
else
begin
first_eight <= dout;
start <= 1;
end
/* case (line_count)
0:
first_eight <= dout7;
default: first_eight <= dout;
endcase
*/
else if (start)
case (being_read)
0:
case(read_counter)
/* 0:
begin
Y <= first_eight[63:56];
read_counter <= read_counter + 1;
end */
1:
begin
Y <= first_eight[63:56];
read_counter <= read_counter + 1;
end
2:
begin
Y <= first_eight[55:48];
read_counter <= read_counter + 1;
end
3:
begin
Y <= first_eight[47:40];
read_counter <= read_counter + 1;
addr <= addr + 1;
end
4:
begin
Y <= first_eight[39:32];
read_counter <= read_counter + 1;
end
5:
begin
Y <= first_eight[31:24];
read_counter <= read_counter + 1;
end
6:
begin
Y <= first_eight[23:16];
read_counter <= read_counter + 1;
end
7:
begin
Y <= first_eight[15:8];
read_counter <= read_counter + 1;
end
8:
begin
Y <= first_eight[7:0];
read_counter <= 1;
being_read <= (being_read)? 0 : 1;
read_counter2 <= (read_counter2 == 29)? 0 :
read_counter2 + 1;
second_eight <= dout;
end
default: Y <= Y;
endcase
1:
case(read_counter)
0:
begin
Y <= second_eight[63:56];
read_counter <= read_counter + 1;
end
1:
begin
Y <= second_eight[63:56];
read_counter <= read_counter + 1;
end
2:
begin
Y <= second_eight[55:48];
read_counter <= read_counter + 1;
end
3:
begin
Y <= second_eight[47:40];
read_counter <= read_counter + 1;
addr <= (read_counter2 == 29)? base_addr : addr + 1;
end
4:
begin
Y <= second_eight[39:32];
read_counter <= read_counter + 1;
/*
if (read_counter2 == 29)
switch_dout_counter <= (switch_dout_counter == 7)?
0 :
switch_dout_counter + 1;
else
switch_dout_counter <= switch_dout_counter;
if (read_counter2 == 29)
if (line_count == 0)
switch_dout_counter <= 0;
else
switch_dout_counter <= switch_dout_counter +
1;
*/
end
5:
begin
Y <= second_eight[31:24];
read_counter <= read_counter + 1;
end
6:
begin
Y <= second_eight[23:16];
read_counter <= read_counter + 1;
end
7:
begin
Y <= second_eight[15:8];
read_counter <= read_counter + 1;
end
8:
begin
Y <= second_eight[7:0];
read_counter <= 1;
being_read <= (being_read)? 0 : 1;
read_counter2 <= (read_counter2 == 29)? 0 :
read_counter2 + 1;
iteration_counter <= ((read_counter2 == 29) &&
(iteration_counter == 239))?
0 :
(read_counter2 == 29)? iteration_counter + 1 : iteration_counter;
first_eight <= dout;
start <= (read_counter2 == 29)? 0 : 1;
end
default: Y <= Y;
endcase
endcase
else
begin
Y <= 8'h11;
start <= 0;
end
end
switch_dout_counter + 1;
else
switch_dout_counter <= switch_dout_counter;
end
/*
always @ (posedge clk)
begin
if (reset)
begin
base_addr <= 600;
end
else
begin
base_addr <= 600;
end
end
*/
/*
always @ (posedge clk)
begin
if (reset)
base_addr <= 300;
else if (pixel_count == x - 20)
case (line_count)
0:
base_addr <= 600;
default: base_addr <= base_addr;
/* 0:
base_addr <= 0;
8:
base_addr <= 30;
16:
base_addr <= 60;
24:
base_addr <= 90;
32:
base_addr <= 120;
40:
base_addr <= 150;
48:
base_addr <= 180;
56:
base_addr <= 210;
64:
base_addr <= 240;
72:
base_addr <= 270;
80:
base_addr <= 300;
88:
base_addr <= 330;
96:
base_addr <= 360;
104:
base_addr <= 390;
112:
base_addr <= 420;
120:
base_addr <= 450;
128:
base_addr <= 480;
136:
base_addr <= 510;
144:
base_addr <= 540;
152:
base_addr <= 570;
160:
base_addr <= 600;
168:
base_addr <= 630;
176:
base_addr <= 660;
184:
base_addr <= 690;
192:
base_addr <= 720;
200:
base_addr <= 750;
208:
base_addr <= 780;
216:
base_addr <= 810;
224:
base_addr <= 840;
232:
base_addr <= 870;
240:
base_addr <= 600;
default: base_addr <= base_addr; */
/* 0:
base_addr_int <= 0;
8:
base_addr_int <= 30;
16:
base_addr_int <= 60;
24:
base_addr_int <= 90;
32:
base_addr_int <= 120;
40:
base_addr_int <= 150;
48:
base_addr_int <= 180;
56:
base_addr_int <= 210;
64:
base_addr_int <= 240;
72:
base_addr_int <= 270;
80:
base_addr_int <= 300;
88:
base_addr_int <= 330;
96:
base_addr_int <= 360;
104:
base_addr_int <= 390;
112:
base_addr_int <= 420;
120:
base_addr_int <= 450;
128:
base_addr_int <= 480;
136:
base_addr_int <= 510;
144:
base_addr_int <= 540;
152:
base_addr_int <= 570;
160:
base_addr_int <= 600;
168:
base_addr_int <= 630;
176:
base_addr_int <= 660;
184:
base_addr_int <= 690;
192:
base_addr_int <= 720;
200:
base_addr_int <= 750;
208:
base_addr_int <= 780;
216:
base_addr_int <= 810;
224:
base_addr_int <= 840;
232:
base_addr_int <= 870;
240:
base_addr_int <= 600;
default: base_addr_int <= base_addr_int;
endcase
else
base_addr_int <= base_addr_int;
end
*/
/*
else if ((read_counter == 1) && (read_counter2 == 29) &&
(switch_dout_counter == 7))
case (line_count)
7:
base_addr <= 30;
207:
base_addr <= 330;
default: base_addr <= base_addr;
endcase */
/*
always @ (posedge clk)
begin
if (reset)
base_addr_int <= 0;
else
base_addr <= 0;
/* case (line_count)
0:
base_addr <= 0;
8:
base_addr <= 30;
16:
base_addr <= 60;
24:
base_addr <= 90;
32:
base_addr <= 120;
40:
base_addr <= 150;
48:
base_addr <= 180;
56:
base_addr <= 210;
64:
base_addr <= 240;
72:
base_addr <= 270;
80:
base_addr <= 300;
88:
base_addr <= 330;
96:
base_addr <= 360;
104:
base_addr <= 390;
112:
base_addr <= 420;
120:
base_addr <= 450;
128:
base_addr <= 480;
136:
base_addr <= 510;
144:
base_addr <= 540;
152:
base_addr <= 570;
160:
base_addr <= 600;
168:
base_addr <= 630;
176:
base_addr <= 660;
184:
base_addr <= 690;
192:
base_addr <= 720;
200:
base_addr <= 750;
208:
base_addr <= 780;
216:
base_addr <= 810;
224:
base_addr <= 840;
232:
base_addr <= 870;
default: base_addr <= base_addr;
endcase */
//end
endmodule
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:39
:55 05/14
/2006
// Design Name: dct_back_decode
// Module Name: tb_dct_back_decode.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: dct_back_decode
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_dct_back_decode_v;
// Inputs
reg clk;
reg [71:0] row0;
reg [71:0] row1;
reg [71:0] row2;
reg [71:0] row3;
reg [71:0] row4
;
reg [71:0] row5;
reg [71:0] row6;
reg [71:0] row7;
reg [14
3:0] column;
// Outputs
:0] output_trunc;
wire [239
wire [63:0] output_column;
initial begin
// Initialize Inputs
clk = 0;
row0 = dct_col[0];
row1 = dct_col[1];
row2 = dct_col[2];
row3 = dct_col[3];
row4= dct_col[4
];
row5 = dct_col[5];
row6 = dct_col[6];
row7 = dct_col[7];
column = 0;
endmodule // tb_dct_back_decode_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:4
0:3405/14
/2006
// Design Name: dct_front_decode
// Module Name: tb_dct_front_decode.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: dct_front_decode
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_dct_front_decode_v;
// Inputs
reg clk;
reg [103:0] row;
reg [71:0] column;
// Outputs
:0] output_trunc;
wire [24
wire [17:0] output_coef;
initial begin
// Initialize Inputs
clk = 0;
row = 0;
column = 0;
endmodule // tb_dct_front_decode_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:4 /2006
0:11 05/14
// Design Name: dct_multiply_decode
// Module Name: tb_dct_multiply_decode.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: dct_multiply_decode
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_dct_multiply_decode_v;
// Inputs
reg clk;
reg reset;
reg [103:0] row;
reg [2:0] column_select;
reg [12:0] temp;
// Outputs
wire [63:0] output_column;
:0] output_trunc;
wire [239
wire [17:0] stage1_output;
3:0] shift_reg_output;
wire [14
wire [29
:0] output_trunc_seg[7:0];
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
row = 1;
column_select = 0;
i = 0;
#4
0 row = 13'd2062,
{ 13'd0, 13'd0, 13'd0, 13'd0, 13'd0, 13'd0, 13'd0}
;
column_select = 0;
#4
0 row = 13'd2062,
{ 13'd0, 13'd0, 13'd0, 13'd0, 13'd0, 13'd0, 13'd0}
;
column_select = 0;
#4
0 row = 13'd127,
{ 13'd127, 13'd127, 13'd127, 13'd127, 13'd127, 13'd127,
13'd127}
;
column_select = 0;
endmodule // tb_dct_multiply_decode_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:28:16 05/14
/2006
// Design Name: decode_fsm
// Module Name: tb_decode_fsm.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: decode_fsm
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_decode_fsm_v;
// Inputs
reg clk;
reg reset;
reg [2:0] resolution_select;
reg [4
:0] max_blocks;
:0] max_lines;
reg [4
:0] addr_active;
reg [9
// Outputs
:0] line_read;
wire [4
:0] block_read;
wire [4
wire [2:0] column_select;
wire [2:0] inter_row_cnt;
wire [2:0] output_select;
wire decode_busy;
wire state;
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
resolution_select = 0;
;
max_blocks = 29
;
max_lines = 29
addr_active = 80;
endmodule // tb_decode_fsm_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03:04
:08 05/15/2006
// Design Name: decoder
// Module Name: tb_decoder.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: decoder
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_decoder_v;
// Inputs
reg clk;
reg reset;
reg [2:0] resolution_select;
reg [4
:0] max_lines;
:0] max_blocks;
reg [4
:0] addr_active;
reg [9
reg [103:0] row;
// Outputs
wire decode_busy;
wire [2:0] inter_row_cnt;
wire [4
:0] block_read;
:0] line_read;
wire [4
wire [63:0] data_output;
wire wen;
wire [103:0] mult_column;
wire [2:0] column_select;
wire [2:0] input_select;
wire [17:0] stage1_output;
wire [14
3:0] shift_reg_output;
:0]
wire [4 line_write;
:0]
wire [4 block_write;
wire [2:0] column_select_write;
integer i;
wire [7:0] coef[7:0];
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
resolution_select = 0;
;
max_lines = 29
;
max_blocks = 29
addr_active = 50;
row = 0;
endmodule // tb_decoder_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:53:0405/15/2006
// Design Name: decoder_fsm
// Module Name: tb_decoder_fsm.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: decoder_fsm
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_decoder_fsm_v;
// Inputs
reg clk;
reg reset;
reg [2:0] resolution_select;
reg [4
:0] max_blocks;
:0] max_lines;
reg [4
:0] addr_active;
reg [9
// Outputs
:0] line_read;
wire [4
:0] block_read;
wire [4
:0] line_write;
wire [4
wire [4
:0] block_write;
wire [2:0] column_select;
wire [2:0] column_select_write;
wire [2:0] inter_row_cnt;
wire [2:0] input_select;
wire decode_busy;
wire state;
wire wen;
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
resolution_select = 0;
;
max_blocks = 29
;
max_lines = 29
addr_active = 80;
endmodule // tb_decoder_fsm_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:4
0:51 05/14
/2006
// Design Name: matrix_naive_decode
// Module Name: tb_matrix_naive_decode.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: matrix_naive_decode
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_matrix_naive_decode_v;
// Inputs
reg clk;
reg [103:0] row;
reg [71:0] column;
// Outputs
wire [21:0] RX
_0;
wire [21:0] RX
_1;
_2;
wire [21:0] RX
_3;
wire [21:0] RX
_4
wire [21:0] RX;
_5;
wire [21:0] RX
wire [21:0] RX
_6;
_7;
wire [21:0] RX
wire [22:0] RI_0;
wire [22:0] RI_1;
wire [22:0] RI_2;
wire [22:0] RI_3;
wire [23:0] RM_0;
wire [23:0] RM_1;
wire [24
:0] product;
initial begin
// Initialize Inputs
clk = 0;
row = 0;
column = 0;
#5;
#4row = 13'd2,
{ 13'd2, 13'd2, 13'd2, 13'd2, 13'd2, 13'd2, 13'd2}
;
9
column = 'd2,
{ 'd2,
9 'd2,
9 'd2,
9 'd2,
9 'd2,
9 'd2,
9 'd2}
9 ;
#4row = 13'd1,
{ 13'd2, 13'd3, 13'd4
, 13'd5, 13'd6, 13'd7, 13'd8}
;
column = '
9{d1, 'd2,
9 'd3,
9 'd4
9 , 'd5,
9 'd6,
9 'd7,
9 'd8}
9 ;
#4row = 1
{3'h0FFF, 13'h0FFF, 13'h0FFF, 13'h0FFF, 13'h0FFF, 13'h0FFF,
;
13'h0FFF, 13'h0FFF}
column = 'hFF,
{
9 'hFF,
9 'hFF,
9 'hFF,
9 'hFF,
9 'hFF,
9 'hFF,
9 'hFF}
9 ;
#4row = 1
{3'h100, 13'h100, 13'h100, 13'h100, 13'h100, 13'h100, 13'h100,
;
13'h100}
9
column = 'h100,
{ 'h100,
9 'h100,
9 'h100,
9 'h100,
9 'h100,
9 9
'h100, 'h100}
9 ;
#4row = 1
{3'h0FFF, 13'h0FFF, 13'h0FFF, 13'h0FFF, 13'h0FFF, 13'h0FFF,
;
13'h0FFF, 13'h0FFF}
column = 'h100,
{
9 'h100,
9 'h100,
9 'h100,
9 'h100,
9 'h100,
9 9
'h100, 'h100}
9 ;
#4row = 13'd1,
{ 13'd2, 13'd3, 13'd4 ;
, 13'd5, 13'd6, 13'd7, 13'd8}
column = '
{d1, 'd2,
9 9 'd3,
9 'd4
9 , 'd5,
9 'd6,
9 'd7,
9 'd8}
9 ;
#4row = 13'd1,
{ 13'd1, 13'd1, 13'd1, 13'd1, 13'd1, 13'd1, 13'd1}
;
9
column = 'd1,
{ 'd1,
9 'd1,
9 'd1,
9 'd1,
9 'd1,
9 'd1,
9 'd1}
9 ;
#4row = 13'd0,
{ 13'd0, 13'd0, 13'd0, 13'd0, 13'd0, 13'd0, 13'd0}
;
column = 'd0,
{
9 'd0,
9 'd0,
9 'd0,
9 'd0,
9 'd0,
9 'd0,
9 'd0}
9 ;
endmodule // tb_matrix_naive_decode_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:23:4
1 05/15/2006
// Design Name: rx_control_unit
// Module Name: tb_rx_control_unit.v
// Project Name: final_project
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: rx_control_unit
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_rx_control_unit_v;
// Inputs
reg clk;
reg reset;
reg cts_b;
reg rxd;
reg decode_busy;
// Outputs
wire rts_b;
wire enable;
wire [77:0] encoded_data;
wire [7:0] encoded_byte;
wire [3:0] rs232_state;
wire shift_state;
wire wen;
wire [9
:0] write_addr;
wire[2:0] state;
defparam uut.rx.B
AUD_COUNTER = 3;
AL AUD_COUNTER = 1;
defparam uut.rx.HF_B
initial begin
// Initialize Inputs
clk = 0;
reset = 0;
cts_b = 0;
rxd = 1;
decode_busy = 1;
repeat (20)
begin
rxd = 0;
0;
#4
rxd = 1;
#360;
end
end
endmodule
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:11:5405/15/2006
// Design Name: video_memory
// Module Name: tb_video_memory.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: video_memory
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_video_memory_v;
// Inputs
reg wr_clk;
reg r_clk;
reg wen;
reg [4
:0] line_write;
:0] block_write;
reg [4
reg [2:0] column_select_write;
reg [63:0] column_data;
reg [9
:0] addrb;
// Outputs
wire [63:0] dout0;
wire [63:0] dout1;
wire [63:0] dout2;
wire [63:0] dout3;
wire [63:0] dout4
;
wire [63:0] dout5;
wire [63:0] dout6;
wire [63:0] dout7;
wire [12:0] addra;
initial begin
// Initialize Inputs
wr_clk = 0;
r_clk = 0;
wen = 0;
line_write = 0;
block_write = 0;
column_select_write = 0;
column_data = 0;
addrb = 0;
endmodule // tb_video_memory_v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:4
8:31 05/15/2006
// Design Name: wireless_memory
// Module Name: tb_wireless_memory.v
// Project Name: decoder_final
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: wireless_memory
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_wireless_memory_v;
// Inputs
reg wr_clk;
reg [9
:0] wr_addr;
reg [77:0] din;
reg wen;
reg r_clk;
reg [4
:0] line_read;
reg [4
:0] block_read;
reg [2:0] inter_row_cnt;
// Outputs
wire [103:0] dout;
initial begin
// Initialize Inputs
wr_clk = 0;
wr_addr = 0;
din = 0;
wen = 0;
r_clk = 0;
line_read = 0;
block_read = 0;
inter_row_cnt = 0;
end
endmodule
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19
::
41905/13/2006
// Design Name: rs232_receiverFSM
// Module Name: tb_receiver_FSM.v
// Project Name: final_project
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: rs232_receiverFSM
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_receiver_FSM_v;
// Inputs
reg clk;
reg reset;
reg cts_b;
reg rxd;
// Outputs
wire [7:0] data;
wire data_ready;
wire rts_b;
end
endmodule
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:50:12 05/15/2006
// Design Name: rx_shift_reg
// Module Name: tb_rx_shift_reg.v
// Project Name: final_project
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: rx_shift_reg
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module tb_rx_shift_reg_v;
// Inputs
reg clk;
reg reset;
reg data_ready;
reg [7:0] encoded_byte;
// Outputs
wire done, state;
wire [77:0] encoded_data;
end
endmodule