% render "layouts/basic.html" do %# HTML tags can be embedded in mark down files if you want to do specific custom %# formatting like this, but in most cases that is not required.
.gemspec
~~~ruby
spec.add_runtime_dependency "<%= Origen.app.name %>", ">= <%= Origen.app.version %>"
~~~
__NOTE:__ In the case of a plugin, you will also need to require '<%= Origen.app.name %>'
somewhere in your environment.
### How To Use
The spi driver is intended to be instantiated as a sub_block. The configuration can be passed in as a hash and / or
can be changed after instantiation. See API for more details.
~~~ruby
sub_block :spi, class_name: 'OrigenSpi::Driver',
sclk_pin: :sclk,
mosi_pin: :mosi,
miso_pin: :miso,
ss_pin: :ss,
# :rl - return low - input data changes while sclk is low and is latched on rising edge
clk_format: :rl,
# drive state of 0 activates the slave port
ss_active: 0,
# wait time after ss_active and before any sclk activity
clk_wait_time: {time_in_cycles: 2},
# number of sclks per tester.cycle
clk_multiple: 1,
data_order: :lsb0
~~~
~~~ruby
# configuration can be changed after instantiation like this
dut.spi.clk_multiple = 80
dut.spi.miso_compare_cycle = 79
dut.spi.ss_pin = nil
~~~
Once the driver is instantiated shift operations can be performed by calls to the shift method (overlay/store/masking etc. is handled):
~~~ruby
# shift out, masking input compares
dut.spi.shift master_out: 0xFF, size: 32
# shift out, register - size doesn't need to be passed when register is provided
dut.spi.shift master_out: dut.my_reg
# shift in read examples:
dut.spi.shift master_in: 0xFF, size: 32
# provide a register to mask or store (mark the bits appropriately)
dut.spi.shift master_in: dut.my_reg
# simultaneous shift in/out
dut.spi.shift master_out: some_value_or_reg, master_in: some_other_value_or_reg
~~~
### How To Setup a Development Environment
To setup a development environment:
~~~
git clone https://github.com/Origen-SDK/origen_spi.git
~~~
% end