/////////////////////////////////////////////////////////////////////// // // alt_core module // // this is the behavioural model of the sports altimeter without pads // /////////////////////////////////////////////////////////////////////// `include "options.sv" module alt_core( output SegA, output SegB, output SegC, output SegD, output SegE, output SegF, output SegG, output DP, output logic [4:0] nDigit, input nMode, nTrip, output logic SPICLK, MOSI, nAltCS, input MISO, input Clock, nReset ); timeunit 1ns; timeprecision 100ps; // the following is behavioural (unsynthesisable) code to output P0000 assign { SegA, SegB, SegE, SegF } = '1; // always on; assign SegC = nDigit[4]; // on when Digit[4] is inactive assign SegD = nDigit[4]; // on when Digit[4] is inactive assign SegG = ~nDigit[4]; // on when Digit[4] is active assign DP = '0; // always off always begin nDigit = 5'b11110; #2.5ms nDigit = 5'b11101; #2.5ms nDigit = 5'b11011; #2.5ms nDigit = 5'b10111; #2.5ms nDigit = 5'b01111; #2.5ms nDigit = 5'b01111; end // this model sends a clock to the sensor // but makes no attempt to interpret the data // returned always begin SPICLK = '0; MOSI = '0; nAltCS = '1; #2s nAltCS = '0; repeat(32) begin SPICLK = '0; #9ms SPICLK = '1; #9ms SPICLK = '0; end #9ms nAltCS = '1; end endmodule