diff options
author | michael-west <michael.west@ettus.com> | 2014-03-25 15:59:03 -0700 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2014-03-25 15:59:03 -0700 |
commit | 04292f9b109479b639add31f83fd240a6387f488 (patch) | |
tree | 4b8723a4ae63626029704f901ee0083bb23bc1e9 /fpga/usrp3/sim/serial_to_settings/serial_settings_tasks.v | |
parent | 09915aa57bc88099cbcbbe925946ae65bc0ad8f0 (diff) | |
parent | ff8a1252f3a51369abe0a165d963b781089ec66c (diff) | |
download | uhd-04292f9b109479b639add31f83fd240a6387f488.tar.gz uhd-04292f9b109479b639add31f83fd240a6387f488.tar.bz2 uhd-04292f9b109479b639add31f83fd240a6387f488.zip |
Merge branch 'master' into mwest/b200_docs
Diffstat (limited to 'fpga/usrp3/sim/serial_to_settings/serial_settings_tasks.v')
-rw-r--r-- | fpga/usrp3/sim/serial_to_settings/serial_settings_tasks.v | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/fpga/usrp3/sim/serial_to_settings/serial_settings_tasks.v b/fpga/usrp3/sim/serial_to_settings/serial_settings_tasks.v new file mode 100644 index 000000000..a9e2c0344 --- /dev/null +++ b/fpga/usrp3/sim/serial_to_settings/serial_settings_tasks.v @@ -0,0 +1,59 @@ + + task serial_settings_transaction; + input [7:0] address; + input [31:0] data; + + integer x; + + begin + scl_r <= 1'b1; + sda_r <= 1'b1; + @(negedge clk); + @(negedge clk); + // Drive SDA low whilst SCL high to signal START + sda_r <= 1'b0; + @(negedge clk); + @(negedge clk); + // Send 8 Address bits MSB first on falling edge of SCL clocks + for (x = 7; x >= 0; x = x - 1) + serial_settings_bit(address[x]); + // Send 32 Data bits MSB first on falling edge of SCL clocks + for (x = 31; x >= 0; x = x - 1) + serial_settings_bit(data[x]); + // Send STOP. + scl_r <= 1'b0; + sda_r <= 1'b0; + @(negedge clk); + @(negedge clk); + @(negedge clk); + @(negedge clk); + scl_r <= 1'b1; + @(negedge clk); + @(negedge clk); + @(negedge clk); + @(negedge clk); + sda_r <= 1'b1; + @(negedge clk); + @(negedge clk); + @(negedge clk); + @(negedge clk); + end + endtask // serial_settings_transaction + + task serial_settings_bit; + input one_bit; + + begin + scl_r <= 1'b0; + sda_r <= one_bit; + @(negedge clk); + @(negedge clk); + @(negedge clk); + @(negedge clk); + scl_r <= 1'b1; + @(negedge clk); + @(negedge clk); + @(negedge clk); + @(negedge clk); + end + endtask // send_settings_bit |